Skip to content

Commit 4ef3b08

Browse files
authored
Updates: Schemas, Naming, Tx Override, Packages (#536)
* updated backend-wallet end-point to not accept xAccountAddress * updates to help with build issue & vulnerability * updates: casing, schema def, txOverrides usage * Updated types which fixes SDK too * Readme updates * updated wallet schema naming
1 parent 8737955 commit 4ef3b08

File tree

143 files changed

+888
-748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+888
-748
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Engine is an open-source, backend HTTP server that provides a production-ready i
4040

4141
## Get Engine
4242

43+
### Cloud-host
44+
45+
[Get Engine hosted and managed by thirdweb](https://thirdweb.com/dashboard/engine?requestCloudHosted).
46+
4347
### Self-host
4448

4549
Host Engine on your own instructure for free. [View self-host instructions](https://portal.thirdweb.com/engine/self-host).
@@ -48,10 +52,6 @@ Other deployment options:
4852

4953
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/fcEVay)
5054

51-
### Cloud-host
52-
53-
[Get Engine hosted and managed by thirdweb](https://thirdweb.com/dashboard/engine?requestCloudHosted).
54-
5555
## Contributing
5656

5757
We welcome contributions! See [How to contribute](./contributing.md).

src/server/routes/auth/access-tokens/create.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import { env } from "../../../../utils/env";
1111
import { standardResponseSchema } from "../../../schemas/sharedApiSchemas";
1212
import { AccessTokenSchema } from "./getAll";
1313

14-
const BodySchema = Type.Object({
14+
const requestBodySchema = Type.Object({
1515
label: Type.Optional(Type.String()),
1616
});
1717

18-
const ReplySchema = Type.Object({
18+
const responseBodySchema = Type.Object({
1919
result: Type.Composite([
2020
AccessTokenSchema,
2121
Type.Object({
@@ -26,8 +26,8 @@ const ReplySchema = Type.Object({
2626

2727
export async function createAccessToken(fastify: FastifyInstance) {
2828
fastify.route<{
29-
Body: Static<typeof BodySchema>;
30-
Reply: Static<typeof ReplySchema>;
29+
Body: Static<typeof requestBodySchema>;
30+
Reply: Static<typeof responseBodySchema>;
3131
}>({
3232
method: "POST",
3333
url: "/auth/access-tokens/create",
@@ -36,10 +36,10 @@ export async function createAccessToken(fastify: FastifyInstance) {
3636
description: "Create a new access token",
3737
tags: ["Access Tokens"],
3838
operationId: "create",
39-
body: BodySchema,
39+
body: requestBodySchema,
4040
response: {
4141
...standardResponseSchema,
42-
[StatusCodes.OK]: ReplySchema,
42+
[StatusCodes.OK]: responseBodySchema,
4343
},
4444
},
4545
handler: async (req, res) => {

src/server/routes/auth/access-tokens/getAll.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ export const AccessTokenSchema = Type.Object({
1313
label: Type.Union([Type.String(), Type.Null()]),
1414
});
1515

16-
const ReplySchema = Type.Object({
16+
const responseBodySchema = Type.Object({
1717
result: Type.Array(AccessTokenSchema),
1818
});
1919

2020
export async function getAllAccessTokens(fastify: FastifyInstance) {
2121
fastify.route<{
22-
Reply: Static<typeof ReplySchema>;
22+
Reply: Static<typeof responseBodySchema>;
2323
}>({
2424
method: "GET",
2525
url: "/auth/access-tokens/get-all",
@@ -30,7 +30,7 @@ export async function getAllAccessTokens(fastify: FastifyInstance) {
3030
operationId: "getAll",
3131
response: {
3232
...standardResponseSchema,
33-
[StatusCodes.OK]: ReplySchema,
33+
[StatusCodes.OK]: responseBodySchema,
3434
},
3535
},
3636
handler: async (req, res) => {

src/server/routes/auth/access-tokens/revoke.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ import { revokeToken } from "../../../../db/tokens/revokeToken";
55
import { accessTokenCache } from "../../../../utils/cache/accessToken";
66
import { standardResponseSchema } from "../../../schemas/sharedApiSchemas";
77

8-
const BodySchema = Type.Object({
8+
const requestBodySchema = Type.Object({
99
id: Type.String(),
1010
});
1111

12-
const ReplySchema = Type.Object({
12+
const responseBodySchema = Type.Object({
1313
result: Type.Object({
1414
success: Type.Boolean(),
1515
}),
1616
});
1717

1818
export async function revokeAccessToken(fastify: FastifyInstance) {
1919
fastify.route<{
20-
Body: Static<typeof BodySchema>;
21-
Reply: Static<typeof ReplySchema>;
20+
Body: Static<typeof requestBodySchema>;
21+
Reply: Static<typeof responseBodySchema>;
2222
}>({
2323
method: "POST",
2424
url: "/auth/access-tokens/revoke",
@@ -27,10 +27,10 @@ export async function revokeAccessToken(fastify: FastifyInstance) {
2727
description: "Revoke an access token",
2828
tags: ["Access Tokens"],
2929
operationId: "revoke",
30-
body: BodySchema,
30+
body: requestBodySchema,
3131
response: {
3232
...standardResponseSchema,
33-
[StatusCodes.OK]: ReplySchema,
33+
[StatusCodes.OK]: responseBodySchema,
3434
},
3535
},
3636
handler: async (req, res) => {

src/server/routes/auth/access-tokens/update.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ import { updateToken } from "../../../../db/tokens/updateToken";
55
import { accessTokenCache } from "../../../../utils/cache/accessToken";
66
import { standardResponseSchema } from "../../../schemas/sharedApiSchemas";
77

8-
const BodySchema = Type.Object({
8+
const requestBodySchema = Type.Object({
99
id: Type.String(),
1010
label: Type.Optional(Type.String()),
1111
});
1212

13-
const ReplySchema = Type.Object({
13+
const responseBodySchema = Type.Object({
1414
result: Type.Object({
1515
success: Type.Boolean(),
1616
}),
1717
});
1818

1919
export async function updateAccessToken(fastify: FastifyInstance) {
2020
fastify.route<{
21-
Body: Static<typeof BodySchema>;
22-
Reply: Static<typeof ReplySchema>;
21+
Body: Static<typeof requestBodySchema>;
22+
Reply: Static<typeof responseBodySchema>;
2323
}>({
2424
method: "POST",
2525
url: "/auth/access-tokens/update",
@@ -28,10 +28,10 @@ export async function updateAccessToken(fastify: FastifyInstance) {
2828
description: "Update an access token",
2929
tags: ["Access Tokens"],
3030
operationId: "update",
31-
body: BodySchema,
31+
body: requestBodySchema,
3232
response: {
3333
...standardResponseSchema,
34-
[StatusCodes.OK]: ReplySchema,
34+
[StatusCodes.OK]: responseBodySchema,
3535
},
3636
},
3737
handler: async (req, res) => {

src/server/routes/auth/keypair/add.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "../../../schemas/keypairs";
1313
import { standardResponseSchema } from "../../../schemas/sharedApiSchemas";
1414

15-
const BodySchema = Type.Object({
15+
const requestBodySchema = Type.Object({
1616
publicKey: Type.String({
1717
description:
1818
"The public key of your keypair beginning with '-----BEGIN PUBLIC KEY-----'.",
@@ -21,16 +21,16 @@ const BodySchema = Type.Object({
2121
label: Type.Optional(Type.String()),
2222
});
2323

24-
const ReplySchema = Type.Object({
24+
const responseBodySchema = Type.Object({
2525
result: Type.Object({
2626
keypair: KeypairSchema,
2727
}),
2828
});
2929

3030
export async function addKeypair(fastify: FastifyInstance) {
3131
fastify.route<{
32-
Body: Static<typeof BodySchema>;
33-
Reply: Static<typeof ReplySchema>;
32+
Body: Static<typeof requestBodySchema>;
33+
Reply: Static<typeof responseBodySchema>;
3434
}>({
3535
method: "POST",
3636
url: "/auth/keypair/add",
@@ -39,10 +39,10 @@ export async function addKeypair(fastify: FastifyInstance) {
3939
description: "Add the public key for a keypair",
4040
tags: ["Keypair"],
4141
operationId: "add",
42-
body: BodySchema,
42+
body: requestBodySchema,
4343
response: {
4444
...standardResponseSchema,
45-
[StatusCodes.OK]: ReplySchema,
45+
[StatusCodes.OK]: responseBodySchema,
4646
},
4747
},
4848
handler: async (req, res) => {

src/server/routes/auth/keypair/list.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import { listKeypairs } from "../../../../db/keypair/list";
55
import { KeypairSchema, toKeypairSchema } from "../../../schemas/keypairs";
66
import { standardResponseSchema } from "../../../schemas/sharedApiSchemas";
77

8-
const ReplySchema = Type.Object({
8+
const responseBodySchema = Type.Object({
99
result: Type.Array(KeypairSchema),
1010
});
1111

1212
export async function listPublicKeys(fastify: FastifyInstance) {
1313
fastify.route<{
14-
Reply: Static<typeof ReplySchema>;
14+
Reply: Static<typeof responseBodySchema>;
1515
}>({
1616
method: "GET",
1717
url: "/auth/keypair/get-all",
@@ -22,7 +22,7 @@ export async function listPublicKeys(fastify: FastifyInstance) {
2222
operationId: "list",
2323
response: {
2424
...standardResponseSchema,
25-
[StatusCodes.OK]: ReplySchema,
25+
[StatusCodes.OK]: responseBodySchema,
2626
},
2727
},
2828
handler: async (req, res) => {

src/server/routes/auth/keypair/remove.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ import { deleteKeypair } from "../../../../db/keypair/delete";
55
import { keypairCache } from "../../../../utils/cache/keypair";
66
import { standardResponseSchema } from "../../../schemas/sharedApiSchemas";
77

8-
const BodySchema = Type.Object({
8+
const requestBodySchema = Type.Object({
99
hash: Type.String(),
1010
});
1111

12-
const ReplySchema = Type.Object({
12+
const responseBodySchema = Type.Object({
1313
result: Type.Object({
1414
success: Type.Boolean(),
1515
}),
1616
});
1717

1818
export async function removePublicKey(fastify: FastifyInstance) {
1919
fastify.route<{
20-
Body: Static<typeof BodySchema>;
21-
Reply: Static<typeof ReplySchema>;
20+
Body: Static<typeof requestBodySchema>;
21+
Reply: Static<typeof responseBodySchema>;
2222
}>({
2323
method: "POST",
2424
url: "/auth/keypair/remove",
@@ -27,10 +27,10 @@ export async function removePublicKey(fastify: FastifyInstance) {
2727
description: "Remove the public key for a keypair",
2828
tags: ["Keypair"],
2929
operationId: "remove",
30-
body: BodySchema,
30+
body: requestBodySchema,
3131
response: {
3232
...standardResponseSchema,
33-
[StatusCodes.OK]: ReplySchema,
33+
[StatusCodes.OK]: responseBodySchema,
3434
},
3535
},
3636
handler: async (req, res) => {

src/server/routes/auth/permissions/getAll.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { StatusCodes } from "http-status-codes";
44
import { prisma } from "../../../../db/client";
55
import { standardResponseSchema } from "../../../schemas/sharedApiSchemas";
66

7-
const ReplySchema = Type.Object({
7+
const responseBodySchema = Type.Object({
88
result: Type.Array(
99
Type.Object({
1010
walletAddress: Type.String(),
@@ -16,7 +16,7 @@ const ReplySchema = Type.Object({
1616

1717
export async function getAllPermissions(fastify: FastifyInstance) {
1818
fastify.route<{
19-
Reply: Static<typeof ReplySchema>;
19+
Reply: Static<typeof responseBodySchema>;
2020
}>({
2121
method: "GET",
2222
url: "/auth/permissions/get-all",
@@ -27,7 +27,7 @@ export async function getAllPermissions(fastify: FastifyInstance) {
2727
operationId: "getAll",
2828
response: {
2929
...standardResponseSchema,
30-
[StatusCodes.OK]: ReplySchema,
30+
[StatusCodes.OK]: responseBodySchema,
3131
},
3232
},
3333
handler: async (req, res) => {

src/server/routes/auth/permissions/grant.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ import { Static, Type } from "@sinclair/typebox";
22
import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import { updatePermissions } from "../../../../db/permissions/updatePermissions";
5-
import { PermissionsSchema } from "../../../schemas/auth";
5+
import { permissionsSchema } from "../../../schemas/auth";
66
import { standardResponseSchema } from "../../../schemas/sharedApiSchemas";
77

8-
const BodySchema = Type.Object({
8+
const requestBodySchema = Type.Object({
99
walletAddress: Type.String(),
10-
permissions: PermissionsSchema,
10+
permissions: permissionsSchema,
1111
label: Type.Optional(Type.String()),
1212
});
1313

14-
const ReplySchema = Type.Object({
14+
const responseBodySchema = Type.Object({
1515
result: Type.Object({
1616
success: Type.Boolean(),
1717
}),
1818
});
1919

2020
export async function grantPermissions(fastify: FastifyInstance) {
2121
fastify.route<{
22-
Body: Static<typeof BodySchema>;
23-
Reply: Static<typeof ReplySchema>;
22+
Body: Static<typeof requestBodySchema>;
23+
Reply: Static<typeof responseBodySchema>;
2424
}>({
2525
method: "POST",
2626
url: "/auth/permissions/grant",
@@ -29,10 +29,10 @@ export async function grantPermissions(fastify: FastifyInstance) {
2929
description: "Grant permissions to a user",
3030
tags: ["Permissions"],
3131
operationId: "grant",
32-
body: BodySchema,
32+
body: requestBodySchema,
3333
response: {
3434
...standardResponseSchema,
35-
[StatusCodes.OK]: ReplySchema,
35+
[StatusCodes.OK]: responseBodySchema,
3636
},
3737
},
3838
handler: async (req, res) => {

src/server/routes/auth/permissions/revoke.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ import { StatusCodes } from "http-status-codes";
44
import { deletePermissions } from "../../../../db/permissions/deletePermissions";
55
import { standardResponseSchema } from "../../../schemas/sharedApiSchemas";
66

7-
const BodySchema = Type.Object({
7+
const requestBodySchema = Type.Object({
88
walletAddress: Type.String(),
99
});
1010

11-
const ReplySchema = Type.Object({
11+
const responseBodySchema = Type.Object({
1212
result: Type.Object({
1313
success: Type.Boolean(),
1414
}),
1515
});
1616

1717
export async function revokePermissions(fastify: FastifyInstance) {
1818
fastify.route<{
19-
Body: Static<typeof BodySchema>;
20-
Reply: Static<typeof ReplySchema>;
19+
Body: Static<typeof requestBodySchema>;
20+
Reply: Static<typeof responseBodySchema>;
2121
}>({
2222
method: "POST",
2323
url: "/auth/permissions/revoke",
@@ -26,10 +26,10 @@ export async function revokePermissions(fastify: FastifyInstance) {
2626
description: "Revoke a user's permissions",
2727
tags: ["Permissions"],
2828
operationId: "revoke",
29-
body: BodySchema,
29+
body: requestBodySchema,
3030
response: {
3131
...standardResponseSchema,
32-
[StatusCodes.OK]: ReplySchema,
32+
[StatusCodes.OK]: responseBodySchema,
3333
},
3434
},
3535
handler: async (req, res) => {

0 commit comments

Comments
 (0)