diff --git a/content/pages/editService.json b/content/pages/editService.json index 1c0dba0c..bee64ad6 100644 --- a/content/pages/editService.json +++ b/content/pages/editService.json @@ -162,6 +162,20 @@ "type": "checkbox", "options": ["This asset uses user defined parameters"], "required": false + }, + { + "name": "allow", + "label": "Allow ETH Address", + "placeholder": "e.g. 0xe328aB96B7CbB55A6E1c1054678137bA09780acA", + "help": "Enter an ETH address and click the ADD button to append to the list. Only ETH addresses in the allow list can consume this service. If the list is empty anyone can use this service.", + "type": "credentials" + }, + { + "name": "deny", + "label": "Deny ETH Address", + "placeholder": "e.g. 0xe328aB96B7CbB55A6E1c1054678137bA09780acA", + "help": "Enter an ETH address and click the ADD button to append to the list. If an ETH address is in the deny list, download or compute of this service will be denied for that ETH address.", + "type": "credentials" } ] } diff --git a/package-lock.json b/package-lock.json index 7444de2e..74eb27d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@coingecko/cryptoformat": "^0.5.4", "@loadable/component": "^5.15.3", "@oceanprotocol/art": "^3.2.0", - "@oceanprotocol/lib": "^3.3.3", + "@oceanprotocol/lib": "^3.4.3", "@oceanprotocol/typographies": "^0.1.0", "@oceanprotocol/use-dark-mode": "^2.4.3", "@tippyjs/react": "^4.2.6", @@ -127,6 +127,11 @@ "integrity": "sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ==", "dev": true }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", + "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -5405,23 +5410,140 @@ "node": ">=10" } }, + "node_modules/@oasisprotocol/deoxysii": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/@oasisprotocol/deoxysii/-/deoxysii-0.0.5.tgz", + "integrity": "sha512-a6wYPjk8ALDIiQW/971AKOTSTY1qSdld+Y05F44gVZvlb3FOyHfgbIxXm7CZnUG1A+jK49g5SCWYP+V3/Tc75Q==", + "dependencies": { + "bsaes": "0.0.2", + "uint32": "^0.2.1" + } + }, + "node_modules/@oasisprotocol/sapphire-paratime": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@oasisprotocol/sapphire-paratime/-/sapphire-paratime-1.3.2.tgz", + "integrity": "sha512-98EQ2BrT0942B0VY50PKcJ6xmUAcz71y8OBMizP6oBJIh0+ogw/z3r5z4veJitMXM4zQbh5wOFaS9eOcKWX5FA==", + "dependencies": { + "@noble/hashes": "1.3.2", + "@oasisprotocol/deoxysii": "0.0.5", + "cborg": "1.10.2", + "ethers": "6.10.0", + "tweetnacl": "1.0.3", + "type-fest": "2.19.0" + } + }, + "node_modules/@oasisprotocol/sapphire-paratime/node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@oasisprotocol/sapphire-paratime/node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@oasisprotocol/sapphire-paratime/node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + }, + "node_modules/@oasisprotocol/sapphire-paratime/node_modules/ethers": { + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.10.0.tgz", + "integrity": "sha512-nMNwYHzs6V1FR3Y4cdfxSQmNgZsRj1RiTU25JwvnJLmyzw9z3SKxNc2XKDuiXXo/v9ds5Mp9m6HBabgYQQ26tA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.10.0", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "18.15.13", + "aes-js": "4.0.0-beta.5", + "tslib": "2.4.0", + "ws": "8.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@oasisprotocol/sapphire-paratime/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, + "node_modules/@oasisprotocol/sapphire-paratime/node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, + "node_modules/@oasisprotocol/sapphire-paratime/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@oasisprotocol/sapphire-paratime/node_modules/ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/@oceanprotocol/art": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/@oceanprotocol/art/-/art-3.2.0.tgz", "integrity": "sha512-aUQtg4m5hJlQ0u8C29O9TXJWcAenO3G9vP+vf6LNFkpTDOCMycN/F0SzHS89VNrvGUha8oTDEg7FAkfZBPv2WA==" }, "node_modules/@oceanprotocol/contracts": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-2.0.3.tgz", - "integrity": "sha512-D2YtlsgmhBuSmF/Ue8zMWPtXNiB4zgW09NjUQzvDFrloUo0a7yC8r8L84LrVniw+0Nmly/PhLcdm8i018yc34g==" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-2.2.1.tgz", + "integrity": "sha512-ub+CuN61seLtUvdTm/iFCyF6+wG5iCovhLaDQywKJw3RuM4gzSnxeOkBf0n0sf1ZJOGuhVcPZXHOfybtUPqVjA==" }, "node_modules/@oceanprotocol/lib": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.3.3.tgz", - "integrity": "sha512-d98X3tBsfbtUJe90wmXI2HcabE3jyY+5628md6vpuItBCnSZgHIQaFvvND2jRThNEmr+4axavylNk/BS3muA5g==", - "license": "Apache-2.0", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.4.3.tgz", + "integrity": "sha512-S7qvnPORuiyu096AzlkvAH4pMzdTMcz9SMIVlo1UZ0neGV28yJYUjCYxgsTltHjn30Rn6eN5JhAuwPgUehLMIg==", "dependencies": { - "@oceanprotocol/contracts": "^2.0.3", + "@oasisprotocol/sapphire-paratime": "^1.3.2", + "@oceanprotocol/contracts": "^2.2.0", "cross-fetch": "^4.0.0", "crypto-js": "^4.1.1", "decimal.js": "^10.4.1", @@ -18777,9 +18899,9 @@ "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" }, "node_modules/@types/node": { - "version": "18.14.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.2.tgz", - "integrity": "sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA==" + "version": "18.15.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" }, "node_modules/@types/node-fetch": { "version": "2.6.2", @@ -23411,6 +23533,14 @@ "safe-buffer": "^5.1.2" } }, + "node_modules/bsaes": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/bsaes/-/bsaes-0.0.2.tgz", + "integrity": "sha512-iVxJFMOvCUG85sX2UVpZ9IgvH6Jjc5xpd/W8pALvFE7zfCqHkV7hW3M2XZtpg9biPS0K4Eka96bbNNgLohcpgQ==", + "dependencies": { + "uint32": "^0.2.1" + } + }, "node_modules/bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -23973,6 +24103,14 @@ "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", "peer": true }, + "node_modules/cborg": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/cborg/-/cborg-1.10.2.tgz", + "integrity": "sha512-b3tFPA9pUr2zCUiCfRd2+wok2/LBSNUMKOuRRok+WlvvAgEt/PlbgPTsZUcwCOs53IJvLgTp0eotwtosE6njug==", + "bin": { + "cborg": "cli.js" + } + }, "node_modules/ccount": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.1.0.tgz", @@ -51936,6 +52074,11 @@ "node": ">=0.8.0" } }, + "node_modules/uint32": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/uint32/-/uint32-0.2.1.tgz", + "integrity": "sha512-d3i8kc/4s1CFW5g3FctmF1Bu2GVXGBMTn82JY2BW0ZtTtI8pRx1YWGPCFBwRF4uYVSJ7ua4y+qYEPqS+x+3w7Q==" + }, "node_modules/uint8arrays": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz", @@ -54538,6 +54681,11 @@ "integrity": "sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ==", "dev": true }, + "@adraffy/ens-normalize": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", + "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" + }, "@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -58302,22 +58450,100 @@ "rimraf": "^3.0.2" } }, + "@oasisprotocol/deoxysii": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/@oasisprotocol/deoxysii/-/deoxysii-0.0.5.tgz", + "integrity": "sha512-a6wYPjk8ALDIiQW/971AKOTSTY1qSdld+Y05F44gVZvlb3FOyHfgbIxXm7CZnUG1A+jK49g5SCWYP+V3/Tc75Q==", + "requires": { + "bsaes": "0.0.2", + "uint32": "^0.2.1" + } + }, + "@oasisprotocol/sapphire-paratime": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@oasisprotocol/sapphire-paratime/-/sapphire-paratime-1.3.2.tgz", + "integrity": "sha512-98EQ2BrT0942B0VY50PKcJ6xmUAcz71y8OBMizP6oBJIh0+ogw/z3r5z4veJitMXM4zQbh5wOFaS9eOcKWX5FA==", + "requires": { + "@noble/hashes": "1.3.2", + "@oasisprotocol/deoxysii": "0.0.5", + "cborg": "1.10.2", + "ethers": "6.10.0", + "tweetnacl": "1.0.3", + "type-fest": "2.19.0" + }, + "dependencies": { + "@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "requires": { + "@noble/hashes": "1.3.2" + } + }, + "@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==" + }, + "aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + }, + "ethers": { + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.10.0.tgz", + "integrity": "sha512-nMNwYHzs6V1FR3Y4cdfxSQmNgZsRj1RiTU25JwvnJLmyzw9z3SKxNc2XKDuiXXo/v9ds5Mp9m6HBabgYQQ26tA==", + "requires": { + "@adraffy/ens-normalize": "1.10.0", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "18.15.13", + "aes-js": "4.0.0-beta.5", + "tslib": "2.4.0", + "ws": "8.5.0" + } + }, + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, + "tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, + "type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==" + }, + "ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "requires": {} + } + } + }, "@oceanprotocol/art": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/@oceanprotocol/art/-/art-3.2.0.tgz", "integrity": "sha512-aUQtg4m5hJlQ0u8C29O9TXJWcAenO3G9vP+vf6LNFkpTDOCMycN/F0SzHS89VNrvGUha8oTDEg7FAkfZBPv2WA==" }, "@oceanprotocol/contracts": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-2.0.3.tgz", - "integrity": "sha512-D2YtlsgmhBuSmF/Ue8zMWPtXNiB4zgW09NjUQzvDFrloUo0a7yC8r8L84LrVniw+0Nmly/PhLcdm8i018yc34g==" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-2.2.1.tgz", + "integrity": "sha512-ub+CuN61seLtUvdTm/iFCyF6+wG5iCovhLaDQywKJw3RuM4gzSnxeOkBf0n0sf1ZJOGuhVcPZXHOfybtUPqVjA==" }, "@oceanprotocol/lib": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.3.3.tgz", - "integrity": "sha512-d98X3tBsfbtUJe90wmXI2HcabE3jyY+5628md6vpuItBCnSZgHIQaFvvND2jRThNEmr+4axavylNk/BS3muA5g==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.4.3.tgz", + "integrity": "sha512-S7qvnPORuiyu096AzlkvAH4pMzdTMcz9SMIVlo1UZ0neGV28yJYUjCYxgsTltHjn30Rn6eN5JhAuwPgUehLMIg==", "requires": { - "@oceanprotocol/contracts": "^2.0.3", + "@oasisprotocol/sapphire-paratime": "^1.3.2", + "@oceanprotocol/contracts": "^2.2.0", "cross-fetch": "^4.0.0", "crypto-js": "^4.1.1", "decimal.js": "^10.4.1", @@ -68561,9 +68787,9 @@ "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" }, "@types/node": { - "version": "18.14.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.2.tgz", - "integrity": "sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA==" + "version": "18.15.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" }, "@types/node-fetch": { "version": "2.6.2", @@ -72300,6 +72526,14 @@ "safe-buffer": "^5.1.2" } }, + "bsaes": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/bsaes/-/bsaes-0.0.2.tgz", + "integrity": "sha512-iVxJFMOvCUG85sX2UVpZ9IgvH6Jjc5xpd/W8pALvFE7zfCqHkV7hW3M2XZtpg9biPS0K4Eka96bbNNgLohcpgQ==", + "requires": { + "uint32": "^0.2.1" + } + }, "bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -72733,6 +72967,11 @@ "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", "peer": true }, + "cborg": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/cborg/-/cborg-1.10.2.tgz", + "integrity": "sha512-b3tFPA9pUr2zCUiCfRd2+wok2/LBSNUMKOuRRok+WlvvAgEt/PlbgPTsZUcwCOs53IJvLgTp0eotwtosE6njug==" + }, "ccount": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.1.0.tgz", @@ -93972,6 +94211,11 @@ "dev": true, "optional": true }, + "uint32": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/uint32/-/uint32-0.2.1.tgz", + "integrity": "sha512-d3i8kc/4s1CFW5g3FctmF1Bu2GVXGBMTn82JY2BW0ZtTtI8pRx1YWGPCFBwRF4uYVSJ7ua4y+qYEPqS+x+3w7Q==" + }, "uint8arrays": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz", diff --git a/package.json b/package.json index d39a48ff..2e99aea5 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@coingecko/cryptoformat": "^0.5.4", "@loadable/component": "^5.15.3", "@oceanprotocol/art": "^3.2.0", - "@oceanprotocol/lib": "^3.3.3", + "@oceanprotocol/lib": "^3.4.3", "@oceanprotocol/typographies": "^0.1.0", "@oceanprotocol/use-dark-mode": "^2.4.3", "@tippyjs/react": "^4.2.6", diff --git a/src/components/Asset/Edit/AddService.tsx b/src/components/Asset/Edit/AddService.tsx index f16768e3..64265541 100644 --- a/src/components/Asset/Edit/AddService.tsx +++ b/src/components/Asset/Edit/AddService.tsx @@ -23,7 +23,10 @@ import { useAsset } from '@context/Asset' import { setNftMetadata } from '@utils/nft' import { getEncryptedFiles } from '@utils/provider' import { useAccount, useNetwork, useSigner } from 'wagmi' -import { transformConsumerParameters } from '@components/Publish/_utils' +import { + generateCredentials, + transformConsumerParameters +} from '@components/Publish/_utils' import { defaultDatatokenCap, defaultDatatokenTemplateIndex, @@ -160,6 +163,12 @@ export default function AddService({ newFiles = filesEncrypted } + const credentials = generateCredentials( + undefined, + values.allow, + values.deny + ) + const newService: Service = { id: getHash(datatokenAddress + newFiles), type: values.access, @@ -169,6 +178,7 @@ export default function AddService({ datatokenAddress, serviceEndpoint: values.providerUrl.url, timeout: mapTimeoutStringToSeconds(values.timeout), + credentials, ...(values.access === 'compute' && { compute: await transformComputeFormToServiceComputeOptions( values, diff --git a/src/components/Asset/Edit/DebugEditService.tsx b/src/components/Asset/Edit/DebugEditService.tsx index 827c9dd6..a2b2f82e 100644 --- a/src/components/Asset/Edit/DebugEditService.tsx +++ b/src/components/Asset/Edit/DebugEditService.tsx @@ -1,4 +1,4 @@ -import { Asset, LoggerInstance, Service } from '@oceanprotocol/lib' +import { Asset, Credentials, LoggerInstance, Service } from '@oceanprotocol/lib' import { ReactElement, useEffect, useState } from 'react' import DebugOutput from '@shared/DebugOutput' import { useCancelToken } from '@hooks/useCancelToken' @@ -10,7 +10,10 @@ import { previewDebugPatch } from '@utils/ddo' import { getEncryptedFiles } from '@utils/provider' -import { transformConsumerParameters } from '@components/Publish/_utils' +import { + generateCredentials, + transformConsumerParameters +} from '@components/Publish/_utils' export default function DebugEditService({ values, @@ -53,13 +56,20 @@ export default function DebugEditService({ LoggerInstance.error('Error encrypting files:', error.message) } + const credentials: Credentials = generateCredentials( + service.credentials, + values.allow, + values.deny + ) + const updatedService: Service = { ...service, name: values.name, description: values.description, type: values.access, timeout: mapTimeoutStringToSeconds(values.timeout), - files: updatedFiles, // TODO: check if this works + files: updatedFiles, // TODO: check if this works, + credentials, ...(values.access === 'compute' && { compute: await transformComputeFormToServiceComputeOptions( values, diff --git a/src/components/Asset/Edit/EditService.tsx b/src/components/Asset/Edit/EditService.tsx index 5919f6d4..d1916dc1 100644 --- a/src/components/Asset/Edit/EditService.tsx +++ b/src/components/Asset/Edit/EditService.tsx @@ -18,7 +18,10 @@ import { useAsset } from '@context/Asset' import { setNftMetadata } from '@utils/nft' import { getEncryptedFiles } from '@utils/provider' import { useAccount, useNetwork, useSigner } from 'wagmi' -import { transformConsumerParameters } from '@components/Publish/_utils' +import { + generateCredentials, + transformConsumerParameters +} from '@components/Publish/_utils' import FormEditService from './FormEditService' import { transformComputeFormToServiceComputeOptions } from '@utils/compute' import { useCancelToken } from '@hooks/useCancelToken' @@ -103,12 +106,19 @@ export default function EditService({ updatedFiles = filesEncrypted } + const updatedCredentials = generateCredentials( + service.credentials, + values.allow, + values.deny + ) + const updatedService: Service = { ...service, name: values.name, description: values.description, timeout: mapTimeoutStringToSeconds(values.timeout), - files: updatedFiles, // TODO: check if this works + files: updatedFiles, // TODO: check if this works, + credentials: updatedCredentials, ...(values.access === 'compute' && { compute: await transformComputeFormToServiceComputeOptions( values, diff --git a/src/components/Asset/Edit/FormAddService.tsx b/src/components/Asset/Edit/FormAddService.tsx index 82cb9d53..81bd5585 100644 --- a/src/components/Asset/Edit/FormAddService.tsx +++ b/src/components/Asset/Edit/FormAddService.tsx @@ -99,6 +99,13 @@ export default function FormAddService({ name="timeout" /> + + + + + + 0, consumerParameters: parseConsumerParameters(service.consumerParameters), + allow: + service.credentials?.allow?.find( + (credential) => credential.type === 'address' + )?.values || [], + deny: + service.credentials?.deny?.find( + (credential) => credential.type === 'address' + )?.values || [], ...computeSettings } } diff --git a/src/components/Asset/Edit/_types.ts b/src/components/Asset/Edit/_types.ts index cfe2e238..71b27396 100644 --- a/src/components/Asset/Edit/_types.ts +++ b/src/components/Asset/Edit/_types.ts @@ -27,6 +27,8 @@ export interface ServiceEditForm { timeout: string usesConsumerParameters: boolean consumerParameters: FormConsumerParameter[] + allow: string[] + deny: string[] // compute allowAllPublishedAlgorithms: boolean publisherTrustedAlgorithms: string[] diff --git a/src/components/Asset/Edit/_validation.ts b/src/components/Asset/Edit/_validation.ts index 79333ec5..2f4787a1 100644 --- a/src/components/Asset/Edit/_validation.ts +++ b/src/components/Asset/Edit/_validation.ts @@ -76,5 +76,7 @@ export const serviceValidationSchema = Yup.object().shape({ ), allowAllPublishedAlgorithms: Yup.boolean().nullable(), publisherTrustedAlgorithms: Yup.array().nullable(), - publisherTrustedAlgorithmPublishers: Yup.array().nullable() + publisherTrustedAlgorithmPublishers: Yup.array().nullable(), + allow: Yup.array().of(Yup.string()).nullable(), + deny: Yup.array().of(Yup.string()).nullable() }) diff --git a/src/components/Publish/_utils.ts b/src/components/Publish/_utils.ts index 581305b0..a0854bbd 100644 --- a/src/components/Publish/_utils.ts +++ b/src/components/Publish/_utils.ts @@ -95,7 +95,7 @@ export function transformConsumerParameters( } export function generateCredentials( - oldCredentials: Credentials, + oldCredentials: Credentials | undefined, updatedAllow: string[], updatedDeny: string[] ): Credentials {