Skip to content

Commit a9a2068

Browse files
fix all biome errors
1 parent 21e3a89 commit a9a2068

Some content is hidden

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

41 files changed

+11482
-16731
lines changed

.github/workflows/build-image-tag.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
include:
1616
- platform: linux/amd64
17-
runner: ubuntu-latest
17+
runner: ubuntu-24.04
1818
arch: amd64
1919
- platform: linux/arm64
2020
runner: ubuntu-24.04-arm64
@@ -24,7 +24,7 @@ jobs:
2424

2525
steps:
2626
- name: Checkout code
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2828
with:
2929
ref: ${{ github.event.release.target_commitish }}
3030

@@ -53,7 +53,7 @@ jobs:
5353

5454
merge-manifests:
5555
needs: build
56-
runs-on: ubuntu-latest
56+
runs-on: ubuntu-24.04
5757
env:
5858
LATEST_TAG: ${{ github.event.release.target_commitish == 'main' && 'thirdweb/engine:latest' || '' }}
5959
steps:
@@ -86,4 +86,4 @@ jobs:
8686
- name: Inspect latest image (if applicable)
8787
if: ${{ env.LATEST_TAG != '' }}
8888
run: |
89-
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest
89+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ on: pull_request
44

55
jobs:
66
build:
7-
runs-on: ubuntu-latest
7+
runs-on: ubuntu-24.04
88
steps:
99
- name: Checkout code
10-
uses: actions/checkout@v3
10+
uses: actions/checkout@v4
1111
with:
1212
ref: ${{ github.ref }}
1313

1414
- name: Set up Node.js
15-
uses: actions/setup-node@v3
15+
uses: actions/setup-node@v4
1616
with:
1717
node-version: "18"
1818
cache: "yarn"
19-
19+
2020
- name: Install dependencies
2121
run: yarn install
2222

.github/workflows/lint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ on: pull_request
44

55
jobs:
66
lint:
7-
runs-on: ubuntu-latest
7+
runs-on: ubuntu-24.04
88
steps:
99
- name: Checkout code
10-
uses: actions/checkout@v3
10+
uses: actions/checkout@v4
1111
with:
1212
ref: ${{ github.ref }}
1313

1414
- name: Set up Node.js
15-
uses: actions/setup-node@v3
15+
uses: actions/setup-node@v4
1616
with:
1717
node-version: "18"
1818
cache: "yarn"
19-
19+
2020
- name: Install dependencies
2121
run: yarn install
2222

2323
- name: Run lint
24-
run: yarn lint
24+
run: yarn lint

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515
matrix:
1616
include:
1717
- platform: linux/amd64
18-
runner: ubuntu-latest
18+
runner: ubuntu-24.04
1919
arch: amd64
2020
- platform: linux/arm64
2121
runner: ubuntu-24.04-arm64
2222
arch: arm64
2323
steps:
2424
- name: Checkout code
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626

2727
- name: Set up Docker Buildx
2828
uses: docker/setup-buildx-action@v3
@@ -48,7 +48,7 @@ jobs:
4848

4949
merge-manifests:
5050
needs: build
51-
runs-on: ubuntu-latest
51+
runs-on: ubuntu-24.04
5252
steps:
5353
- name: Set up Docker Buildx
5454
uses: docker/setup-buildx-action@v3
@@ -67,4 +67,4 @@ jobs:
6767
6868
- name: Inspect image
6969
run: |
70-
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:nightly
70+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:nightly

.github/workflows/npm-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ on:
55

66
jobs:
77
build:
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-24.04
99
steps:
1010
- name: Checkout code
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v4
1212
with:
1313
ref: ${{ github.ref }}
1414

1515
- name: Set up Node.js
16-
uses: actions/setup-node@v2
16+
uses: actions/setup-node@v4
1717
with:
1818
node-version: "18"
1919
cache: "yarn"

.github/workflows/stale.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ on:
1212
jobs:
1313
stale:
1414

15-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-24.04
1616
permissions:
1717
issues: write
1818
pull-requests: write
1919

2020
steps:
21-
- uses: actions/stale@v5
21+
- uses: actions/stale@v9
2222
with:
2323
repo-token: ${{ secrets.GITHUB_TOKEN }}
2424
stale-pr-message: 'This PR is stale because it has been open for 7 days with no activity. Remove stale label or comment or this PR will be closed in 3 days.'

.yarnrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--ignore-engines true

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"superjson": "^2.2.1",
7070
"thirdweb": "^5.71.0",
7171
"uuid": "^9.0.1",
72+
"viem": "^2.21.54",
7273
"winston": "^3.14.1",
7374
"zod": "^3.23.8"
7475
},
@@ -101,5 +102,5 @@
101102
"ws": ">=8.17.1",
102103
"cross-spawn": ">=7.0.6"
103104
},
104-
"packageManager": "yarn@4.5.3"
105+
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
105106
}

src/polyfill.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as crypto from "node:crypto";
22

33
if (typeof globalThis.crypto === "undefined") {
4-
(globalThis as any).crypto = crypto;
4+
// @ts-expect-error
5+
globalThis.crypto = crypto;
56
}

src/server/listeners/update-tx-listener.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const updateTxListener = async (): Promise<void> => {
6868
});
6969
});
7070

71-
connection.on("error", async (err: any) => {
71+
connection.on("error", async (err: unknown) => {
7272
logger({
7373
service: "server",
7474
level: "error",

src/server/middleware/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export async function withAuth(server: FastifyInstance) {
126126
}if (error) {
127127
message = error;
128128
}
129-
} catch (err: any) {
129+
} catch (err: unknown) {
130130
logger({
131131
service: "server",
132132
level: "warn",

src/server/middleware/error.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const badChainError = (chain: string | number): CustomError =>
4242
"INVALID_CHAIN",
4343
);
4444

45-
const flipObject = (data: any) =>
45+
const flipObject = (data: object) =>
4646
Object.fromEntries(Object.entries(data).map(([key, value]) => [value, key]));
4747

4848
const isZodError = (err: unknown): boolean => {
@@ -72,15 +72,15 @@ export function withErrorHandler(server: FastifyInstance) {
7272
message: "code" in error ? error.code : error.message,
7373
reason: error.message,
7474
statusCode: 400,
75-
stack: env.NODE_ENV !== "production" ? error.stack : undefined,
75+
stack: env.NODE_ENV === "production" ? undefined : error.stack,
7676
},
7777
});
7878
}
7979

8080
// Zod Typings Errors
8181
if (isZodError(error)) {
8282
const _error = error as ZodError;
83-
let parsedMessage: any[] = [];
83+
let parsedMessage: unknown;
8484

8585
try {
8686
parsedMessage = JSON.parse(_error.message);
@@ -98,7 +98,7 @@ export function withErrorHandler(server: FastifyInstance) {
9898
message: errorObject.message ?? "Invalid Request",
9999
reason: errorObject ?? undefined,
100100
statusCode: 400,
101-
stack: env.NODE_ENV !== "production" ? _error.stack : undefined,
101+
stack: env.NODE_ENV === "production" ? undefined : _error.stack,
102102
},
103103
});
104104
}
@@ -118,7 +118,7 @@ export function withErrorHandler(server: FastifyInstance) {
118118
code,
119119
message,
120120
statusCode,
121-
stack: env.NODE_ENV !== "production" ? error.stack : undefined,
121+
stack: env.NODE_ENV === "production" ? undefined : error.stack,
122122
},
123123
});
124124
}
@@ -128,7 +128,7 @@ export function withErrorHandler(server: FastifyInstance) {
128128
statusCode: 500,
129129
code: "INTERNAL_SERVER_ERROR",
130130
message: error.message || ReasonPhrases.INTERNAL_SERVER_ERROR,
131-
stack: env.NODE_ENV !== "production" ? error.stack : undefined,
131+
stack: env.NODE_ENV === "production" ? undefined : error.stack,
132132
},
133133
});
134134
},

