Skip to content

Commit f8fa400

Browse files
authored
Merge branch 'main' into pb/aws-kms-v5
2 parents f212821 + 99cbd84 commit f8fa400

File tree

297 files changed

+10079
-2221
lines changed

Some content is hidden

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

297 files changed

+10079
-2221
lines changed

.github/workflows/main.yml

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,70 @@
1-
# Main Branch Build Workflow for Docker Image supporting multiple architectures
2-
name: Build on Main Merge
1+
name: Build Nightly on Main Merge
32

43
on:
54
push:
65
branches:
76
- main
87

8+
env:
9+
REGISTRY_IMAGE: thirdweb/engine
10+
911
jobs:
1012
build:
11-
runs-on: ubuntu-latest-32
12-
13+
runs-on: ${{ matrix.runner }}
14+
strategy:
15+
matrix:
16+
include:
17+
- platform: linux/amd64
18+
runner: ubuntu-latest
19+
arch: amd64
20+
- platform: linux/arm64
21+
runner: ubuntu-24.04-arm64
22+
arch: arm64
1323
steps:
14-
- name: Check Disk Space Before Build
15-
run: df -h
16-
17-
- name: Docker Prune
18-
run: docker system prune -af
19-
2024
- name: Checkout code
21-
uses: actions/checkout@v2
22-
with:
23-
ref: main # checkout the main branch to build nightly
25+
uses: actions/checkout@v3
2426

2527
- name: Set up Docker Buildx
26-
uses: docker/setup-buildx-action@v1
28+
uses: docker/setup-buildx-action@v3
2729

2830
- name: Login to DockerHub
29-
uses: docker/login-action@v1
31+
uses: docker/login-action@v3
3032
with:
3133
username: ${{ secrets.DOCKER_USERNAME }}
3234
password: ${{ secrets.DOCKER_PASSWORD }}
3335

34-
- name: Build and Push Docker Image
35-
uses: docker/build-push-action@v2
36+
- name: Build and push image
37+
id: build
38+
uses: docker/build-push-action@v6
3639
with:
3740
context: .
3841
target: prod
39-
platforms: linux/amd64,linux/arm64
4042
push: true
41-
tags: thirdweb/engine:nightly
42-
build-args: |
43-
ENGINE_VERSION=nightly
43+
tags: thirdweb/engine:nightly-${{matrix.arch }}
44+
platforms: ${{ matrix.platform }}
45+
cache-from: type=gha,scope=${{ matrix.platform }}
46+
cache-to: type=gha,scope=${{ matrix.platform }},mode=max
47+
build-args: ENGINE_VERSION=nightly
48+
49+
merge-manifests:
50+
needs: build
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
56+
- name: Login to DockerHub
57+
uses: docker/login-action@v3
58+
with:
59+
username: ${{ secrets.DOCKER_USERNAME }}
60+
password: ${{ secrets.DOCKER_PASSWORD }}
4461

45-
- name: Check Disk Space After Build
46-
run: df -h
62+
- name: Create and Push Multi-arch Manifest
63+
run: |
64+
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:nightly \
65+
${{ env.REGISTRY_IMAGE }}:nightly-amd64 \
66+
${{ env.REGISTRY_IMAGE }}:nightly-arm64
67+
68+
- name: Inspect image
69+
run: |
70+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:nightly

.github/workflows/npmPublish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Checkout code
1111
uses: actions/checkout@v2
1212
with:
13-
ref: "main"
13+
ref: ${{ github.ref }}
1414

1515
- name: Set up Node.js
1616
uses: actions/setup-node@v2

.github/workflows/tagBasedImageBuild.yml

Lines changed: 61 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,86 @@ on:
44
release:
55
types: [created] # This listens to release creation events
66

7+
env:
8+
REGISTRY_IMAGE: thirdweb/engine
9+
710
jobs:
8-
buildImageForNewTag:
9-
runs-on: ubuntu-latest-32
10-
# Set environment variables
11+
build:
12+
runs-on: ${{ matrix.runner }}
13+
strategy:
14+
matrix:
15+
include:
16+
- platform: linux/amd64
17+
runner: ubuntu-latest
18+
arch: amd64
19+
- platform: linux/arm64
20+
runner: ubuntu-24.04-arm64
21+
arch: arm64
1122
env:
12-
LATEST_TAG: ${{ (github.event.release.target_commitish == 'main') && 'thirdweb/engine:latest' || '' }}
23+
LATEST_TAG: ${{ github.event.release.target_commitish == 'main' && 'thirdweb/engine:latest' || '' }}
1324

1425
steps:
15-
- name: Check Disk Space Before Build
16-
run: df -h
17-
18-
- name: Docker Prune
19-
run: docker system prune -af
20-
2126
- name: Checkout code
22-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
2328
with:
24-
# Fetches the branch at which the release was made
2529
ref: ${{ github.event.release.target_commitish }}
2630

2731
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v1
32+
uses: docker/setup-buildx-action@v3
2933

3034
- name: Login to DockerHub
31-
uses: docker/login-action@v1
35+
uses: docker/login-action@v3
3236
with:
3337
username: ${{ secrets.DOCKER_USERNAME }}
3438
password: ${{ secrets.DOCKER_PASSWORD }}
3539

