From b21751edecffc5d1c67f8f002ecd2abb19c575cd Mon Sep 17 00:00:00 2001 From: 0xDmitry Date: Wed, 8 Nov 2023 00:33:13 +0300 Subject: [PATCH 1/7] fix(website): ipfs loader url --- .../website/src/features/Deploy/PublishUtility.tsx | 2 +- packages/website/src/hooks/cannon.ts | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/website/src/features/Deploy/PublishUtility.tsx b/packages/website/src/features/Deploy/PublishUtility.tsx index 6da52a3cf..e317a9787 100644 --- a/packages/website/src/features/Deploy/PublishUtility.tsx +++ b/packages/website/src/features/Deploy/PublishUtility.tsx @@ -73,7 +73,7 @@ export default function PublishUtility(props: { ); const loader = new IPFSBrowserLoader( - settings.ipfsApiUrl || 'https://repo.usecannon.com/' + 'https+ipfs://repo.usecannon.com:5001' ); const fromStorage = new CannonStorage( diff --git a/packages/website/src/hooks/cannon.ts b/packages/website/src/hooks/cannon.ts index bbd2f4939..95e246020 100644 --- a/packages/website/src/hooks/cannon.ts +++ b/packages/website/src/hooks/cannon.ts @@ -94,7 +94,7 @@ export function useCannonBuild(safe: SafeDefinition, def: ChainDefinition, prevD address: settings.registryAddress, }); - const ipfsLoader = new IPFSBrowserLoader(settings.ipfsApiUrl); + const ipfsLoader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com:5001'); setBuildStatus('Loading deployment data...'); @@ -252,7 +252,11 @@ export function useCannonWriteDeployToIpfs( const publishTxns = await publishPackage({ fromStorage: runtime, - toStorage: new CannonStorage(memoryRegistry, { ipfs: new IPFSBrowserLoader(settings.ipfsApiUrl) }, 'ipfs'), + toStorage: new CannonStorage( + memoryRegistry, + { ipfs: new IPFSBrowserLoader('https+ipfs://repo.usecannon.com:5001') }, + 'ipfs' + ), packageRef, variant, tags: ['latest'], @@ -316,7 +320,7 @@ export function useCannonPackage(packageRef: string, variant = '') { if (!pkgUrl) return null; try { - const loader = new IPFSBrowserLoader(settings.ipfsApiUrl || 'https://repo.usecannon.com/'); + const loader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com:5001'); const deployInfo: DeploymentInfo = await loader.read(pkgUrl as any); @@ -377,14 +381,14 @@ export function getContractsRecursive( export function useCannonPackageContracts(packageRef: string, variant = '') { const pkg = useCannonPackage(packageRef, variant); const [contracts, setContracts] = useState(null); - const settings = useStore((s) => s.settings); + // const settings = useStore((s) => s.settings); useEffect(() => { const getContracts = async () => { if (pkg.pkg) { const info = pkg.pkg; - const loader = new IPFSBrowserLoader(settings.ipfsApiUrl || 'https://repo.usecannon.com/'); + const loader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com:5001'); const readRuntime = new ChainBuilderRuntime( { provider: null as any, From cee8616a97a93f7ef133852cfb4fede9df72668a Mon Sep 17 00:00:00 2001 From: 0xDmitry Date: Wed, 8 Nov 2023 01:07:26 +0300 Subject: [PATCH 2/7] fix --- packages/website/src/features/Deploy/PublishUtility.tsx | 4 +--- packages/website/src/helpers/ipfs.ts | 2 +- packages/website/src/hooks/cannon.ts | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/website/src/features/Deploy/PublishUtility.tsx b/packages/website/src/features/Deploy/PublishUtility.tsx index e317a9787..830335fe7 100644 --- a/packages/website/src/features/Deploy/PublishUtility.tsx +++ b/packages/website/src/features/Deploy/PublishUtility.tsx @@ -72,9 +72,7 @@ export default function PublishUtility(props: { '' ); - const loader = new IPFSBrowserLoader( - 'https+ipfs://repo.usecannon.com:5001' - ); + const loader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com'); const fromStorage = new CannonStorage( new FallbackRegistry([fakeLocalRegistry, targetRegistry]), diff --git a/packages/website/src/helpers/ipfs.ts b/packages/website/src/helpers/ipfs.ts index cd596615e..a0f82298d 100644 --- a/packages/website/src/helpers/ipfs.ts +++ b/packages/website/src/helpers/ipfs.ts @@ -34,7 +34,7 @@ export function createIpfsUrl(base: string, pathname = '') { const uri = { protocol: customProtocol ? parsedUrl.protocol.split('+')[0] : parsedUrl.protocol, - host: customProtocol && !parsedUrl.host.includes(':') ? `${parsedUrl.host}:5001` : parsedUrl.host, + host: parsedUrl.host, pathname, query: parsedUrl.query, hash: parsedUrl.hash, diff --git a/packages/website/src/hooks/cannon.ts b/packages/website/src/hooks/cannon.ts index 95e246020..f3a89b5ab 100644 --- a/packages/website/src/hooks/cannon.ts +++ b/packages/website/src/hooks/cannon.ts @@ -94,7 +94,7 @@ export function useCannonBuild(safe: SafeDefinition, def: ChainDefinition, prevD address: settings.registryAddress, }); - const ipfsLoader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com:5001'); + const ipfsLoader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com'); setBuildStatus('Loading deployment data...'); @@ -254,7 +254,7 @@ export function useCannonWriteDeployToIpfs( fromStorage: runtime, toStorage: new CannonStorage( memoryRegistry, - { ipfs: new IPFSBrowserLoader('https+ipfs://repo.usecannon.com:5001') }, + { ipfs: new IPFSBrowserLoader('https+ipfs://repo.usecannon.com') }, 'ipfs' ), packageRef, @@ -320,7 +320,7 @@ export function useCannonPackage(packageRef: string, variant = '') { if (!pkgUrl) return null; try { - const loader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com:5001'); + const loader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com'); const deployInfo: DeploymentInfo = await loader.read(pkgUrl as any); @@ -388,7 +388,7 @@ export function useCannonPackageContracts(packageRef: string, variant = '') { if (pkg.pkg) { const info = pkg.pkg; - const loader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com:5001'); + const loader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com'); const readRuntime = new ChainBuilderRuntime( { provider: null as any, From 355ded52d870cae2914a297bd1d1dbe46d346a4e Mon Sep 17 00:00:00 2001 From: 0xDmitry Date: Wed, 8 Nov 2023 01:31:28 +0300 Subject: [PATCH 3/7] bump builder version --- package-lock.json | 152 ++++++++++++++++++++++++++++++++-- packages/website/package.json | 4 +- 2 files changed, 145 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4cd8a07c1..b291bcf4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12589,9 +12589,9 @@ "dev": true }, "node_modules/@types/estree": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.4.tgz", - "integrity": "sha512-2JwWnHK9H+wUZNorf2Zr6ves96WHoWDJIftkcxPKsS7Djta6Zu519LarhRNljPXkpsZR2ZMwNCPeW7omW07BJw==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, "node_modules/@types/form-data": { @@ -12812,9 +12812,9 @@ "dev": true }, "node_modules/@types/pako": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@types/pako/-/pako-2.0.2.tgz", - "integrity": "sha512-AtTbzIwhvLMTEUPudP3hxUwNK50DoX3amfVJmmL7WQH5iF3Kfqs8pG1tStsewHqmh75ULmjjldKn/B70D6DNcQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/pako/-/pako-2.0.3.tgz", + "integrity": "sha512-bq0hMV9opAcrmE0Byyo0fY3Ew4tgOevJmQ9grUhpXQhYfyLJ1Kqg3P33JT5fdbT2AjeAjR51zqqVjAL/HMkx7Q==", "dev": true }, "node_modules/@types/parse-json": { @@ -40759,7 +40759,6 @@ } }, "packages/builder": { - "name": "@usecannon/builder", "version": "2.9.6", "license": "MIT", "dependencies": { @@ -41352,8 +41351,8 @@ "@types/node": "20.3.2", "@types/react": "18.2.14", "@types/react-dom": "18.2.6", - "@usecannon/builder": "^2.9.5", - "@usecannon/cli": "^2.9.6", + "@usecannon/builder": "^2.9.7", + "@usecannon/cli": "^2.9.8", "@vercel/analytics": "^1.1.1", "axios": "^1.4.0", "chakra-react-select": "^4.7.0", @@ -41464,11 +41463,77 @@ } } }, + "packages/website/node_modules/@synthetixio/router": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@synthetixio/router/-/router-3.3.0.tgz", + "integrity": "sha512-I/McfsD2vwQNDATQ43IAyTCRs3kER9S7KiNd2EG0cDErki4qGlwhBV+VNaa+V+TJr9K0tKf2IvT3x7CaXFDSMw==", + "dependencies": { + "@ethersproject/keccak256": "^5.7.0", + "debug": "^4.3.4", + "mustache": "^4.2.0" + }, + "peerDependencies": { + "@usecannon/builder": "^2.0.0", + "ethers": "^5.0.0", + "hardhat": "^2.0.0", + "solc": "^0.8.17" + } + }, "packages/website/node_modules/@types/node": { "version": "20.3.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.2.tgz", "integrity": "sha512-vOBLVQeCQfIcF/2Y7eKFTqrMnizK5lRNQ7ykML/5RuwVXVWxYkgwS7xbt4B6fKCUPgbSL5FSsjHQpaGQP/dQmw==" }, + "packages/website/node_modules/@usecannon/builder": { + "version": "2.9.7", + "resolved": "https://registry.npmjs.org/@usecannon/builder/-/builder-2.9.7.tgz", + "integrity": "sha512-7TpKAoHf4V4dSCsOlQ48yxS9K8Y/kUslh7Sui+mdB1WnGTTdnqCFAS3FwYs7v0Mbos6Eli8YIbNOz5snd4aNYA==", + "dependencies": { + "@synthetixio/router": "^3.3.0", + "axios": "^1.2.2", + "buffer": "^6.0.3", + "debug": "^4.3.4", + "form-data": "^4.0.0", + "lodash": "^4.17.21", + "pako": "^2.1.0", + "promise-events": "^0.2.4", + "typedoc-plugin-markdown": "^3.15.4", + "zod": "^3.21.4" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "ethers": ">=5.6.0 < 6.0.0" + } + }, + "packages/website/node_modules/@usecannon/cli": { + "version": "2.9.8", + "resolved": "https://registry.npmjs.org/@usecannon/cli/-/cli-2.9.8.tgz", + "integrity": "sha512-if0Nbk8fjlH+3wHtZeyb1M6ffgt3QnnpvuuM4S2NMiMCT3cryL1PF8lJX5l1emVl/wDWlvHDvcXdIZO7bC7C6w==", + "dependencies": { + "@iarna/toml": "^3.0.0", + "@synthetixio/wei": "^2.74.1", + "@usecannon/builder": "^2.9.7", + "chalk": "^4.1.2", + "commander": "^9.5.0", + "debug": "^4.3.4", + "eth-provider": "^0.13.6", + "ethers": "^5.7.1", + "fastq": "^1.15.0", + "fs-extra": "^10.1.0", + "lodash": "^4.17.21", + "promise-timeout": "^1.3.0", + "prompts": "^2.4.2", + "semver": "^7.3.7", + "table": "^6.8.0", + "tildify": "2.0.0", + "untildify": "^4.0.0" + }, + "bin": { + "cannon": "bin/cannon.js" + } + }, "packages/website/node_modules/@wagmi/connectors": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/@wagmi/connectors/-/connectors-3.1.3.tgz", @@ -41670,6 +41735,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "packages/website/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "packages/website/node_modules/prettier": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", @@ -41684,6 +41760,59 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "packages/website/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "packages/website/node_modules/solc": { + "version": "0.8.22", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.22.tgz", + "integrity": "sha512-bA2tMZXx93R8L5LUH7TlB/f+QhkVyxrrY6LmgJnFFZlRknrhYVlBK1e3uHIdKybwoFabOFSzeaZjPeL/GIpFGQ==", + "peer": true, + "dependencies": { + "command-exists": "^1.2.8", + "commander": "^8.1.0", + "follow-redirects": "^1.12.1", + "js-sha3": "0.8.0", + "memorystream": "^0.3.1", + "semver": "^5.5.0", + "tmp": "0.0.33" + }, + "bin": { + "solcjs": "solc.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "packages/website/node_modules/solc/node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "peer": true, + "engines": { + "node": ">= 12" + } + }, + "packages/website/node_modules/solc/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "peer": true, + "bin": { + "semver": "bin/semver" + } + }, "packages/website/node_modules/type-fest": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", @@ -41802,6 +41931,11 @@ "optional": true } } + }, + "packages/website/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } } } diff --git a/packages/website/package.json b/packages/website/package.json index 390b6dd07..d22c76715 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -26,8 +26,8 @@ "@types/node": "20.3.2", "@types/react": "18.2.14", "@types/react-dom": "18.2.6", - "@usecannon/builder": "^2.9.5", - "@usecannon/cli": "^2.9.6", + "@usecannon/builder": "^2.9.7", + "@usecannon/cli": "^2.9.8", "@vercel/analytics": "^1.1.1", "axios": "^1.4.0", "chakra-react-select": "^4.7.0", From 5ed350ae597658c1fc818eccbfd578e84d4ab522 Mon Sep 17 00:00:00 2001 From: 0xDmitry Date: Wed, 8 Nov 2023 01:50:21 +0300 Subject: [PATCH 4/7] fix --- packages/website/src/helpers/ipfs.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/website/src/helpers/ipfs.ts b/packages/website/src/helpers/ipfs.ts index a0f82298d..ae1f70cc6 100644 --- a/packages/website/src/helpers/ipfs.ts +++ b/packages/website/src/helpers/ipfs.ts @@ -12,7 +12,7 @@ export function parseIpfsHash(url: string) { export function isIpfsUploadEndpoint(ipfsUrl: string) { try { const url = new URL(ipfsUrl); - return url.port === '5001' || url.protocol === 'http+ipfs:' || url.protocol === 'https+ipfs:'; + url.protocol === 'http+ipfs:' || url.protocol === 'https+ipfs:'; } catch (_) { return false; } @@ -30,10 +30,8 @@ export function createIpfsUrl(base: string, pathname = '') { const parsedUrl = parseUrl(base); const headers: { [k: string]: string } = {}; - const customProtocol = parsedUrl.protocol.endsWith('+ipfs'); - const uri = { - protocol: customProtocol ? parsedUrl.protocol.split('+')[0] : parsedUrl.protocol, + protocol: parsedUrl.protocol, host: parsedUrl.host, pathname, query: parsedUrl.query, From 119b9515321cd4899ae41e89b6c81439d7a86e73 Mon Sep 17 00:00:00 2001 From: 0xDmitry Date: Thu, 9 Nov 2023 17:34:50 +0300 Subject: [PATCH 5/7] wired up new ipfs loader --- package-lock.json | 485 +++++++++++++++++- packages/website/package.json | 4 +- .../src/features/Deploy/PublishUtility.tsx | 17 +- .../features/Deploy/QueueFromGitOpsPage.tsx | 34 +- .../src/features/Settings/SettingsPage.tsx | 11 +- packages/website/src/helpers/ipfs.ts | 11 +- packages/website/src/helpers/store.ts | 2 + packages/website/src/hooks/cannon.ts | 18 +- 8 files changed, 537 insertions(+), 45 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0110a6dc0..db7fae70d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -251,6 +251,11 @@ "node": ">=14" } }, + "node_modules/@assemblyscript/loader": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.9.4.tgz", + "integrity": "sha512-HazVq9zwTVwGmqdwYzu7WyQ6FQVZ7SwET0KKQuKm55jD0IfUpZgN0OPIiZG3zV1iSrVYcN0bdwLRXI/VNCYsUA==" + }, "node_modules/@babel/code-frame": { "version": "7.22.13", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", @@ -7552,6 +7557,11 @@ "tslib": "^2.3.1" } }, + "node_modules/@multiformats/base-x": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@multiformats/base-x/-/base-x-4.0.1.tgz", + "integrity": "sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw==" + }, "node_modules/@next/env": { "version": "13.5.6", "resolved": "https://registry.npmjs.org/@next/env/-/env-13.5.6.tgz", @@ -23227,6 +23237,19 @@ "resolved": "https://registry.npmjs.org/gsap/-/gsap-3.12.2.tgz", "integrity": "sha512-EkYnpG8qHgYBFAwsgsGEqvT1WUidX0tt/ijepx7z8EUJHElykg91RvW1XbkT59T0gZzzszOpjQv7SE41XuIXyQ==" }, + "node_modules/hamt-sharding": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hamt-sharding/-/hamt-sharding-2.0.1.tgz", + "integrity": "sha512-vnjrmdXG9dDs1m/H4iJ6z0JFI2NtgsW5keRkTcM85NGak69Mkf5PHUqBz+Xs0T4sg0ppvj9O5EGAJo40FTxmmA==", + "dependencies": { + "sparse-array": "^1.3.1", + "uint8arrays": "^3.0.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, "node_modules/handlebars": { "version": "4.7.8", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", @@ -24441,6 +24464,75 @@ "uint8arrays": "^3.0.0" } }, + "node_modules/interface-ipld-format": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/interface-ipld-format/-/interface-ipld-format-1.0.1.tgz", + "integrity": "sha512-WV/ar+KQJVoQpqRDYdo7YPGYIUHJxCuOEhdvsRpzLqoOIVCqPKdMMYmsLL1nCRsF3yYNio+PAJbCKiv6drrEAg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "cids": "^1.1.6", + "multicodec": "^3.0.1", + "multihashes": "^4.0.2" + } + }, + "node_modules/interface-ipld-format/node_modules/cids": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/cids/-/cids-1.1.9.tgz", + "integrity": "sha512-l11hWRfugIcbGuTZwAM5PwpjPPjyb6UZOGwlHSnOBV5o07XhQ4gNpBN67FbODvpjyHtd+0Xs6KNvUcGBiDRsdg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "multibase": "^4.0.1", + "multicodec": "^3.0.1", + "multihashes": "^4.0.1", + "uint8arrays": "^3.0.0" + }, + "engines": { + "node": ">=4.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/interface-ipld-format/node_modules/multibase": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-4.0.6.tgz", + "integrity": "sha512-x23pDe5+svdLz/k5JPGCVdfn7Q5mZVMBETiC+ORfO+sor9Sgs0smJzAjfTbM5tckeCqnaUuMYoz+k3RXMmJClQ==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "@multiformats/base-x": "^4.0.1" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/interface-ipld-format/node_modules/multicodec": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-3.2.1.tgz", + "integrity": "sha512-+expTPftro8VAW8kfvcuNNNBgb9gPeNYV9dn+z1kJRWF2vih+/S79f2RVeIwmrJBUJ6NT9IUPWnZDQvegEh5pw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "uint8arrays": "^3.0.0", + "varint": "^6.0.0" + } + }, + "node_modules/interface-ipld-format/node_modules/multihashes": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-4.0.3.tgz", + "integrity": "sha512-0AhMH7Iu95XjDLxIeuCOOE4t9+vQZsACyKZ9Fxw2pcsRmlX4iCn1mby0hS0bb+nQOVpdQYWPpnyusw4da5RPhA==", + "dependencies": { + "multibase": "^4.0.1", + "uint8arrays": "^3.0.0", + "varint": "^5.0.2" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/interface-ipld-format/node_modules/multihashes/node_modules/varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" + }, "node_modules/interface-store": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/interface-store/-/interface-store-2.0.2.tgz", @@ -24577,6 +24669,18 @@ "npm": ">=3.0.0" } }, + "node_modules/ipfs-only-hash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ipfs-only-hash/-/ipfs-only-hash-4.0.0.tgz", + "integrity": "sha512-TE1DZCvfw8i3gcsTq3P4TFx3cKFJ3sluu/J3XINkJhIN9OwJgNMqKA+WnKx6ByCb1IoPXsTp1KM7tupElb6SyA==", + "dependencies": { + "ipfs-unixfs-importer": "^7.0.1", + "meow": "^9.0.0" + }, + "bin": { + "ipfs-only-hash": "cli.js" + } + }, "node_modules/ipfs-unixfs": { "version": "6.0.9", "resolved": "https://registry.npmjs.org/ipfs-unixfs/-/ipfs-unixfs-6.0.9.tgz", @@ -24590,6 +24694,144 @@ "npm": ">=7.0.0" } }, + "node_modules/ipfs-unixfs-importer": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ipfs-unixfs-importer/-/ipfs-unixfs-importer-7.0.3.tgz", + "integrity": "sha512-qeFOlD3AQtGzr90sr5Tq1Bi8pT5Nr2tSI8z310m7R4JDYgZc6J1PEZO3XZQ8l1kuGoqlAppBZuOYmPEqaHcVQQ==", + "dependencies": { + "bl": "^5.0.0", + "cids": "^1.1.5", + "err-code": "^3.0.1", + "hamt-sharding": "^2.0.0", + "ipfs-unixfs": "^4.0.3", + "ipld-dag-pb": "^0.22.2", + "it-all": "^1.0.5", + "it-batch": "^1.0.8", + "it-first": "^1.0.6", + "it-parallel-batch": "^1.0.9", + "merge-options": "^3.0.4", + "multihashing-async": "^2.1.0", + "rabin-wasm": "^0.1.4", + "uint8arrays": "^2.1.2" + }, + "engines": { + "node": ">=14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/ipfs-unixfs-importer/node_modules/bl": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", + "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/ipfs-unixfs-importer/node_modules/cids": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/cids/-/cids-1.1.9.tgz", + "integrity": "sha512-l11hWRfugIcbGuTZwAM5PwpjPPjyb6UZOGwlHSnOBV5o07XhQ4gNpBN67FbODvpjyHtd+0Xs6KNvUcGBiDRsdg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "multibase": "^4.0.1", + "multicodec": "^3.0.1", + "multihashes": "^4.0.1", + "uint8arrays": "^3.0.0" + }, + "engines": { + "node": ">=4.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/ipfs-unixfs-importer/node_modules/cids/node_modules/uint8arrays": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", + "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, + "node_modules/ipfs-unixfs-importer/node_modules/ipfs-unixfs": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/ipfs-unixfs/-/ipfs-unixfs-4.0.3.tgz", + "integrity": "sha512-hzJ3X4vlKT8FQ3Xc4M1szaFVjsc1ZydN+E4VQ91aXxfpjFn9G2wsMo1EFdAXNq/BUnN5dgqIOMP5zRYr3DTsAw==", + "dependencies": { + "err-code": "^3.0.1", + "protobufjs": "^6.10.2" + }, + "engines": { + "node": ">=14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/ipfs-unixfs-importer/node_modules/multibase": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-4.0.6.tgz", + "integrity": "sha512-x23pDe5+svdLz/k5JPGCVdfn7Q5mZVMBETiC+ORfO+sor9Sgs0smJzAjfTbM5tckeCqnaUuMYoz+k3RXMmJClQ==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "@multiformats/base-x": "^4.0.1" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/ipfs-unixfs-importer/node_modules/multicodec": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-3.2.1.tgz", + "integrity": "sha512-+expTPftro8VAW8kfvcuNNNBgb9gPeNYV9dn+z1kJRWF2vih+/S79f2RVeIwmrJBUJ6NT9IUPWnZDQvegEh5pw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "uint8arrays": "^3.0.0", + "varint": "^6.0.0" + } + }, + "node_modules/ipfs-unixfs-importer/node_modules/multicodec/node_modules/uint8arrays": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", + "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, + "node_modules/ipfs-unixfs-importer/node_modules/multihashes": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-4.0.3.tgz", + "integrity": "sha512-0AhMH7Iu95XjDLxIeuCOOE4t9+vQZsACyKZ9Fxw2pcsRmlX4iCn1mby0hS0bb+nQOVpdQYWPpnyusw4da5RPhA==", + "dependencies": { + "multibase": "^4.0.1", + "uint8arrays": "^3.0.0", + "varint": "^5.0.2" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/ipfs-unixfs-importer/node_modules/multihashes/node_modules/uint8arrays": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", + "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, + "node_modules/ipfs-unixfs-importer/node_modules/multihashes/node_modules/varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" + }, + "node_modules/ipfs-unixfs-importer/node_modules/uint8arrays": { + "version": "2.1.10", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-2.1.10.tgz", + "integrity": "sha512-Q9/hhJa2836nQfEJSZTmr+pg9+cDJS9XEAp7N2Vg5MzL3bK/mkMVfjscRGYruP9jNda6MAdf4QD/y78gSzkp6A==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, "node_modules/ipfs-utils": { "version": "9.0.14", "resolved": "https://registry.npmjs.org/ipfs-utils/-/ipfs-utils-9.0.14.tgz", @@ -24617,6 +24859,115 @@ "npm": ">=7.0.0" } }, + "node_modules/ipld-dag-pb": { + "version": "0.22.3", + "resolved": "https://registry.npmjs.org/ipld-dag-pb/-/ipld-dag-pb-0.22.3.tgz", + "integrity": "sha512-dfG5C5OVAR4FEP7Al2CrHWvAyIM7UhAQrjnOYOIxXGQz5NlEj6wGX0XQf6Ru6or1na6upvV3NQfstapQG8X2rg==", + "deprecated": "This module has been superseded by @ipld/dag-pb and multiformats", + "dependencies": { + "cids": "^1.0.0", + "interface-ipld-format": "^1.0.0", + "multicodec": "^3.0.1", + "multihashing-async": "^2.0.0", + "protobufjs": "^6.10.2", + "stable": "^0.1.8", + "uint8arrays": "^2.0.5" + }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/ipld-dag-pb/node_modules/cids": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/cids/-/cids-1.1.9.tgz", + "integrity": "sha512-l11hWRfugIcbGuTZwAM5PwpjPPjyb6UZOGwlHSnOBV5o07XhQ4gNpBN67FbODvpjyHtd+0Xs6KNvUcGBiDRsdg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "multibase": "^4.0.1", + "multicodec": "^3.0.1", + "multihashes": "^4.0.1", + "uint8arrays": "^3.0.0" + }, + "engines": { + "node": ">=4.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/ipld-dag-pb/node_modules/cids/node_modules/uint8arrays": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", + "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, + "node_modules/ipld-dag-pb/node_modules/multibase": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-4.0.6.tgz", + "integrity": "sha512-x23pDe5+svdLz/k5JPGCVdfn7Q5mZVMBETiC+ORfO+sor9Sgs0smJzAjfTbM5tckeCqnaUuMYoz+k3RXMmJClQ==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "@multiformats/base-x": "^4.0.1" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/ipld-dag-pb/node_modules/multicodec": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-3.2.1.tgz", + "integrity": "sha512-+expTPftro8VAW8kfvcuNNNBgb9gPeNYV9dn+z1kJRWF2vih+/S79f2RVeIwmrJBUJ6NT9IUPWnZDQvegEh5pw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "uint8arrays": "^3.0.0", + "varint": "^6.0.0" + } + }, + "node_modules/ipld-dag-pb/node_modules/multicodec/node_modules/uint8arrays": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", + "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, + "node_modules/ipld-dag-pb/node_modules/multihashes": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-4.0.3.tgz", + "integrity": "sha512-0AhMH7Iu95XjDLxIeuCOOE4t9+vQZsACyKZ9Fxw2pcsRmlX4iCn1mby0hS0bb+nQOVpdQYWPpnyusw4da5RPhA==", + "dependencies": { + "multibase": "^4.0.1", + "uint8arrays": "^3.0.0", + "varint": "^5.0.2" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/ipld-dag-pb/node_modules/multihashes/node_modules/uint8arrays": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", + "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, + "node_modules/ipld-dag-pb/node_modules/multihashes/node_modules/varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" + }, + "node_modules/ipld-dag-pb/node_modules/uint8arrays": { + "version": "2.1.10", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-2.1.10.tgz", + "integrity": "sha512-Q9/hhJa2836nQfEJSZTmr+pg9+cDJS9XEAp7N2Vg5MzL3bK/mkMVfjscRGYruP9jNda6MAdf4QD/y78gSzkp6A==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, "node_modules/is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", @@ -25520,6 +25871,11 @@ "resolved": "https://registry.npmjs.org/it-all/-/it-all-1.0.6.tgz", "integrity": "sha512-3cmCc6Heqe3uWi3CVM/k51fa/XbMFpQVzFoDsV0IZNHSQDyAXl3c4MjHkFX5kF3922OGj7Myv1nSEUgRtcuM1A==" }, + "node_modules/it-batch": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/it-batch/-/it-batch-1.0.9.tgz", + "integrity": "sha512-7Q7HXewMhNFltTsAMdSz6luNhyhkhEtGGbYek/8Xb/GiqYMtwUmopE1ocPSiJKKp3rM4Dt045sNFoUu+KZGNyA==" + }, "node_modules/it-first": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/it-first/-/it-first-1.0.7.tgz", @@ -25544,6 +25900,14 @@ "resolved": "https://registry.npmjs.org/it-map/-/it-map-1.0.6.tgz", "integrity": "sha512-XT4/RM6UHIFG9IobGlQPFQUrlEKkU4eBUFG3qhWhfAdh1JfF2x11ShCrKCdmZ0OiZppPfoLuzcfA4cey6q3UAQ==" }, + "node_modules/it-parallel-batch": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/it-parallel-batch/-/it-parallel-batch-1.0.11.tgz", + "integrity": "sha512-UWsWHv/kqBpMRmyZJzlmZeoAMA0F3SZr08FBdbhtbe+MtoEBgr/ZUAKrnenhXCBrsopy76QjRH2K/V8kNdupbQ==", + "dependencies": { + "it-batch": "^1.0.9" + } + }, "node_modules/it-peekable": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/it-peekable/-/it-peekable-1.0.3.tgz", @@ -30054,6 +30418,55 @@ "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" }, + "node_modules/multihashing-async": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-2.1.4.tgz", + "integrity": "sha512-sB1MiQXPSBTNRVSJc2zM157PXgDtud2nMFUEIvBrsq5Wv96sUclMRK/ecjoP1T/W61UJBqt4tCTwMkUpt2Gbzg==", + "dependencies": { + "blakejs": "^1.1.0", + "err-code": "^3.0.0", + "js-sha3": "^0.8.0", + "multihashes": "^4.0.1", + "murmurhash3js-revisited": "^3.0.0", + "uint8arrays": "^3.0.0" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/multihashing-async/node_modules/multibase": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-4.0.6.tgz", + "integrity": "sha512-x23pDe5+svdLz/k5JPGCVdfn7Q5mZVMBETiC+ORfO+sor9Sgs0smJzAjfTbM5tckeCqnaUuMYoz+k3RXMmJClQ==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "@multiformats/base-x": "^4.0.1" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/multihashing-async/node_modules/multihashes": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-4.0.3.tgz", + "integrity": "sha512-0AhMH7Iu95XjDLxIeuCOOE4t9+vQZsACyKZ9Fxw2pcsRmlX4iCn1mby0hS0bb+nQOVpdQYWPpnyusw4da5RPhA==", + "dependencies": { + "multibase": "^4.0.1", + "uint8arrays": "^3.0.0", + "varint": "^5.0.2" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/multihashing-async/node_modules/varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" + }, "node_modules/multimatch": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz", @@ -30082,6 +30495,14 @@ "node": ">=8" } }, + "node_modules/murmurhash3js-revisited": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz", + "integrity": "sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g==", + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/mustache": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", @@ -33495,6 +33916,32 @@ "node": ">=8" } }, + "node_modules/rabin-wasm": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/rabin-wasm/-/rabin-wasm-0.1.5.tgz", + "integrity": "sha512-uWgQTo7pim1Rnj5TuWcCewRDTf0PEFTSlaUjWP4eY9EbLV9em08v89oCz/WO+wRxpYuO36XEHp4wgYQnAgOHzA==", + "dependencies": { + "@assemblyscript/loader": "^0.9.4", + "bl": "^5.0.0", + "debug": "^4.3.1", + "minimist": "^1.2.5", + "node-fetch": "^2.6.1", + "readable-stream": "^3.6.0" + }, + "bin": { + "rabin-wasm": "cli/bin.js" + } + }, + "node_modules/rabin-wasm/node_modules/bl": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", + "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -36640,6 +37087,11 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/sparse-array": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/sparse-array/-/sparse-array-1.3.2.tgz", + "integrity": "sha512-ZT711fePGn3+kQyLuv1fpd3rNSkNF8vd5Kv2D+qnOANeyKs3fx6bUMGWRPvgTTcYV64QMqZKZwcuaQSP3AZ0tg==" + }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", @@ -36757,6 +37209,12 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/stable": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", + "deprecated": "Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility" + }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -38930,6 +39388,14 @@ "node": ">=4.2.0" } }, + "node_modules/typestub-ipfs-only-hash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typestub-ipfs-only-hash/-/typestub-ipfs-only-hash-4.0.0.tgz", + "integrity": "sha512-HKLePX0XiPiyqoueSfvCLL9SIzvKBXjASaRoR0yk/gUbbK7cqejU6/tjhihwmzBCvWbx5aMQ2LYsYIpMK7Ikpg==", + "dependencies": { + "ipfs-only-hash": "^4.0.0" + } + }, "node_modules/typical": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", @@ -41357,8 +41823,8 @@ "@types/node": "20.3.2", "@types/react": "18.2.14", "@types/react-dom": "18.2.6", - "@usecannon/builder": "^2.9.7", - "@usecannon/cli": "^2.9.8", + "@usecannon/builder": "^2.9.9", + "@usecannon/cli": "^2.9.9", "@vercel/analytics": "^1.1.1", "axios": "^1.4.0", "chakra-react-select": "^4.7.0", @@ -41492,9 +41958,9 @@ "integrity": "sha512-vOBLVQeCQfIcF/2Y7eKFTqrMnizK5lRNQ7ykML/5RuwVXVWxYkgwS7xbt4B6fKCUPgbSL5FSsjHQpaGQP/dQmw==" }, "packages/website/node_modules/@usecannon/builder": { - "version": "2.9.7", - "resolved": "https://registry.npmjs.org/@usecannon/builder/-/builder-2.9.7.tgz", - "integrity": "sha512-7TpKAoHf4V4dSCsOlQ48yxS9K8Y/kUslh7Sui+mdB1WnGTTdnqCFAS3FwYs7v0Mbos6Eli8YIbNOz5snd4aNYA==", + "version": "2.9.9", + "resolved": "https://registry.npmjs.org/@usecannon/builder/-/builder-2.9.9.tgz", + "integrity": "sha512-GklEfK7Sjvqy36qt7R1oZBUjynI+R5skA/LVGM7Wsn3Lcpc3+DjPlUPjhjfGaXwxDB6jQayJyTCYvfqx1EjETA==", "dependencies": { "@synthetixio/router": "^3.3.0", "axios": "^1.2.2", @@ -41505,6 +41971,7 @@ "pako": "^2.1.0", "promise-events": "^0.2.4", "typedoc-plugin-markdown": "^3.15.4", + "typestub-ipfs-only-hash": "^4.0.0", "zod": "^3.21.4" }, "engines": { @@ -41515,13 +41982,13 @@ } }, "packages/website/node_modules/@usecannon/cli": { - "version": "2.9.8", - "resolved": "https://registry.npmjs.org/@usecannon/cli/-/cli-2.9.8.tgz", - "integrity": "sha512-if0Nbk8fjlH+3wHtZeyb1M6ffgt3QnnpvuuM4S2NMiMCT3cryL1PF8lJX5l1emVl/wDWlvHDvcXdIZO7bC7C6w==", + "version": "2.9.9", + "resolved": "https://registry.npmjs.org/@usecannon/cli/-/cli-2.9.9.tgz", + "integrity": "sha512-TI7Zo5s41YesIU8oWm+jRH4YQNPNT2euuTM6/ryUHNF/ctprQLd5E6B51WU1HVuydPaN430Nb//o4QFS3R0fZg==", "dependencies": { "@iarna/toml": "^3.0.0", "@synthetixio/wei": "^2.74.1", - "@usecannon/builder": "^2.9.7", + "@usecannon/builder": "^2.9.9", "chalk": "^4.1.2", "commander": "^9.5.0", "debug": "^4.3.4", diff --git a/packages/website/package.json b/packages/website/package.json index 7e251a248..146c6af93 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -26,8 +26,8 @@ "@types/node": "20.3.2", "@types/react": "18.2.14", "@types/react-dom": "18.2.6", - "@usecannon/builder": "^2.9.7", - "@usecannon/cli": "^2.9.8", + "@usecannon/builder": "^2.9.9", + "@usecannon/cli": "^2.9.9", "@vercel/analytics": "^1.1.1", "axios": "^1.4.0", "chakra-react-select": "^4.7.0", diff --git a/packages/website/src/features/Deploy/PublishUtility.tsx b/packages/website/src/features/Deploy/PublishUtility.tsx index 830335fe7..cd04be16c 100644 --- a/packages/website/src/features/Deploy/PublishUtility.tsx +++ b/packages/website/src/features/Deploy/PublishUtility.tsx @@ -48,6 +48,10 @@ export default function PublishUtility(props: { const publishMutation = useMutation({ mutationFn: async () => { + if (settings.isIpfsGateway) { + throw new Error('You can only read from IPFS gateway.'); + } + console.log( 'publish triggered', wc, @@ -72,7 +76,9 @@ export default function PublishUtility(props: { '' ); - const loader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com'); + const loader = new IPFSBrowserLoader( + settings.ipfsApiUrl || 'https://repo.usecannon.com/' + ); const fromStorage = new CannonStorage( new FallbackRegistry([fakeLocalRegistry, targetRegistry]), @@ -120,8 +126,15 @@ export default function PublishUtility(props: { matching name and version. )} + {settings.isIpfsGateway && ( + You can only read from IPFS gateway. + )} + <> + {settings.isIpfsGateway && ( + You can only read from IPFS gateway. + )} + + )} {buildInfo.buildStatus && ( diff --git a/packages/website/src/features/Settings/SettingsPage.tsx b/packages/website/src/features/Settings/SettingsPage.tsx index c2578ef76..c4b7ae5e8 100644 --- a/packages/website/src/features/Settings/SettingsPage.tsx +++ b/packages/website/src/features/Settings/SettingsPage.tsx @@ -29,7 +29,7 @@ import { CloseIcon } from '@chakra-ui/icons'; import entries from 'just-entries'; import { Store, initialState, useStore } from '@/helpers/store'; import { validatePreset } from '@/helpers/cannon'; -//import { isIpfsUploadEndpoint } from '@/helpers/ipfs'; +import { isIpfsGateway } from '@usecannon/builder/src/ipfs'; type Setting = { title: string; @@ -44,7 +44,7 @@ type Setting = { const SETTINGS: Record< Exclude< keyof Store['settings'], - 'ipfsApiUrl' | 'customProviders' | 'pythUrl' + 'ipfsApiUrl' | 'isIpfsGateway' | 'customProviders' | 'pythUrl' >, Setting > = { @@ -297,7 +297,12 @@ export default function SettingsPage() { value={settings.ipfsApiUrl} type={'text'} name={'ipfsApiUrl'} - onChange={(evt) => setSettings({ ipfsApiUrl: evt.target.value })} + onChange={async (evt) => { + setSettings({ ipfsApiUrl: evt.target.value }); + setSettings({ + isIpfsGateway: await isIpfsGateway(evt.target.value), + }); + }} /> This is an{' '} diff --git a/packages/website/src/helpers/ipfs.ts b/packages/website/src/helpers/ipfs.ts index ae1f70cc6..2b72e0657 100644 --- a/packages/website/src/helpers/ipfs.ts +++ b/packages/website/src/helpers/ipfs.ts @@ -9,15 +9,6 @@ export function parseIpfsHash(url: string) { return url.trim().match(FILE_URL_REGEX)?.groups?.cid || ''; } -export function isIpfsUploadEndpoint(ipfsUrl: string) { - try { - const url = new URL(ipfsUrl); - url.protocol === 'http+ipfs:' || url.protocol === 'https+ipfs:'; - } catch (_) { - return false; - } -} - export class IPFSBrowserLoader extends IPFSLoader { constructor(ipfsUrl: string) { const { url, headers } = createIpfsUrl(ipfsUrl); @@ -25,7 +16,7 @@ export class IPFSBrowserLoader extends IPFSLoader { } } -// Create an ipfs url with compatibility for custom auth and https+ipfs:// protocol +// Create an ipfs url with compatibility for custom auth export function createIpfsUrl(base: string, pathname = '') { const parsedUrl = parseUrl(base); const headers: { [k: string]: string } = {}; diff --git a/packages/website/src/helpers/store.ts b/packages/website/src/helpers/store.ts index 88b6f471c..3baa4edf6 100644 --- a/packages/website/src/helpers/store.ts +++ b/packages/website/src/helpers/store.ts @@ -24,6 +24,7 @@ export interface State { }; settings: { ipfsApiUrl: string; + isIpfsGateway: boolean; stagingUrl: string; publishTags: string; preset: string; @@ -57,6 +58,7 @@ export const initialState = { }, settings: { ipfsApiUrl: 'https://repo.usecannon.com/', + isIpfsGateway: false, stagingUrl: 'https://cannon-safe-app.external.dbeal.dev', publishTags: 'latest', preset: 'main', diff --git a/packages/website/src/hooks/cannon.ts b/packages/website/src/hooks/cannon.ts index f3a89b5ab..6642c30bb 100644 --- a/packages/website/src/hooks/cannon.ts +++ b/packages/website/src/hooks/cannon.ts @@ -79,6 +79,10 @@ export function useCannonBuild(safe: SafeDefinition, def: ChainDefinition, prevD const [buildError, setBuildError] = useState(null); const buildFn = async () => { + if (settings.isIpfsGateway) { + throw new Error('You can only read from IPFS gateway.'); + } + setBuildStatus('Creating fork...'); const fork = await createFork({ url: settings.forkProviderUrl, @@ -94,7 +98,7 @@ export function useCannonBuild(safe: SafeDefinition, def: ChainDefinition, prevD address: settings.registryAddress, }); - const ipfsLoader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com'); + const ipfsLoader = new IPFSBrowserLoader(settings.ipfsApiUrl || 'https://repo.usecannon.com/'); setBuildStatus('Loading deployment data...'); @@ -240,6 +244,10 @@ export function useCannonWriteDeployToIpfs( const writeToIpfsMutation = useMutation({ ...mutationOptions, mutationFn: async () => { + if (settings.isIpfsGateway) { + throw new Error('You can only read from IPFS gateway.'); + } + const def = new ChainDefinition(deployInfo.def); const ctx = await createInitialContext(def, deployInfo.meta, runtime.chainId, deployInfo.options); @@ -254,7 +262,7 @@ export function useCannonWriteDeployToIpfs( fromStorage: runtime, toStorage: new CannonStorage( memoryRegistry, - { ipfs: new IPFSBrowserLoader('https+ipfs://repo.usecannon.com') }, + { ipfs: new IPFSBrowserLoader(settings.ipfsApiUrl || 'https://repo.usecannon.com/') }, 'ipfs' ), packageRef, @@ -320,7 +328,7 @@ export function useCannonPackage(packageRef: string, variant = '') { if (!pkgUrl) return null; try { - const loader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com'); + const loader = new IPFSBrowserLoader(settings.ipfsApiUrl || 'https://repo.usecannon.com/'); const deployInfo: DeploymentInfo = await loader.read(pkgUrl as any); @@ -381,14 +389,14 @@ export function getContractsRecursive( export function useCannonPackageContracts(packageRef: string, variant = '') { const pkg = useCannonPackage(packageRef, variant); const [contracts, setContracts] = useState(null); - // const settings = useStore((s) => s.settings); + const settings = useStore((s) => s.settings); useEffect(() => { const getContracts = async () => { if (pkg.pkg) { const info = pkg.pkg; - const loader = new IPFSBrowserLoader('https+ipfs://repo.usecannon.com'); + const loader = new IPFSBrowserLoader(settings.ipfsApiUrl || 'https://repo.usecannon.com/'); const readRuntime = new ChainBuilderRuntime( { provider: null as any, From fc1b2ce4afc6ca744f7b6bf64e62008e50073813 Mon Sep 17 00:00:00 2001 From: 0xDmitry Date: Thu, 9 Nov 2023 18:46:22 +0300 Subject: [PATCH 6/7] copy isIpfsGateway function from the builder --- .../src/features/Settings/SettingsPage.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/website/src/features/Settings/SettingsPage.tsx b/packages/website/src/features/Settings/SettingsPage.tsx index c4b7ae5e8..034b6ddc6 100644 --- a/packages/website/src/features/Settings/SettingsPage.tsx +++ b/packages/website/src/features/Settings/SettingsPage.tsx @@ -29,7 +29,25 @@ import { CloseIcon } from '@chakra-ui/icons'; import entries from 'just-entries'; import { Store, initialState, useStore } from '@/helpers/store'; import { validatePreset } from '@/helpers/cannon'; -import { isIpfsGateway } from '@usecannon/builder/src/ipfs'; +import axios, { AxiosError } from 'axios'; + +export async function isIpfsGateway(ipfsUrl: string) { + let isGateway = true; + try { + ipfsUrl = ipfsUrl.endsWith('/') ? ipfsUrl : ipfsUrl + '/'; + await axios.post(ipfsUrl + 'api/v0/cat', null, { timeout: 15 * 1000 }); + } catch (err: unknown) { + if ( + err instanceof AxiosError && + err.response?.status === 400 && + err.response?.data.includes('argument "ipfs-path" is required') + ) { + isGateway = false; + } + } + + return isGateway; +} type Setting = { title: string; From 00865e8f5e3b64031608bb74e3a66b1a6457fb2f Mon Sep 17 00:00:00 2001 From: 0xDmitry Date: Thu, 9 Nov 2023 22:18:39 +0300 Subject: [PATCH 7/7] resolve issues --- packages/website/src/features/Deploy/PublishUtility.tsx | 9 +++++++-- .../website/src/features/Deploy/QueueFromGitOpsPage.tsx | 5 ++++- packages/website/src/hooks/cannon.ts | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/website/src/features/Deploy/PublishUtility.tsx b/packages/website/src/features/Deploy/PublishUtility.tsx index cd04be16c..203431a21 100644 --- a/packages/website/src/features/Deploy/PublishUtility.tsx +++ b/packages/website/src/features/Deploy/PublishUtility.tsx @@ -49,7 +49,9 @@ export default function PublishUtility(props: { const publishMutation = useMutation({ mutationFn: async () => { if (settings.isIpfsGateway) { - throw new Error('You can only read from IPFS gateway.'); + throw new Error( + 'You cannot publish on an IPFS gateway, only read operations can be done' + ); } console.log( @@ -127,7 +129,10 @@ export default function PublishUtility(props: { )} {settings.isIpfsGateway && ( - You can only read from IPFS gateway. + + You cannot publish on an IPFS gateway, only read operations can be + done. + )}