diff --git a/Caddyfile b/Caddyfile index af43f29..e77395c 100644 --- a/Caddyfile +++ b/Caddyfile @@ -5,7 +5,7 @@ {$SERVE_DOMAIN} { reverse_proxy /faucet/* faucet:8765 reverse_proxy /ext/* devnet:9650 - reverse_proxy /* frontend:5173 + reverse_proxy /* frontend:80 tls { on_demand diff --git a/Dockerfile.frontend b/Dockerfile.frontend index 4f44fd6..0382441 100644 --- a/Dockerfile.frontend +++ b/Dockerfile.frontend @@ -5,17 +5,20 @@ WORKDIR /app COPY web_wallet/package.json web_wallet/package-lock.json ./ -RUN --mount=type=cache,target=/root/.npm \ - npm ci --prefer-offline +# RUN --mount=type=cache,target=/root/.npm \ +# npm ci --prefer-offline +# FIXME: +RUN --mount=type=cache,target=/root/.npm npm install COPY web_wallet/ ./web_wallet/ WORKDIR /app/web_wallet -CMD npm run dev -- --host 0.0.0.0 -# RUN npm run build +# CMD npm run dev -- --host 0.0.0.0 +# FIXME: +RUN npm run build-no-check # # Production stage -# FROM nginx:latest +FROM nginx:latest -# COPY --from=build /app/web_wallet/dist /usr/share/nginx/html +COPY --from=build /app/web_wallet/dist /usr/share/nginx/html diff --git a/README.md b/README.md index 3720532..caf1d08 100644 --- a/README.md +++ b/README.md @@ -62,4 +62,5 @@ Note that most functionality depends on the `hypersdk-client` npm package. - Frontend: `npm run dev` in `web_wallet` - Explorer: Use the provided Docker image or set up your own instance - Be aware of potential port conflicts if issues arise. `docker rm -f $(docker ps -a -q)` is your friend. -- To update the explorer image, run `docker compose pull explorer` before starting the stack. \ No newline at end of file +- To update the explorer image, run `docker compose pull explorer` before starting the stack. +- To release on a remote machine, set `export DOCKER_HOST="ssh://username@ip"` and run `docker compose pull && docker compose up -d --build proxy`. \ No newline at end of file diff --git a/compose.yml b/compose.yml index d180b1a..fcf9680 100644 --- a/compose.yml +++ b/compose.yml @@ -6,7 +6,7 @@ services: context: ./ restart: always ports: - - "127.0.0.1:5173:5173" + - "127.0.0.1:5173:80" healthcheck: test: [ "CMD", "curl", "-X", "POST", "http://localhost:5173/"] interval: 10s diff --git a/web_wallet/package-lock.json b/web_wallet/package-lock.json index 417d33a..0d9f367 100644 --- a/web_wallet/package-lock.json +++ b/web_wallet/package-lock.json @@ -13,7 +13,7 @@ "@metamask/sdk": "^0.26.5", "@noble/curves": "^1.4.2", "@scure/base": "^1.1.7", - "hypersdk-client": "file:../../hypersdk-client", + "hypersdk-client": "^0.4.5", "lossless-json": "^4.0.1", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -36,7 +36,8 @@ } }, "../../hypersdk-client": { - "version": "0.4.3", + "version": "0.4.5", + "extraneous": true, "license": "NOT_DECIDED_YET_TODO_FIX", "dependencies": { "@metamask/sdk": "^0.28.2", @@ -3223,6 +3224,55 @@ "node": ">=16.0.0" } }, + "node_modules/@metamask/key-tree": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@metamask/key-tree/-/key-tree-9.1.2.tgz", + "integrity": "sha512-oznbIDlIn7bQsyf/RVhuVX9TsK+QUlTDeksUjBjTPKhGkFHAgn9duBHPE8P30VcCdWlt/oYSqfJVC5WK1/OXKw==", + "license": "MIT", + "dependencies": { + "@metamask/scure-bip39": "^2.1.1", + "@metamask/utils": "^9.0.0", + "@noble/curves": "^1.2.0", + "@noble/hashes": "^1.3.2", + "@scure/base": "^1.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@metamask/key-tree/node_modules/@metamask/utils": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@metamask/utils/-/utils-9.2.1.tgz", + "integrity": "sha512-/u663aUaB6+Xe75i3Mt/1cCljm41HDYIsna5oBrwGvgkY2zH7/9k9Zjd706cxoAbxN7QgLSVAReUiGnuxCuXrQ==", + "license": "ISC", + "dependencies": { + "@ethereumjs/tx": "^4.2.0", + "@metamask/superstruct": "^3.1.0", + "@noble/hashes": "^1.3.1", + "@scure/base": "^1.1.3", + "@types/debug": "^4.1.7", + "debug": "^4.3.4", + "pony-cause": "^2.1.10", + "semver": "^7.5.4", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@metamask/key-tree/node_modules/uuid": { + "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" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@metamask/object-multiplex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@metamask/object-multiplex/-/object-multiplex-2.0.0.tgz", @@ -3316,6 +3366,31 @@ "node": ">=12.0.0" } }, + "node_modules/@metamask/scure-bip39": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@metamask/scure-bip39/-/scure-bip39-2.1.1.tgz", + "integrity": "sha512-1K8aBsAqr6+8jWhguVl06n8e+zjV9sUnys+5PLyVU4mb8LbulQ60F6cq7iQys3xX/yCwKt1+7c7j2nuTEpW+ZQ==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.3" + }, + "engines": { + "node": "^16.20 || ^18.16 || >=20" + } + }, + "node_modules/@metamask/scure-bip39/node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@metamask/sdk": { "version": "0.26.5", "resolved": "https://registry.npmjs.org/@metamask/sdk/-/sdk-0.26.5.tgz", @@ -3401,6 +3476,123 @@ } } }, + "node_modules/@metamask/snaps-sdk": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/@metamask/snaps-sdk/-/snaps-sdk-6.5.1.tgz", + "integrity": "sha512-uQEZZNjKwHZZfu9StwlmvTFle5MqiheO6AQctVhpYGJ1kjJ7Qwa+vJhMd0Ox1QI9C3qaUCqxOCDV0mpd1jPRKg==", + "dependencies": { + "@metamask/key-tree": "^9.1.2", + "@metamask/providers": "^17.1.2", + "@metamask/rpc-errors": "^6.3.1", + "@metamask/superstruct": "^3.1.0", + "@metamask/utils": "^9.2.1" + }, + "engines": { + "node": "^18.16 || >=20" + } + }, + "node_modules/@metamask/snaps-sdk/node_modules/@metamask/json-rpc-engine": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/@metamask/json-rpc-engine/-/json-rpc-engine-9.0.3.tgz", + "integrity": "sha512-efeRXW7KaL0BJcAeudSGhzu6sD3hMpxx9nl3V+Yemm1bsyc66yVUhYPR+XH+Y6ZvB2p05ywgvd1Ev5PBwFzr/g==", + "license": "ISC", + "dependencies": { + "@metamask/rpc-errors": "^6.3.1", + "@metamask/safe-event-emitter": "^3.0.0", + "@metamask/utils": "^9.1.0" + }, + "engines": { + "node": "^18.18 || >=20" + } + }, + "node_modules/@metamask/snaps-sdk/node_modules/@metamask/json-rpc-middleware-stream": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@metamask/json-rpc-middleware-stream/-/json-rpc-middleware-stream-8.0.3.tgz", + "integrity": "sha512-x0rh4EzzLtkpBi7adrAZ2qSAXBwk4knARZdR1j5YOyXYN7r0AeoTiTgmw7pfrUIF62x2si+WAOMm9R1hWNteGw==", + "license": "ISC", + "dependencies": { + "@metamask/json-rpc-engine": "^9.0.3", + "@metamask/safe-event-emitter": "^3.0.0", + "@metamask/utils": "^9.1.0", + "readable-stream": "^3.6.2" + }, + "engines": { + "node": "^18.18 || >=20" + } + }, + "node_modules/@metamask/snaps-sdk/node_modules/@metamask/providers": { + "version": "17.2.0", + "resolved": "https://registry.npmjs.org/@metamask/providers/-/providers-17.2.0.tgz", + "integrity": "sha512-99EIsZo1vIuA7Wc9ruWOd9LGr0GCqEY9lR0/hcjasUZH31MGUe0H/0NdMcz2tRXhsYRvt6M+2lsM4dDG1+atRw==", + "license": "MIT", + "dependencies": { + "@metamask/json-rpc-engine": "^9.0.1", + "@metamask/json-rpc-middleware-stream": "^8.0.1", + "@metamask/object-multiplex": "^2.0.0", + "@metamask/rpc-errors": "^6.3.1", + "@metamask/safe-event-emitter": "^3.1.1", + "@metamask/utils": "^9.0.0", + "detect-browser": "^5.2.0", + "extension-port-stream": "^4.1.0", + "fast-deep-equal": "^3.1.3", + "is-stream": "^2.0.0", + "readable-stream": "^3.6.2" + }, + "engines": { + "node": "^18.18 || >=20" + }, + "peerDependencies": { + "webextension-polyfill": "^0.10.0 || ^0.11.0 || ^0.12.0" + } + }, + "node_modules/@metamask/snaps-sdk/node_modules/@metamask/utils": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@metamask/utils/-/utils-9.2.1.tgz", + "integrity": "sha512-/u663aUaB6+Xe75i3Mt/1cCljm41HDYIsna5oBrwGvgkY2zH7/9k9Zjd706cxoAbxN7QgLSVAReUiGnuxCuXrQ==", + "license": "ISC", + "dependencies": { + "@ethereumjs/tx": "^4.2.0", + "@metamask/superstruct": "^3.1.0", + "@noble/hashes": "^1.3.1", + "@scure/base": "^1.1.3", + "@types/debug": "^4.1.7", + "debug": "^4.3.4", + "pony-cause": "^2.1.10", + "semver": "^7.5.4", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@metamask/snaps-sdk/node_modules/extension-port-stream": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/extension-port-stream/-/extension-port-stream-4.2.0.tgz", + "integrity": "sha512-i5IgiPVMVrHN+Zx8PRjvFsOw8L1A3sboVwPZghDjW9Yp1BMmBDE6mCcTNu4xMXPYduBOwI3CBK7wd72LcOyD6g==", + "license": "ISC", + "dependencies": { + "readable-stream": "^3.6.2 || ^4.4.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "webextension-polyfill": "^0.10.0 || ^0.11.0 || ^0.12.0" + } + }, + "node_modules/@metamask/snaps-sdk/node_modules/uuid": { + "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" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@metamask/superstruct": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@metamask/superstruct/-/superstruct-3.1.0.tgz", @@ -5543,6 +5735,12 @@ "license": "MIT", "peer": true }, + "node_modules/@types/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", + "license": "MIT" + }, "node_modules/@types/yargs": { "version": "17.0.33", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", @@ -6200,8 +6398,7 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "peer": true + ] }, "node_modules/binary-extensions": { "version": "2.3.0", @@ -8241,8 +8438,159 @@ } }, "node_modules/hypersdk-client": { - "resolved": "../../hypersdk-client", - "link": true + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/hypersdk-client/-/hypersdk-client-0.4.5.tgz", + "integrity": "sha512-6Fp/Vw/NReVf0P9d99OAzdBewQLokOSmCJVoLruefBiKzX2pZu5PAnS26MTH5VnWuLPm9NpQH/7hHoHYmnNqlg==", + "license": "NOT_DECIDED_YET_TODO_FIX", + "dependencies": { + "@metamask/sdk": "^0.28.2", + "@metamask/snaps-sdk": "^6.5.0", + "@noble/curves": "^1.6.0", + "@scure/base": "^1.1.8", + "buffer": "^6.0.3", + "lossless-json": "^4.0.1", + "tweetnacl": "^1.0.3" + }, + "engines": { + "node": ">=18.6.0" + } + }, + "node_modules/hypersdk-client/node_modules/@metamask/sdk": { + "version": "0.28.4", + "resolved": "https://registry.npmjs.org/@metamask/sdk/-/sdk-0.28.4.tgz", + "integrity": "sha512-RjWBKPNesjeua2SXIDF9IvYALOSsOQyqHv5DPPK0Voskytk7y+2n/33ocbC1BH5hTLI4hDPH+BuCpXJRWs3/Yg==", + "dependencies": { + "@metamask/onboarding": "^1.0.1", + "@metamask/providers": "16.1.0", + "@metamask/sdk-communication-layer": "0.28.2", + "@metamask/sdk-install-modal-web": "0.28.1", + "@types/dom-screen-wake-lock": "^1.0.0", + "@types/uuid": "^10.0.0", + "bowser": "^2.9.0", + "cross-fetch": "^4.0.0", + "debug": "^4.3.4", + "eciesjs": "^0.3.15", + "eth-rpc-errors": "^4.0.3", + "eventemitter2": "^6.4.7", + "i18next": "23.11.5", + "i18next-browser-languagedetector": "7.1.0", + "obj-multiplex": "^1.0.0", + "pump": "^3.0.0", + "qrcode-terminal-nooctal": "^0.12.1", + "react-native-webview": "^11.26.0", + "readable-stream": "^3.6.2", + "rollup-plugin-visualizer": "^5.9.2", + "socket.io-client": "^4.5.1", + "util": "^0.12.4", + "uuid": "^8.3.2" + }, + "peerDependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, + "node_modules/hypersdk-client/node_modules/@metamask/sdk-communication-layer": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.28.2.tgz", + "integrity": "sha512-kGx6qgP482DecPILnIS38bgxIjNransR3/Jh5Lfg9BXJLaXpq/MEGrjHGnJHAqCyfRymnd5cgexHtXJvQtRWQA==", + "dependencies": { + "bufferutil": "^4.0.8", + "date-fns": "^2.29.3", + "debug": "^4.3.4", + "utf-8-validate": "^5.0.2", + "uuid": "^8.3.2" + }, + "peerDependencies": { + "cross-fetch": "^4.0.0", + "eciesjs": "^0.3.16", + "eventemitter2": "^6.4.7", + "readable-stream": "^3.6.2", + "socket.io-client": "^4.5.1" + } + }, + "node_modules/hypersdk-client/node_modules/@metamask/sdk-install-modal-web": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.28.1.tgz", + "integrity": "sha512-mHkIjWTpYQMPDMtLEEtTVXhae4pEjy7jDBfV7497L0U3VCPQrBl/giZBwA6AgKEX1emYcM2d1WRHWR9N4YhyJA==", + "dependencies": { + "qr-code-styling": "^1.6.0-rc.1" + }, + "peerDependencies": { + "i18next": "23.11.5", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-native": "*" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, + "node_modules/hypersdk-client/node_modules/@noble/curves": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", + "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.5.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hypersdk-client/node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hypersdk-client/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } }, "node_modules/i18next": { "version": "23.11.5", @@ -8291,8 +8639,7 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "peer": true + ] }, "node_modules/ignore": { "version": "5.3.1", @@ -12435,6 +12782,12 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "license": "Unlicense" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/web_wallet/package.json b/web_wallet/package.json index 38d3744..2f395ac 100644 --- a/web_wallet/package.json +++ b/web_wallet/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "vite --host 127.0.0.1", "build": "tsc -b && vite build", + "build-no-check": "tsc --noEmit && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", "test": "vitest" @@ -16,7 +17,7 @@ "@metamask/sdk": "^0.26.5", "@noble/curves": "^1.4.2", "@scure/base": "^1.1.7", - "hypersdk-client": "file:../../hypersdk-client", + "hypersdk-client": "^0.4.5", "lossless-json": "^4.0.1", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/web_wallet/tsconfig.app.json b/web_wallet/tsconfig.app.json index 64f5cd5..2600003 100644 --- a/web_wallet/tsconfig.app.json +++ b/web_wallet/tsconfig.app.json @@ -10,7 +10,6 @@ "DOM.Iterable" ], "module": "ESNext", - "skipLibCheck": true, /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, @@ -23,7 +22,8 @@ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true }, "include": [ "src", diff --git a/web_wallet/tsconfig.json b/web_wallet/tsconfig.json index ea9d0cd..65f670c 100644 --- a/web_wallet/tsconfig.json +++ b/web_wallet/tsconfig.json @@ -8,4 +8,4 @@ "path": "./tsconfig.node.json" } ] -} +} \ No newline at end of file