3640
- name: Build and Push Docker Image
37-
uses: docker/build-push-action@v2
41+
uses: docker/build-push-action@v6
3842
with:
3943
context: .
4044
target: prod
41-
platforms: linux/amd64,linux/arm64
45+
platforms: ${{ matrix.platform }}
4246
push: true
4347
tags: |
44-
thirdweb/engine:${{ github.event.release.tag_name }}
45-
${{ env.LATEST_TAG }}
46-
build-args: |
47-
ENGINE_VERSION=${{ github.event.release.tag_name }}
48+
${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-${{ matrix.arch }}
49+
${{ env.LATEST_TAG != '' && format('thirdweb/engine:latest-{0}', matrix.arch) || '' }}
50+
cache-from: type=gha,scope=${{ matrix.platform }}
51+
cache-to: type=gha,scope=${{ matrix.platform }},mode=max
52+
build-args: ENGINE_VERSION=${{ github.event.release.tag_name }}
53+
54+
merge-manifests:
55+
needs: build
56+
runs-on: ubuntu-latest
57+
env:
58+
LATEST_TAG: ${{ github.event.release.target_commitish == 'main' && 'thirdweb/engine:latest' || '' }}
59+
steps:
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v3
62+
63+
- name: Login to DockerHub
64+
uses: docker/login-action@v3
65+
with:
66+
username: ${{ secrets.DOCKER_USERNAME }}
67+
password: ${{ secrets.DOCKER_PASSWORD }}
68+
69+
- name: Create and Push Multi-arch Manifest (release tag)
70+
run: |
71+
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }} \
72+
${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-amd64 \
73+
${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-arm64
74+
75+
- name: Inspect release image
76+
run: |
77+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}
4878
49-
- name: Check Disk Space After Build
50-
run: df -h
79+
- name: Create and Push Multi-arch Manifest (latest tag) (if applicable)
80+
if: ${{ env.LATEST_TAG != '' }}
81+
run: |
82+
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:latest \
83+
${{ env.REGISTRY_IMAGE }}:latest-amd64 \
84+
${{ env.REGISTRY_IMAGE }}:latest-arm64
85+
86+
- name: Inspect latest image (if applicable)
87+
if: ${{ env.LATEST_TAG != '' }}
88+
run: |
89+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,5 @@ credentials
150150
https
151151

152152
# Auto generated OpenAPI file
153-
openapi.json
153+
openapi.json
154+
.aider*

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
"typescript.enablePromptUseWorkspaceTsdk": true,
1111
"[prisma]": {
1212
"editor.defaultFormatter": "Prisma.prisma"
13+
},
14+
"[typescript]": {
15+
"editor.defaultFormatter": "biomejs.biome"
1316
}
1417
}

biome.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true,
7+
"defaultBranch": "dev"
8+
},
9+
"formatter": {
10+
"enabled": true,
11+
"indentStyle": "space"
12+
},
13+
"organizeImports": {
14+
"enabled": true
15+
},
16+
"linter": {
17+
"enabled": true,
18+
"rules": {
19+
"correctness": {
20+
"noNewSymbol": "error",
21+
"noUnusedImports": "error",
22+
"noUnusedVariables": "error",
23+
"useArrayLiterals": "error"
24+
},
25+
"complexity": {
26+
"noStaticOnlyClass": "off"
27+
}
28+
}
29+
}
30+
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@
6868
"node-cron": "^3.0.2",
6969
"pg": "^8.11.3",
7070
"prisma": "^5.14.0",
71+
"prom-client": "^15.1.3",
7172
"superjson": "^2.2.1",
72-
"thirdweb": "^5.45.1",
73+
"thirdweb": "^5.58.4",
7374
"uuid": "^9.0.1",
7475
"winston": "^3.14.1",
7576
"zod": "^3.23.8"
7677
},
7778
"devDependencies": {
79+
"@biomejs/biome": "^1.9.2",
7880
"@types/cli-progress": "^3.11.3",
7981
"@types/cookie": "^0.5.1",
8082
"@types/crypto-js": "^4.2.2",

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@thirdweb-dev/engine",
3-
"version": "0.0.12",
3+
"version": "0.0.15",
44
"main": "dist/thirdweb-dev-engine.cjs.js",
55
"module": "dist/thirdweb-dev-engine.esm.js",
66
"files": [

src/db/configuration/updateConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Prisma } from "@prisma/client";
1+
import type { Prisma } from "@prisma/client";
22
import { encrypt } from "../../utils/crypto";
33
import { prisma } from "../client";
44

src/db/keypair/get.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ import { Keypairs } from "@prisma/client";
22
import { createHash } from "crypto";
33
import { prisma } from "../client";
44

5-
export const getKeypairByPublicKey = async ({
6-
publicKey,
7-
}: {
8-
publicKey: string;
9-
}): Promise<Keypairs | null> => {
10-
const hash = createHash("sha256").update(publicKey).digest("hex");
11-
5+
export const getKeypairByHash = async (
6+
hash: string,
7+
): Promise<Keypairs | null> => {
128
return prisma.keypairs.findUnique({
139
where: { hash },
1410
});
1511
};
12+
13+
export const getKeypairByPublicKey = async (
14+
publicKey: string,
15+
): Promise<Keypairs | null> => {
16+
const hash = createHash("sha256").update(publicKey).digest("hex");
17+
return getKeypairByHash(hash);
18+
};

0 commit comments

Comments
 (0)