xonecas.io
4436
Sl

sesame-labs-coding-assignment / commit 6d7fe9a

Adds MetaMask login

- Authentication flow for the client
- Authentication routes for the server
- Adds current authenticated user to the session and page context

Sean2023-01-13 6d7fe9a2a63d85eeefd037c06fba3b63815ac16d parent df8fafb

21 files changed

This diff is too big to show in full. The first 1000 lines are below, and every file is listed with its counts.

api/dist/authentication/index.js+51−2
@@ -1,3 +1,52 @@
11 "use strict";
2-// Integrate with METAMASK
3-// Use passport JS?
2+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4+ return new (P || (P = Promise))(function (resolve, reject) {
5+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9+ });
10+};
11+var __importDefault = (this && this.__importDefault) || function (mod) {
12+ return (mod && mod.__esModule) ? mod : { "default": mod };
13+};
14+Object.defineProperty(exports, "__esModule", { value: true });
15+const koa_router_1 = __importDefault(require("koa-router"));
16+const router = new koa_router_1.default();
17+router.post("/authenticate", (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
18+ const data = ctx.request.body;
19+ let user = null;
20+ // Check for an existing user:
21+ user = yield ctx.prisma.user.findUnique({
22+ where: { wallet_address: data.wallet_address },
23+ });
24+ // New user:
25+ if (!user) {
26+ user = yield ctx.prisma.user.create({
27+ data: { wallet_address: data.wallet_address },
28+ });
29+ ctx.status = 201;
30+ }
31+ else {
32+ ctx.status = 200;
33+ }
34+ if (ctx.session) {
35+ ctx.session.user = user;
36+ }
37+ yield next();
38+}));
39+router.post("/deauthenticate", (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
40+ ctx.session = null;
41+ ctx.status = 200;
42+ yield next();
43+}));
44+router.get("/authenticated_user", (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
45+ var _a;
46+ if ((_a = ctx.session) === null || _a === void 0 ? void 0 : _a.user) {
47+ ctx.body = ctx.session.user;
48+ ctx.status = 200;
49+ }
50+ yield next();
51+}));
52+exports.default = router;
api/dist/index.js+13−9
@@ -12,19 +12,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1212 return (mod && mod.__esModule) ? mod : { "default": mod };
1313 };
1414 Object.defineProperty(exports, "__esModule", { value: true });
15-const koa_1 = __importDefault(require("koa"));
16-const koa_logger_1 = __importDefault(require("koa-logger"));
17-const koa_json_1 = __importDefault(require("koa-json"));
18-const koa_bodyparser_1 = __importDefault(require("koa-bodyparser"));
1915 const cors_1 = __importDefault(require("@koa/cors"));
16+const client_1 = require("@prisma/client");
2017 const dotenv_1 = __importDefault(require("dotenv"));
18+const koa_1 = __importDefault(require("koa"));
19+const koa_bodyparser_1 = __importDefault(require("koa-bodyparser"));
20+const koa_json_1 = __importDefault(require("koa-json"));
21+const koa_session_1 = __importDefault(require("koa-session"));
22+const koa_logger_1 = __importDefault(require("koa-logger"));
2123 const routes_1 = __importDefault(require("./routes"));
22-const client_1 = require("@prisma/client");
2324 const prisma = new client_1.PrismaClient();
2425 function main() {
2526 return __awaiter(this, void 0, void 0, function* () {
27+ // Load .env:
2628 dotenv_1.default.config();
2729 const app = new koa_1.default();
30+ app.keys = ["A very good secret!"];
2831 // Expose prisma client instance to context:
2932 app.context.prisma = prisma;
3033 // Mount middleware:
@@ -32,13 +35,14 @@ function main() {
3235 .use((0, koa_logger_1.default)())
3336 .use((0, koa_json_1.default)())
3437 .use((0, koa_bodyparser_1.default)())
35- .use((0, cors_1.default)())
38+ .use((0, cors_1.default)({ credentials: true }))
39+ .use((0, koa_session_1.default)({ secure: false, signed: false, sameSite: "none" }, app))
3640 .use(routes_1.default.routes())
3741 .use(routes_1.default.allowedMethods());
38- // Listen on configured port:
39- const port = process.env.PORT || 8000;
42+ // Start the server:
43+ const port = process.env.PORT;
4044 app.listen(port, () => {
41- console.log(`Server listening on ${port} on environment "${process.env.ENVIRONMENT}"`);
45+ console.log(`Server listening on port ${port} and on environment "${process.env.ENVIRONMENT}"`);
4246 });
4347 });
4448 }
api/dist/routes.js+5−1
@@ -13,11 +13,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1313 };
1414 Object.defineProperty(exports, "__esModule", { value: true });
1515 const koa_router_1 = __importDefault(require("koa-router"));
16+const authentication_1 = __importDefault(require("./authentication"));
1617 const router = new koa_router_1.default();
1718 router.all("/health-check", (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
1819 // Check if server is healthy and has connection to db:
19- ctx.body = `Health check OK. \n${yield ctx.prisma.user.count()} records found in the db.`;
20+ ctx.body = `Server is healthy. \n${yield ctx.prisma.user.count()} records found in the db.`;
2021 ctx.status = 200;
2122 yield next();
2223 }));
24+router
25+ .use(authentication_1.default.routes())
26+ .use(authentication_1.default.allowedMethods());
2327 exports.default = router;
api/package-lock.json+138−73
@@ -11,24 +11,24 @@
1111 "dependencies": {
1212 "@koa/cors": "^4.0.0",
1313 "@prisma/client": "^4.8.1",
14- "@types/passport": "^1.0.11",
15- "koa": "^2.14.1",
16- "koa-bodyparser": "^4.3.0",
14+ "@types/koa-session": "^5.10.6",
15+ "dotenv": "^16.0.3",
16+ "koa": "2.14.1",
17+ "koa-bodyparser": "4.3.0",
1718 "koa-json": "^2.0.2",
1819 "koa-logger": "^3.2.1",
1920 "koa-router": "^12.0.0",
20- "passport": "^0.6.0"
21+ "koa-session": "^6.3.1"
2122 },
2223 "devDependencies": {
2324 "@types/dotenv": "^8.2.0",
24- "@types/koa": "^2.13.5",
25+ "@types/koa": "2.13.4",
2526 "@types/koa__cors": "^3.3.0",
26- "@types/koa-bodyparser": "^4.3.10",
27+ "@types/koa-bodyparser": "4.3.0",
2728 "@types/koa-json": "^2.0.20",
2829 "@types/koa-logger": "^3.1.2",
2930 "@types/koa-router": "^7.4.4",
3031 "@types/node": "^18.11.18",
31- "dotenv": "^16.0.3",
3232 "prisma": "^4.8.1",
3333 "typescript": "^4.9.4"
3434 }
@@ -80,7 +80,6 @@
8080 "version": "1.3.5",
8181 "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz",
8282 "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==",
83- "dev": true,
8483 "dependencies": {
8584 "@types/node": "*"
8685 }
@@ -105,14 +104,12 @@
105104 "node_modules/@types/content-disposition": {
106105 "version": "0.5.5",
107106 "resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.5.tgz",
108- "integrity": "sha512-v6LCdKfK6BwcqMo+wYW05rLS12S0ZO0Fl4w1h4aaZMD7bqT3gVUns6FvLJKGZHQmYn3SX55JWGpziwJRwVgutA==",
109- "dev": true
107+ "integrity": "sha512-v6LCdKfK6BwcqMo+wYW05rLS12S0ZO0Fl4w1h4aaZMD7bqT3gVUns6FvLJKGZHQmYn3SX55JWGpziwJRwVgutA=="
110108 },
111109 "node_modules/@types/cookies": {
112110 "version": "0.7.7",
113111 "resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.7.tgz",
114112 "integrity": "sha512-h7BcvPUogWbKCzBR2lY4oqaZbO3jXZksexYJVFvkrFeLgbZjQkU4x8pRq6eg2MHXQhY0McQdqmmsxRWlVAHooA==",
115- "dev": true,
116113 "dependencies": {
117114 "@types/connect": "*",
118115 "@types/express": "*",
@@ -154,26 +151,22 @@
154151 "node_modules/@types/http-assert": {
155152 "version": "1.5.3",
156153 "resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz",
157- "integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==",
158- "dev": true
154+ "integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA=="
159155 },
160156 "node_modules/@types/http-errors": {
161157 "version": "2.0.1",
162158 "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.1.tgz",
163- "integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ==",
164- "dev": true
159+ "integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ=="
165160 },
166161 "node_modules/@types/keygrip": {
167162 "version": "1.0.2",
168163 "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz",
169- "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==",
170- "dev": true
164+ "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw=="
171165 },
172166 "node_modules/@types/koa": {
173- "version": "2.13.5",
174- "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.5.tgz",
175- "integrity": "sha512-HSUOdzKz3by4fnqagwthW/1w/yJspTgppyyalPVbgZf8jQWvdIXcVW5h2DGtw4zYntOaeRGx49r1hxoPWrD4aA==",
176- "dev": true,
167+ "version": "2.13.4",
168+ "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.4.tgz",
169+ "integrity": "sha512-dfHYMfU+z/vKtQB7NUrthdAEiSvnLebvBjwHtfFmpZmB7em2N3WVQdHgnFq+xvyVgxW5jKDmjWfLD3lw4g4uTw==",
177170 "dependencies": {
178171 "@types/accepts": "*",
179172 "@types/content-disposition": "*",
@@ -195,9 +188,9 @@
195188 }
196189 },
197190 "node_modules/@types/koa-bodyparser": {
198- "version": "4.3.10",
199- "resolved": "https://registry.npmjs.org/@types/koa-bodyparser/-/koa-bodyparser-4.3.10.tgz",
200- "integrity": "sha512-6ae05pjhmrmGhUR8GYD5qr5p9LTEMEGfGXCsK8VaSL+totwigm8+H/7MHW7K4854CMeuwRAubT8qcc/EagaeIA==",
191+ "version": "4.3.0",
192+ "resolved": "https://registry.npmjs.org/@types/koa-bodyparser/-/koa-bodyparser-4.3.0.tgz",
193+ "integrity": "sha512-aB/vwwq4G9FAtKzqZ2p8UHTscXxZvICFKVjuckqxCtkX1Ro7F5KHkTCUqTRZFBgDoEkmeca+bFLI1bIsdPPZTA==",
201194 "dev": true,
202195 "dependencies": {
203196 "@types/koa": "*"
@@ -207,7 +200,6 @@
207200 "version": "3.2.5",
208201 "resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz",
209202 "integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==",
210- "dev": true,
211203 "dependencies": {
212204 "@types/koa": "*"
213205 }
@@ -239,6 +231,15 @@
239231 "@types/koa": "*"
240232 }
241233 },
234+ "node_modules/@types/koa-session": {
235+ "version": "5.10.6",
236+ "resolved": "https://registry.npmjs.org/@types/koa-session/-/koa-session-5.10.6.tgz",
237+ "integrity": "sha512-p4rgkeRmiJu8XGC3eH2duRCNgnLUl6sjadEXH/AsieH/9fqYfXSZoZNC9CAe+FQK+QmM76hVyvuJ5Jrl5xxNeA==",
238+ "dependencies": {
239+ "@types/cookies": "*",
240+ "@types/koa": "*"
241+ }
242+ },
242243 "node_modules/@types/mime": {
243244 "version": "3.0.1",
244245 "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz",
@@ -249,14 +250,6 @@
249250 "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz",
250251 "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA=="
251252 },
252- "node_modules/@types/passport": {
253- "version": "1.0.11",
254- "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.11.tgz",
255- "integrity": "sha512-pz1cx9ptZvozyGKKKIPLcVDVHwae4hrH5d6g5J+DkMRRjR3cVETb4jMabhXAUbg3Ov7T22nFHEgaK2jj+5CBpw==",
256- "dependencies": {
257- "@types/express": "*"
258- }
259- },
260253 "node_modules/@types/qs": {
261254 "version": "6.9.7",
262255 "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
@@ -299,6 +292,48 @@
299292 "node": ">=4"
300293 }
301294 },
295+ "node_modules/base64-js": {
296+ "version": "1.5.1",
297+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
298+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
299+ "funding": [
300+ {
301+ "type": "github",
302+ "url": "https://github.com/sponsors/feross"
303+ },
304+ {
305+ "type": "patreon",
306+ "url": "https://www.patreon.com/feross"
307+ },
308+ {
309+ "type": "consulting",
310+ "url": "https://feross.org/support"
311+ }
312+ ]
313+ },
314+ "node_modules/buffer": {
315+ "version": "5.7.1",
316+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
317+ "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
318+ "funding": [
319+ {
320+ "type": "github",
321+ "url": "https://github.com/sponsors/feross"
322+ },
323+ {
324+ "type": "patreon",
325+ "url": "https://www.patreon.com/feross"
326+ },
327+ {
328+ "type": "consulting",
329+ "url": "https://feross.org/support"
330+ }
331+ ],
332+ "dependencies": {
333+ "base64-js": "^1.3.1",
334+ "ieee754": "^1.1.13"
335+ }
336+ },
302337 "node_modules/bytes": {
303338 "version": "3.1.2",
304339 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
@@ -418,6 +453,14 @@
418453 "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
419454 "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
420455 },
456+ "node_modules/crc": {
457+ "version": "3.8.0",
458+ "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz",
459+ "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==",
460+ "dependencies": {
461+ "buffer": "^5.1.0"
462+ }
463+ },
421464 "node_modules/debug": {
422465 "version": "4.3.4",
423466 "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -465,7 +508,6 @@
465508 "version": "16.0.3",
466509 "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
467510 "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
468- "dev": true,
469511 "engines": {
470512 "node": ">=12"
471513 }
@@ -617,6 +659,25 @@
617659 "node": ">=0.10.0"
618660 }
619661 },
662+ "node_modules/ieee754": {
663+ "version": "1.2.1",
664+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
665+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
666+ "funding": [
667+ {
668+ "type": "github",
669+ "url": "https://github.com/sponsors/feross"
670+ },
671+ {
672+ "type": "patreon",
673+ "url": "https://www.patreon.com/feross"
674+ },
675+ {
676+ "type": "consulting",
677+ "url": "https://feross.org/support"
678+ }
679+ ]
680+ },
620681 "node_modules/inflation": {
621682 "version": "2.0.0",
622683 "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz",
@@ -630,6 +691,11 @@
630691 "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
631692 "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
632693 },
694+ "node_modules/is-class-hotfix": {
695+ "version": "0.0.6",
696+ "resolved": "https://registry.npmjs.org/is-class-hotfix/-/is-class-hotfix-0.0.6.tgz",
697+ "integrity": "sha512-0n+pzCC6ICtVr/WXnN2f03TK/3BfXY7me4cjCAqT8TYXEl0+JBRoqBo94JJHXcyDSLUeWbNX8Fvy5g5RJdAstQ=="
698+ },
633699 "node_modules/is-generator-function": {
634700 "version": "1.0.10",
635701 "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz",
@@ -644,11 +710,26 @@
644710 "url": "https://github.com/sponsors/ljharb"
645711 }
646712 },
713+ "node_modules/is-type-of": {
714+ "version": "1.2.1",
715+ "resolved": "https://registry.npmjs.org/is-type-of/-/is-type-of-1.2.1.tgz",
716+ "integrity": "sha512-uK0kyX9LZYhSDS7H2sVJQJop1UnWPWmo5RvR3q2kFH6AUHYs7sOrVg0b4nyBHw29kRRNFofYN/JbHZDlHiItTA==",
717+ "dependencies": {
718+ "core-util-is": "^1.0.2",
719+ "is-class-hotfix": "~0.0.6",
720+ "isstream": "~0.1.2"
721+ }
722+ },
647723 "node_modules/isarray": {
648724 "version": "1.0.0",
649725 "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
650726 "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
651727 },
728+ "node_modules/isstream": {
729+ "version": "0.1.2",
730+ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
731+ "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g=="
732+ },
652733 "node_modules/json-stringify-safe": {
653734 "version": "5.0.1",
654735 "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
@@ -792,6 +873,20 @@
792873 "node": ">= 0.8"
793874 }
794875 },
876+ "node_modules/koa-session": {
877+ "version": "6.3.1",
878+ "resolved": "https://registry.npmjs.org/koa-session/-/koa-session-6.3.1.tgz",
879+ "integrity": "sha512-Y6206QSkDgtIgjTT7ndmIgZjWrOcY3jflfsDjwvxLfYwSiwKGVAi3l1ExhI2KjkEO1uhKyPxcEWhEDn8HaoRUg==",
880+ "dependencies": {
881+ "crc": "^3.8.0",
882+ "debug": "^4.3.3",
883+ "is-type-of": "^1.2.1",
884+ "uuid": "^8.3.2"
885+ },
886+ "engines": {
887+ "node": ">=8.0.0"
888+ }
889+ },
795890 "node_modules/media-typer": {
796891 "version": "0.3.0",
797892 "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@@ -841,9 +936,9 @@
841936 }
842937 },
843938 "node_modules/object-inspect": {
844- "version": "1.12.2",
845- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
846- "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==",
939+ "version": "1.12.3",
940+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
941+ "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
847942 "funding": {
848943 "url": "https://github.com/sponsors/ljharb"
849944 }
@@ -872,31 +967,6 @@
872967 "node": ">= 0.8"
873968 }
874969 },
875- "node_modules/passport": {
876- "version": "0.6.0",
877- "resolved": "https://registry.npmjs.org/passport/-/passport-0.6.0.tgz",
878- "integrity": "sha512-0fe+p3ZnrWRW74fe8+SvCyf4a3Pb2/h7gFkQ8yTJpAO50gDzlfjZUZTO1k5Eg9kUct22OxHLqDZoKUWRHOh9ug==",
879- "dependencies": {
880- "passport-strategy": "1.x.x",
881- "pause": "0.0.1",
882- "utils-merge": "^1.0.1"
883- },
884- "engines": {
885- "node": ">= 0.4.0"
886- },
887- "funding": {
888- "type": "github",
889- "url": "https://github.com/sponsors/jaredhanson"
890- }
891- },
892- "node_modules/passport-strategy": {
893- "version": "1.0.0",
894- "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz",
895- "integrity": "sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA==",
896- "engines": {
897- "node": ">= 0.4.0"
898- }
899- },
900970 "node_modules/passthrough-counter": {
901971 "version": "1.0.0",
902972 "resolved": "https://registry.npmjs.org/passthrough-counter/-/passthrough-counter-1.0.0.tgz",
@@ -907,11 +977,6 @@
907977 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz",
908978 "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw=="
909979 },
910- "node_modules/pause": {
911- "version": "0.0.1",
912- "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
913- "integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg=="
914- },
915980 "node_modules/prisma": {
916981 "version": "4.8.1",
917982 "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.8.1.tgz",
@@ -1141,12 +1206,12 @@
11411206 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
11421207 "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
11431208 },
1144- "node_modules/utils-merge": {
1145- "version": "1.0.1",
1146- "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
1147- "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
1148- "engines": {
1149- "node": ">= 0.4.0"
1209+ "node_modules/uuid": {
1210+ "version": "8.3.2",
1211+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
1212+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
1213+ "bin": {
1214+ "uuid": "dist/bin/uuid"
11501215 }
11511216 },
11521217 "node_modules/vary": {
api/package.json+6−4
@@ -11,12 +11,12 @@
1111 "license": "ISC",
1212 "devDependencies": {
1313 "@types/dotenv": "^8.2.0",
14+ "@types/koa": "2.13.4",
1415 "@types/koa__cors": "^3.3.0",
15- "@types/koa-bodyparser": "^4.3.10",
16+ "@types/koa-bodyparser": "4.3.0",
1617 "@types/koa-json": "^2.0.20",
1718 "@types/koa-logger": "^3.1.2",
1819 "@types/koa-router": "^7.4.4",
19- "@types/koa": "^2.13.5",
2020 "@types/node": "^18.11.18",
2121 "prisma": "^4.8.1",
2222 "typescript": "^4.9.4"
@@ -24,11 +24,13 @@
2424 "dependencies": {
2525 "@koa/cors": "^4.0.0",
2626 "@prisma/client": "^4.8.1",
27+ "@types/koa-session": "^5.10.6",
2728 "dotenv": "^16.0.3",
28- "koa-bodyparser": "^4.3.0",
29+ "koa": "2.14.1",
30+ "koa-bodyparser": "4.3.0",
2931 "koa-json": "^2.0.2",
3032 "koa-logger": "^3.2.1",
3133 "koa-router": "^12.0.0",
32- "koa": "^2.14.1"
34+ "koa-session": "^6.3.1"
3335 }
3436 }
api/prisma/dev.db+0−0
Binary file, not shown.
api/prisma/dev.db-journal+0−0
Binary file, not shown.
api/prisma/migrations/20230113181803_unique_wallet_address/migration.sql+8−0
@@ -0,0 +1,8 @@
1+/*
2+ Warnings:
3+
4+ - A unique constraint covering the columns `[wallet_address]` on the table `User` will be added. If there are existing duplicate values, this will fail.
5+
6+*/
7+-- CreateIndex
8+CREATE UNIQUE INDEX "User_wallet_address_key" ON "User"("wallet_address");
api/prisma/migrations/20230113193546_remove_name_field/migration.sql+18−0
@@ -0,0 +1,18 @@
1+/*
2+ Warnings:
3+
4+ - You are about to drop the column `name` on the `User` table. All the data in the column will be lost.
5+
6+*/
7+-- RedefineTables
8+PRAGMA foreign_keys=OFF;
9+CREATE TABLE "new_User" (
10+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
11+ "wallet_address" TEXT
12+);
13+INSERT INTO "new_User" ("id", "wallet_address") SELECT "id", "wallet_address" FROM "User";
14+DROP TABLE "User";
15+ALTER TABLE "new_User" RENAME TO "User";
16+CREATE UNIQUE INDEX "User_wallet_address_key" ON "User"("wallet_address");
17+PRAGMA foreign_key_check;
18+PRAGMA foreign_keys=ON;
api/prisma/schema.prisma+1−2
@@ -13,6 +13,5 @@ datasource db {
1313 // @TODO: Define the user model once the login is setup so we know what to store.
1414 model User {
1515 id Int @id @default(autoincrement())
16- name String?
17- wallet_address String?
16+ wallet_address String? @unique
1817 }
api/src/authentication/index.ts+56−2
@@ -1,2 +1,56 @@
1-// Integrate with METAMASK
2-// Use passport JS?
1+import Router from "koa-router";
2+import Koa from "koa";
3+
4+const router = new Router();
5+
6+router.post(
7+ "/authenticate",
8+ async (ctx: Koa.ParameterizedContext, next: Koa.Next) => {
9+ const data = ctx.request.body;
10+ let user = null;
11+
12+ // Check for an existing user:
13+ user = await ctx.prisma.user.findUnique({
14+ where: { wallet_address: data.wallet_address },
15+ });
16+
17+ // New user:
18+ if (!user) {
19+ user = await ctx.prisma.user.create({
20+ data: { wallet_address: data.wallet_address },
21+ });
22+ ctx.status = 201;
23+ } else {
24+ ctx.status = 200;
25+ }
26+
27+ if (ctx.session) {
28+ ctx.session.user = user;
29+ }
30+
31+ await next();
32+ }
33+);
34+
35+router.post(
36+ "/deauthenticate",
37+ async (ctx: Koa.ParameterizedContext, next: Koa.Next) => {
38+ ctx.session = null;
39+ ctx.status = 200;
40+ await next();
41+ }
42+);
43+
44+router.get(
45+ "/authenticated_user",
46+ async (ctx: Koa.ParameterizedContext, next: Koa.Next) => {
47+ if (ctx.session?.user) {
48+ ctx.body = ctx.session.user;
49+ ctx.status = 200;
50+ }
51+
52+ await next();
53+ }
54+);
55+
56+export default router;
api/src/index.ts+5−1
@@ -4,6 +4,7 @@ import dotenv from "dotenv";
44 import Koa from "koa";
55 import bodyParser from "koa-bodyparser";
66 import json from "koa-json";
7+import session from "koa-session";
78 import logger from "koa-logger";
89 import router from "./routes";
910
@@ -14,6 +15,8 @@ async function main() {
1415 dotenv.config();
1516
1617 const app = new Koa();
18+ app.keys = ["A very good secret!"];
19+
1720 // Expose prisma client instance to context:
1821 app.context.prisma = prisma;
1922
@@ -22,7 +25,8 @@ async function main() {
2225 .use(logger())
2326 .use(json())
2427 .use(bodyParser())
25- .use(cors())
28+ .use(cors({ credentials: true }))
29+ .use(session({ secure: false, signed: false, sameSite: "none" }, app))
2630 .use(router.routes())
2731 .use(router.allowedMethods());
2832
api/src/routes.ts+6−1
@@ -1,5 +1,6 @@
11 import Koa from "koa";
22 import Router from "koa-router";
3+import authenticationRouter from "./authentication";
34
45 const router = new Router();
56
@@ -7,11 +8,15 @@ router.all(
78 "/health-check",
89 async (ctx: Koa.ParameterizedContext, next: Koa.Next) => {
910 // Check if server is healthy and has connection to db:
10- ctx.body = `Health check OK. \n${await ctx.prisma.user.count()} records found in the db.`;
11+ ctx.body = `Server is healthy. \n${await ctx.prisma.user.count()} records found in the db.`;
1112 ctx.status = 200;
1213
1314 await next();
1415 }
1516 );
1617
18+router
19+ .use(authenticationRouter.routes())
20+ .use(authenticationRouter.allowedMethods());
21+
1722 export default router;
ui/package-lock.json+2979−189
@@ -8,6 +8,7 @@
88 "name": "ui",
99 "version": "0.1.0",
1010 "dependencies": {
11+ "@metamask/detect-provider": "1.2.0",
1112 "@testing-library/jest-dom": "^5.16.5",
1213 "@testing-library/react": "^13.4.0",
1314 "@testing-library/user-event": "^13.5.0",
@@ -17,12 +18,15 @@
1718 "@types/react-dom": "^18.0.10",
1819 "@types/react-router-dom": "^5.3.3",
1920 "@types/styled-components": "^5.1.26",
21+ "@types/web3": "^1.2.2",
22+ "axios": "^1.2.2",
2023 "react": "^18.2.0",
2124 "react-dom": "^18.2.0",
2225 "react-router-dom": "^6.6.2",
2326 "react-scripts": "5.0.1",
2427 "styled-components": "^5.3.6",
25- "typescript": "^4.9.4"
28+ "typescript": "^4.9.4",
29+ "web3": "^1.8.1"
2630 }
2731 },
2832 "node_modules/@adobe/css-tools": {
@@ -2193,6 +2197,21 @@
21932197 "url": "https://opencollective.com/eslint"
21942198 }
21952199 },
2200+ "node_modules/@eslint/eslintrc/node_modules/ajv": {
2201+ "version": "6.12.6",
2202+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
2203+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
2204+ "dependencies": {
2205+ "fast-deep-equal": "^3.1.1",
2206+ "fast-json-stable-stringify": "^2.0.0",
2207+ "json-schema-traverse": "^0.4.1",
2208+ "uri-js": "^4.2.2"
2209+ },
2210+ "funding": {
2211+ "type": "github",
2212+ "url": "https://github.com/sponsors/epoberezkin"
2213+ }
2214+ },
21962215 "node_modules/@eslint/eslintrc/node_modules/argparse": {
21972216 "version": "2.0.1",
21982217 "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@@ -2223,6 +2242,413 @@
22232242 "js-yaml": "bin/js-yaml.js"
22242243 }
22252244 },
2245+ "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {
2246+ "version": "0.4.1",
2247+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
2248+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
2249+ },
2250+ "node_modules/@ethereumjs/common": {
2251+ "version": "2.5.0",
2252+ "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.5.0.tgz",
2253+ "integrity": "sha512-DEHjW6e38o+JmB/NO3GZBpW4lpaiBpkFgXF6jLcJ6gETBYpEyaA5nTimsWBUJR3Vmtm/didUEbNjajskugZORg==",
2254+ "dependencies": {
2255+ "crc-32": "^1.2.0",
2256+ "ethereumjs-util": "^7.1.1"
2257+ }
2258+ },
2259+ "node_modules/@ethereumjs/tx": {
2260+ "version": "3.3.2",
2261+ "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.3.2.tgz",
2262+ "integrity": "sha512-6AaJhwg4ucmwTvw/1qLaZUX5miWrwZ4nLOUsKyb/HtzS3BMw/CasKhdi1ims9mBKeK9sOJCH4qGKOBGyJCeeog==",
2263+ "dependencies": {
2264+ "@ethereumjs/common": "^2.5.0",
2265+ "ethereumjs-util": "^7.1.2"
2266+ }
2267+ },
2268+ "node_modules/@ethersproject/abi": {
2269+ "version": "5.7.0",
2270+ "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz",
2271+ "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==",
2272+ "funding": [
2273+ {
2274+ "type": "individual",
2275+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2276+ },
2277+ {
2278+ "type": "individual",
2279+ "url": "https://www.buymeacoffee.com/ricmoo"
2280+ }
2281+ ],
2282+ "dependencies": {
2283+ "@ethersproject/address": "^5.7.0",
2284+ "@ethersproject/bignumber": "^5.7.0",
2285+ "@ethersproject/bytes": "^5.7.0",
2286+ "@ethersproject/constants": "^5.7.0",
2287+ "@ethersproject/hash": "^5.7.0",
2288+ "@ethersproject/keccak256": "^5.7.0",
2289+ "@ethersproject/logger": "^5.7.0",
2290+ "@ethersproject/properties": "^5.7.0",
2291+ "@ethersproject/strings": "^5.7.0"
2292+ }
2293+ },
2294+ "node_modules/@ethersproject/abstract-provider": {
2295+ "version": "5.7.0",
2296+ "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz",
2297+ "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==",
2298+ "funding": [
2299+ {
2300+ "type": "individual",
2301+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2302+ },
2303+ {
2304+ "type": "individual",
2305+ "url": "https://www.buymeacoffee.com/ricmoo"
2306+ }
2307+ ],
2308+ "dependencies": {
2309+ "@ethersproject/bignumber": "^5.7.0",
2310+ "@ethersproject/bytes": "^5.7.0",
2311+ "@ethersproject/logger": "^5.7.0",
2312+ "@ethersproject/networks": "^5.7.0",
2313+ "@ethersproject/properties": "^5.7.0",
2314+ "@ethersproject/transactions": "^5.7.0",
2315+ "@ethersproject/web": "^5.7.0"
2316+ }
2317+ },
2318+ "node_modules/@ethersproject/abstract-signer": {
2319+ "version": "5.7.0",
2320+ "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz",
2321+ "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==",
2322+ "funding": [
2323+ {
2324+ "type": "individual",
2325+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2326+ },
2327+ {
2328+ "type": "individual",
2329+ "url": "https://www.buymeacoffee.com/ricmoo"
2330+ }
2331+ ],
2332+ "dependencies": {
2333+ "@ethersproject/abstract-provider": "^5.7.0",
2334+ "@ethersproject/bignumber": "^5.7.0",
2335+ "@ethersproject/bytes": "^5.7.0",
2336+ "@ethersproject/logger": "^5.7.0",
2337+ "@ethersproject/properties": "^5.7.0"
2338+ }
2339+ },
2340+ "node_modules/@ethersproject/address": {
2341+ "version": "5.7.0",
2342+ "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz",
2343+ "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==",
2344+ "funding": [
2345+ {
2346+ "type": "individual",
2347+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2348+ },
2349+ {
2350+ "type": "individual",
2351+ "url": "https://www.buymeacoffee.com/ricmoo"
2352+ }
2353+ ],
2354+ "dependencies": {
2355+ "@ethersproject/bignumber": "^5.7.0",
2356+ "@ethersproject/bytes": "^5.7.0",
2357+ "@ethersproject/keccak256": "^5.7.0",
2358+ "@ethersproject/logger": "^5.7.0",
2359+ "@ethersproject/rlp": "^5.7.0"
2360+ }
2361+ },
2362+ "node_modules/@ethersproject/base64": {
2363+ "version": "5.7.0",
2364+ "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz",
2365+ "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==",
2366+ "funding": [
2367+ {
2368+ "type": "individual",
2369+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2370+ },
2371+ {
2372+ "type": "individual",
2373+ "url": "https://www.buymeacoffee.com/ricmoo"
2374+ }
2375+ ],
2376+ "dependencies": {
2377+ "@ethersproject/bytes": "^5.7.0"
2378+ }
2379+ },
2380+ "node_modules/@ethersproject/bignumber": {
2381+ "version": "5.7.0",
2382+ "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz",
2383+ "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==",
2384+ "funding": [
2385+ {
2386+ "type": "individual",
2387+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2388+ },
2389+ {
2390+ "type": "individual",
2391+ "url": "https://www.buymeacoffee.com/ricmoo"
2392+ }
2393+ ],
2394+ "dependencies": {
2395+ "@ethersproject/bytes": "^5.7.0",
2396+ "@ethersproject/logger": "^5.7.0",
2397+ "bn.js": "^5.2.1"
2398+ }
2399+ },
2400+ "node_modules/@ethersproject/bignumber/node_modules/bn.js": {
2401+ "version": "5.2.1",
2402+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz",
2403+ "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ=="
2404+ },
2405+ "node_modules/@ethersproject/bytes": {
2406+ "version": "5.7.0",
2407+ "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz",
2408+ "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==",
2409+ "funding": [
2410+ {
2411+ "type": "individual",
2412+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2413+ },
2414+ {
2415+ "type": "individual",
2416+ "url": "https://www.buymeacoffee.com/ricmoo"
2417+ }
2418+ ],
2419+ "dependencies": {
2420+ "@ethersproject/logger": "^5.7.0"
2421+ }
2422+ },
2423+ "node_modules/@ethersproject/constants": {
2424+ "version": "5.7.0",
2425+ "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz",
2426+ "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==",
2427+ "funding": [
2428+ {
2429+ "type": "individual",
2430+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2431+ },
2432+ {
2433+ "type": "individual",
2434+ "url": "https://www.buymeacoffee.com/ricmoo"
2435+ }
2436+ ],
2437+ "dependencies": {
2438+ "@ethersproject/bignumber": "^5.7.0"
2439+ }
2440+ },
2441+ "node_modules/@ethersproject/hash": {
2442+ "version": "5.7.0",
2443+ "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz",
2444+ "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==",
2445+ "funding": [
2446+ {
2447+ "type": "individual",
2448+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2449+ },
2450+ {
2451+ "type": "individual",
2452+ "url": "https://www.buymeacoffee.com/ricmoo"
2453+ }
2454+ ],
2455+ "dependencies": {
2456+ "@ethersproject/abstract-signer": "^5.7.0",
2457+ "@ethersproject/address": "^5.7.0",
2458+ "@ethersproject/base64": "^5.7.0",
2459+ "@ethersproject/bignumber": "^5.7.0",
2460+ "@ethersproject/bytes": "^5.7.0",
2461+ "@ethersproject/keccak256": "^5.7.0",
2462+ "@ethersproject/logger": "^5.7.0",
2463+ "@ethersproject/properties": "^5.7.0",
2464+ "@ethersproject/strings": "^5.7.0"
2465+ }
2466+ },
2467+ "node_modules/@ethersproject/keccak256": {
2468+ "version": "5.7.0",
2469+ "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz",
2470+ "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==",
2471+ "funding": [
2472+ {
2473+ "type": "individual",
2474+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2475+ },
2476+ {
2477+ "type": "individual",
2478+ "url": "https://www.buymeacoffee.com/ricmoo"
2479+ }
2480+ ],
2481+ "dependencies": {
2482+ "@ethersproject/bytes": "^5.7.0",
2483+ "js-sha3": "0.8.0"
2484+ }
2485+ },
2486+ "node_modules/@ethersproject/logger": {
2487+ "version": "5.7.0",
2488+ "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz",
2489+ "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==",
2490+ "funding": [
2491+ {
2492+ "type": "individual",
2493+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2494+ },
2495+ {
2496+ "type": "individual",
2497+ "url": "https://www.buymeacoffee.com/ricmoo"
2498+ }
2499+ ]
2500+ },
2501+ "node_modules/@ethersproject/networks": {
2502+ "version": "5.7.1",
2503+ "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz",
2504+ "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==",
2505+ "funding": [
2506+ {
2507+ "type": "individual",
2508+ "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2"
2509+ },
2510+ {
2511+ "type": "individual",
2512+ "url": "https://www.buymeacoffee.com/ricmoo"
2513+ }
2514+ ],
2515+ "dependencies": {
2516+ "@ethersproject/logger": "^5.7.0"
2517+ }
2518+ },
2519+ "node_modules/@ethersproject/properties": {
2520+ "version": "5.7.0",
2521+ "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz",
2522+ "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==",
Cut short: this commit's diff is over 1000 lines.
ui/package.json+7−3
Cut short: this commit's diff is over 1000 lines.
ui/src/components/AuthenticationForm/index.tsx+90−0
Cut short: this commit's diff is over 1000 lines.
ui/src/components/Page/index.tsx+9−11
Cut short: this commit's diff is over 1000 lines.
ui/src/index.css+4−1
Cut short: this commit's diff is over 1000 lines.
ui/src/index.tsx+20−3
Cut short: this commit's diff is over 1000 lines.
ui/src/theme.ts+11−0
Cut short: this commit's diff is over 1000 lines.
ui/src/types.ts+8−0
Cut short: this commit's diff is over 1000 lines.