src/server/routes/backend-wallet/sign-transaction.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Type, type Static } from "@sinclair/typebox";
22
import type { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import type { Hex } from "thirdweb";
5+
import type { TransactionSerializable } from "viem";
56
import { getAccount } from "../../../shared/utils/account";
67
import {
78
getChecksumAddress,
@@ -71,7 +72,7 @@ export async function signTransaction(fastify: FastifyInstance) {
7172
}
7273

7374
// @TODO: Assert type to viem TransactionSerializable.
74-
const serializableTransaction: any = {
75+
const serializableTransaction = {
7576
chainId: transaction.chainId,
7677
to: getChecksumAddress(transaction.to),
7778
nonce: maybeInt(transaction.nonce),
@@ -86,7 +87,7 @@ export async function signTransaction(fastify: FastifyInstance) {
8687
maxFeePerGas: maybeBigInt(transaction.maxFeePerGas),
8788
maxPriorityFeePerGas: maybeBigInt(transaction.maxPriorityFeePerGas),
8889
ccipReadEnabled: transaction.ccipReadEnabled,
89-
};
90+
} as TransactionSerializable;
9091
const signature = await account.signTransaction(serializableTransaction);
9192

9293
reply.status(StatusCodes.OK).send({

src/server/routes/contract/extensions/erc20/read/allowance-of.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export async function erc20AllowanceOf(fastify: FastifyInstance) {
6767
chainId,
6868
contractAddress,
6969
});
70-
const returnData: any = await contract.erc20.allowanceOf(
70+
const returnData = await contract.erc20.allowanceOf(
7171
ownerWallet ? ownerWallet : "",
7272
spenderWallet ? spenderWallet : "",
7373
);

src/server/routes/contract/extensions/erc20/read/get.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ export async function erc20GetMetadata(fastify: FastifyInstance) {
5454
chainId,
5555
contractAddress,
5656
});
57-
const returnData: any = await contract.erc20.get();
57+
const returnData = await contract.erc20.get();
5858
reply.status(StatusCodes.OK).send({
5959
result: {
6060
symbol: returnData.symbol,
6161
name: returnData.name,
62-
decimals: returnData.decimals,
62+
decimals: returnData.decimals.toString(),
6363
},
6464
});
6565
},

src/server/routes/transaction/blockchain/send-signed-user-op.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Type, type Static } from "@sinclair/typebox";
22
import { Value } from "@sinclair/typebox/value";
3+
import { TransformDecodeError } from "@sinclair/typebox/value/transform";
34
import type { FastifyInstance } from "fastify";
45
import { StatusCodes } from "http-status-codes";
56
import { env } from "../../../../shared/utils/env";
@@ -47,15 +48,15 @@ const responseBodySchema = Type.Union([
4748

4849
type RpcResponse =
4950
| {
50-
result: string;
51-
error: undefined;
52-
}
51+
result: string;
52+
error: undefined;
53+
}
5354
| {
54-
result: undefined;
55-
error: {
56-
message: string;
57-
};
58-
};
55+
result: undefined;
56+
error: {
57+
message: string;
58+
};
59+
};
5960

6061
export async function sendSignedUserOp(fastify: FastifyInstance) {
6162
fastify.route<{
@@ -68,7 +69,7 @@ export async function sendSignedUserOp(fastify: FastifyInstance) {
6869
schema: {
6970
summary: "Send a signed user operation",
7071
description: "Send a signed user operation",
71-
tags: ["Transaction"],
72+
tags: [ "Transaction" ],
7273
operationId: "sendSignedUserOp",
7374
params: walletChainParamSchema,
7475
body: requestBodySchema,
@@ -86,10 +87,11 @@ export async function sendSignedUserOp(fastify: FastifyInstance) {
8687
if (typeof signedUserOp === "string") {
8788
try {
8889
userOp = Value.Decode(UserOpString, signedUserOp);
89-
} catch (err: any) {
90+
} catch (err: unknown) {
91+
const msg = err instanceof TransformDecodeError ? err.message : err;
9092
return res.status(400).send({
9193
error: {
92-
message: `Invalid signed user operation. - ${err.message || err}`,
94+
message: `Invalid signed user operation. - ${msg}`,
9395
},
9496
});
9597
}
@@ -109,12 +111,14 @@ export async function sendSignedUserOp(fastify: FastifyInstance) {
109111
id: 1,
110112
jsonrpc: "2.0",
111113
method: "eth_sendUserOperation",
112-
params: [userOp, entryPointAddress],
114+
params: [ userOp, entryPointAddress ],
113115
}),
114116
});
115117

116118
const { result: userOpHash, error } =
117-
(await userOpRes.json()) as RpcResponse;
119+
(
120+
await userOpRes.json()
121+
) as RpcResponse;
118122

119123
if (error) {
120124
return res.status(400).send({

src/server/utils/convertor.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { BigNumber } from "ethers";
22

3-
export const bigNumberReplacer = (value: any): any => {
3+
const isHexBigNumber = (value: unknown) => {
4+
const isNonNullObject = typeof value === "object" && value !== null;
5+
const hasType = isNonNullObject && "type" in value;
6+
return hasType && value.type === "BigNumber" && "hex" in value
7+
}
8+
export const bigNumberReplacer = (value: unknown): unknown => {
49
// if we find a BigNumber then make it into a string (since that is safe)
5-
if (
6-
BigNumber.isBigNumber(value) ||
7-
(typeof value === "object" &&
8-
value !== null &&
9-
value.type === "BigNumber" &&
10-
"hex" in value)
11-
) {
10+
if (BigNumber.isBigNumber(value) || isHexBigNumber(value)) {
1211
return BigNumber.from(value).toString();
1312
}
1413

0 commit comments

Comments
 (0)