From 4e722a51da7a2d1921abcaf23b349307a894d557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jann=20M=C3=BCller?= Date: Thu, 16 Jan 2025 09:09:50 +0100 Subject: [PATCH] Use different blockfrost URL if NEXT_PUBLIC_BLOCKFROST_API_KEY not set --- frontend/package-lock.json | 272 +------------------------- frontend/src/app/utils/walletUtils.ts | 10 +- nix/containers.nix | 2 +- 3 files changed, 11 insertions(+), 273 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 5786676..6158654 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "@cardano-sdk/core": "^0.43.0", "@cardano-sdk/crypto": "^0.1.32", - "@cardano-sdk/key-management": "^0.19.0", "@emotion/cache": "^11.14.0", "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.0", @@ -305,158 +304,6 @@ } } }, - "node_modules/@cardano-sdk/dapp-connector": { - "version": "0.12.48", - "resolved": "https://registry.npmjs.org/@cardano-sdk/dapp-connector/-/dapp-connector-0.12.48.tgz", - "integrity": "sha512-lwFdIcuAGb25AKBRHETP5ntjsdHYaQvUzsgkZa7/P2vfNYj56vCbUFtnZBWFnerRKqCgFiIu4hshRnMCXjWOhQ==", - "license": "Apache-2.0", - "dependencies": { - "@cardano-sdk/core": "~0.42.2", - "@cardano-sdk/crypto": "~0.1.32", - "@cardano-sdk/util": "~0.15.5", - "ts-custom-error": "^3.2.0", - "ts-log": "^2.2.4", - "webextension-polyfill": "^0.8.0" - }, - "engines": { - "node": ">=16.20.2" - } - }, - "node_modules/@cardano-sdk/dapp-connector/node_modules/@cardano-sdk/core": { - "version": "0.42.3", - "resolved": "https://registry.npmjs.org/@cardano-sdk/core/-/core-0.42.3.tgz", - "integrity": "sha512-0Bl6/1U5bX3VJlChQT6UWfEX33Gk9E0HlUnIB8KS8Ft8FBLdZP7MRGMelnIGEDRmfY0bSO0vFcXgxKaokbEX6Q==", - "license": "Apache-2.0", - "dependencies": { - "@biglup/is-cid": "^1.0.3", - "@cardano-ogmios/client": "6.9.0", - "@cardano-ogmios/schema": "6.9.0", - "@cardano-sdk/crypto": "~0.1.32", - "@cardano-sdk/util": "~0.15.5", - "@foxglove/crc": "^0.0.3", - "@scure/base": "^1.1.1", - "fraction.js": "4.0.1", - "ip-address": "^9.0.5", - "lodash": "^4.17.21", - "ts-custom-error": "^3.2.0", - "ts-log": "^2.2.4", - "web-encoding": "^1.1.5" - }, - "engines": { - "node": ">=16.20.2" - }, - "peerDependencies": { - "rxjs": "^7.4.0" - }, - "peerDependenciesMeta": { - "rxjs": { - "optional": true - } - } - }, - "node_modules/@cardano-sdk/key-management": { - "version": "0.19.10", - "resolved": "https://registry.npmjs.org/@cardano-sdk/key-management/-/key-management-0.19.10.tgz", - "integrity": "sha512-Zwtx+c0bKtXMAQ/KfoTOEdp5fiAB0+05fAUOQUiTnJCt+QilqIzl4pr4fUTOlhwbYAD5wVhqIFfTJt0a8ABhIA==", - "license": "Apache-2.0", - "dependencies": { - "@cardano-sdk/core": "~0.28.5", - "@cardano-sdk/crypto": "~0.1.21", - "@cardano-sdk/dapp-connector": "~0.12.12", - "@cardano-sdk/util": "~0.15.0", - "@emurgo/cardano-message-signing-nodejs": "^1.0.1", - "bip39": "^3.0.4", - "chacha": "^2.1.0", - "get-random-values": "^2.0.0", - "lodash": "^4.17.21", - "pbkdf2": "^3.1.2", - "rxjs": "^7.4.0", - "ts-custom-error": "^3.2.0", - "ts-log": "^2.2.4" - }, - "engines": { - "node": ">=16.20.2" - } - }, - "node_modules/@cardano-sdk/key-management/node_modules/@cardano-ogmios/client": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@cardano-ogmios/client/-/client-5.6.0.tgz", - "integrity": "sha512-F0kWQ+TTc3OvSsp9CmxAPqo7fpB9yjrK+Lp52IqGG2YJVwyIynvHwlOW0cZNsRLO+KXwJrSoKdj9rHI0Vix4iw==", - "license": "MPL-2.0", - "dependencies": { - "@cardano-ogmios/schema": "5.6.0", - "@cardanosolutions/json-bigint": "^1.0.0", - "@types/json-bigint": "^1.0.1", - "cross-fetch": "^3.1.4", - "fastq": "^1.11.0", - "isomorphic-ws": "^4.0.1", - "nanoid": "^3.1.31", - "ts-custom-error": "^3.2.0", - "ws": "^7.4.6" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/@cardano-sdk/key-management/node_modules/@cardano-ogmios/schema": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@cardano-ogmios/schema/-/schema-5.6.0.tgz", - "integrity": "sha512-JTlh/gOS5iM4b7CKc3dFRs2UC6fY+PeLiOv6fKxFSOSRMZ59sLgv+oGqjnzyVeZFUt6o683C9zFmBzh60l8KnA==", - "license": "MPL-2.0", - "engines": { - "node": ">=14" - } - }, - "node_modules/@cardano-sdk/key-management/node_modules/@cardano-sdk/core": { - "version": "0.28.5", - "resolved": "https://registry.npmjs.org/@cardano-sdk/core/-/core-0.28.5.tgz", - "integrity": "sha512-bBMW40GAsLgWCYFYgjH0Anpo8TloddrQx7Wu48WeZjKXEKgh0dzLANxWt2LQBxhly21AjunG4zW7plMV/D//LQ==", - "license": "Apache-2.0", - "dependencies": { - "@cardano-ogmios/client": "5.6.0", - "@cardano-ogmios/schema": "5.6.0", - "@cardano-sdk/crypto": "~0.1.21", - "@cardano-sdk/util": "~0.15.0", - "@foxglove/crc": "^0.0.3", - "@scure/base": "^1.1.1", - "fraction.js": "4.0.1", - "ip-address": "^8.1.0", - "lodash": "^4.17.21", - "ts-custom-error": "^3.2.0", - "ts-log": "^2.2.4", - "web-encoding": "^1.1.5" - }, - "engines": { - "node": ">=16.20.2" - }, - "peerDependencies": { - "rxjs": "^7.4.0" - }, - "peerDependenciesMeta": { - "rxjs": { - "optional": true - } - } - }, - "node_modules/@cardano-sdk/key-management/node_modules/ip-address": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-8.1.0.tgz", - "integrity": "sha512-Wz91gZKpNKoXtqvY8ScarKYwhXoK4r/b5QuT+uywe/azv0/nUCo7Bh0IRRI7F9DHR06kJNWtzMGLIbXavngbKA==", - "license": "MIT", - "dependencies": { - "jsbn": "1.1.0", - "sprintf-js": "1.1.2" - }, - "engines": { - "node": ">= 12" - } - }, - "node_modules/@cardano-sdk/key-management/node_modules/sprintf-js": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", - "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", - "license": "BSD-3-Clause" - }, "node_modules/@cardano-sdk/util": { "version": "0.15.5", "resolved": "https://registry.npmjs.org/@cardano-sdk/util/-/util-0.15.5.tgz", @@ -2976,16 +2823,6 @@ "node": "*" } }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "license": "MIT", - "optional": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/bip39": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.1.0.tgz", @@ -3375,56 +3212,6 @@ "cbor-extract": "^2.2.0" } }, - "node_modules/chacha": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/chacha/-/chacha-2.1.0.tgz", - "integrity": "sha512-FhVtqaZOiHlOKUkAWfDlJ+oe/O8iPQbCC0pFXJqphr4YQBCZPXa8Mv3j35+W4eWFWCoTUcW2u5IWDDkknygvVA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.1", - "readable-stream": "^1.0.33" - }, - "optionalDependencies": { - "chacha-native": "^2.0.0" - } - }, - "node_modules/chacha-native": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/chacha-native/-/chacha-native-2.0.3.tgz", - "integrity": "sha512-93h+osfjhR2sMHAaapTLlL/COoBPEZ6upicPBQ4GfUyadoMb8t9/M0PKK8kC+F+DEA/Oy3Kg9w3HzY3J1foP3g==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "dependencies": { - "bindings": "^1.2.1", - "inherits": "^2.0.1", - "nan": "^2.4.0" - } - }, - "node_modules/chacha/node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "license": "MIT" - }, - "node_modules/chacha/node_modules/readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/chacha/node_modules/string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", - "license": "MIT" - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -3551,6 +3338,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true, "license": "MIT" }, "node_modules/cosmiconfig": { @@ -3875,11 +3663,6 @@ "csstype": "^3.0.2" } }, - "node_modules/dom-walk": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", - "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" - }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -4761,13 +4544,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "license": "MIT", - "optional": true - }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -4968,18 +4744,6 @@ "node": ">= 0.4" } }, - "node_modules/get-random-values": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/get-random-values/-/get-random-values-2.1.0.tgz", - "integrity": "sha512-q2yOLpLyA8f9unfv2LV8KVRUFeOIrQVS5cnqpbv6N+ea9j1rmW5dFKj/2Q7CK3juEfDYQgPxGt941VJcmw0jKg==", - "license": "MIT", - "dependencies": { - "global": "^4.4.0" - }, - "engines": { - "node": "14 || 16 || >=18" - } - }, "node_modules/get-symbol-description": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", @@ -5024,16 +4788,6 @@ "node": ">=10.13.0" } }, - "node_modules/global": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", - "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", - "license": "MIT", - "dependencies": { - "min-document": "^2.19.0", - "process": "^0.11.10" - } - }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -6099,14 +5853,6 @@ "node": ">= 0.6" } }, - "node_modules/min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", - "dependencies": { - "dom-walk": "^0.1.0" - } - }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -6162,13 +5908,6 @@ "integrity": "sha512-c8eMDb1WwZcE02WVjHoOmUVk7fnKU/RmUcosHACglrWAuPQsEJv+E8430sXj6jNc1jHw0zrS16aCjQh4BcEb4A==", "license": "MIT" }, - "node_modules/nan": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.0.tgz", - "integrity": "sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==", - "license": "MIT", - "optional": true - }, "node_modules/nanoassert": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-2.0.0.tgz", @@ -9747,6 +9486,7 @@ "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, "license": "MIT", "engines": { "node": ">= 0.6.0" @@ -10119,6 +9859,8 @@ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", "license": "Apache-2.0", + "optional": true, + "peer": true, "dependencies": { "tslib": "^2.1.0" } @@ -11112,12 +10854,6 @@ "@zxing/text-encoding": "0.9.0" } }, - "node_modules/webextension-polyfill": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.8.0.tgz", - "integrity": "sha512-a19+DzlT6Kp9/UI+mF9XQopeZ+n2ussjhxHJ4/pmIGge9ijCDz7Gn93mNnjpZAk95T4Tae8iHZ6sSf869txqiQ==", - "license": "MPL-2.0" - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/frontend/src/app/utils/walletUtils.ts b/frontend/src/app/utils/walletUtils.ts index 2eccac0..4db12f1 100644 --- a/frontend/src/app/utils/walletUtils.ts +++ b/frontend/src/app/utils/walletUtils.ts @@ -8,12 +8,14 @@ export async function makeLucid() { const API_KEY = process.env.NEXT_PUBLIC_BLOCKFROST_API_KEY; if (!API_KEY) { - throw new Error( - "Missing required environment variables for Blockfrost context.", - ); + console.warn("NEXT_PUBLIC_BLOCKFROST_API_KEY environment variable not found. Using blockfrost proxy.") } - const blockfrostURL = "https://cardano-preview.blockfrost.io/api/v0"; + const blockfrostURL = + API_KEY + ? "https://cardano-preview.blockfrost.io/api/v0" + : "/blockfrost-proxy/api/v0"; + const blockfrost = new Blockfrost(blockfrostURL, API_KEY); const lucid = await Lucid(blockfrost, "Preview"); diff --git a/nix/containers.nix b/nix/containers.nix index dfd2268..9290d1a 100644 --- a/nix/containers.nix +++ b/nix/containers.nix @@ -3,7 +3,7 @@ frontendNpm = pkgs.buildNpmPackage rec { name = "frontend"; src = ../frontend; - npmDepsHash = "sha256-wtpNvgzcY0jpp5EgmWp4hXYfVs3xieq3Lb05tlhHlv4="; + npmDepsHash = "sha256-Bwa9mN/07zBXpZj9OoXY4YHluOyTLkvCd9RHuxw0XGo="; npmPackFlags = [ "--ignore-scripts" ]; npmBuildScript = "export"; installPhase = ''