Skip to content

Commit f9d7935

Browse files
joaquim-vergesd4mr
andauthored
Update engine API (#7427)
Signed-off-by: Prithvish Baidya <[email protected]> Co-authored-by: Prithvish Baidya <[email protected]>
1 parent acd5656 commit f9d7935

File tree

43 files changed

+3493
-2616
lines changed

Some content is hidden

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

43 files changed

+3493
-2616
lines changed

.changeset/heavy-banks-think.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/engine": minor
3+
---
4+
5+
New engine v3 APIs - see changelog for breaking changes

.changeset/lovely-brooms-relax.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Support latest engine API

apps/dashboard/biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.0.4/schema.json",
33
"extends": "//"
44
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/analytics/tx-table/types.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ type ExecutionResult4337Serialized =
3434
}
3535
| {
3636
status: "FAILED";
37-
error: string;
37+
error: {
38+
stage: string;
39+
message: string;
40+
errorCode: string;
41+
inner_error: object;
42+
nonce_used: string;
43+
account_address: string;
44+
};
3845
}
3946
| {
4047
status: "SUBMITTED";

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/tx/[id]/transaction-details-ui.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { format, formatDistanceToNowStrict } from "date-fns";
44
import { ExternalLinkIcon, InfoIcon } from "lucide-react";
55
import Link from "next/link";
6-
import { type ThirdwebClient, toEther } from "thirdweb";
6+
import { hexToNumber, isHex, type ThirdwebClient, toEther } from "thirdweb";
77
import type { Project } from "@/api/projects";
88
import { WalletAddress } from "@/components/blocks/wallet-address";
99
import { Badge } from "@/components/ui/badge";
@@ -43,10 +43,14 @@ export function TransactionDetailsUI({
4343
const status = executionResult?.status as keyof typeof statusDetails;
4444
const errorMessage =
4545
executionResult && "error" in executionResult
46-
? executionResult.error
46+
? executionResult.error.message
4747
: executionResult && "revertData" in executionResult
4848
? executionResult.revertData?.revertReason
4949
: null;
50+
const errorDetails =
51+
executionResult && "error" in executionResult
52+
? executionResult.error
53+
: undefined;
5054

5155
const chain = chainId ? idToChain.get(Number.parseInt(chainId)) : undefined;
5256
const explorer = chain?.explorers?.[0];
@@ -64,7 +68,7 @@ export function TransactionDetailsUI({
6468
// Gas information
6569
const gasUsed =
6670
executionResult && "actualGasUsed" in executionResult
67-
? `${executionResult.actualGasUsed}`
71+
? `${isHex(executionResult.actualGasUsed) ? hexToNumber(executionResult.actualGasUsed) : executionResult.actualGasUsed}`
6872
: "N/A";
6973

7074
const gasCost =
@@ -244,9 +248,16 @@ export function TransactionDetailsUI({
244248
</CardTitle>
245249
</CardHeader>
246250
<CardContent>
247-
<div className="rounded-md bg-destructive/10 p-4 text-destructive">
248-
{errorMessage}
249-
</div>
251+
{errorDetails ? (
252+
<CodeClient
253+
code={JSON.stringify(errorDetails, null, 2)}
254+
lang="json"
255+
/>
256+
) : (
257+
<div className="rounded-md bg-destructive/10 p-4 text-destructive">
258+
{errorMessage}
259+
</div>
260+
)}
250261
</CardContent>
251262
</Card>
252263
)}
@@ -328,7 +339,9 @@ export function TransactionDetailsUI({
328339
Block Number
329340
</div>
330341
<div className="text-sm md:w-2/3">
331-
{transaction.confirmedAtBlockNumber}
342+
{isHex(transaction.confirmedAtBlockNumber)
343+
? hexToNumber(transaction.confirmedAtBlockNumber)
344+
: transaction.confirmedAtBlockNumber}
332345
</div>
333346
</div>
334347
)}

apps/nebula/biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.0.4/schema.json",
33
"extends": "//"
44
}

apps/playground-web/biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.0.4/schema.json",
33
"extends": "//"
44
}

apps/portal/biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.0.4/schema.json",
33
"extends": "//"
44
}

apps/wallet-ui/biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.0.4/schema.json",
33
"extends": "//"
44
}

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.0.4/schema.json",
33
"assist": {
44
"actions": {
55
"source": {

packages/engine/biome.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
3-
"extends": "//"
2+
"$schema": "https://biomejs.dev/schemas/2.0.4/schema.json",
3+
"linter": {
4+
"rules": {
5+
"correctness": {
6+
"useImportExtensions": {
7+
"fix": "safe",
8+
"level": "error",
9+
"options": {
10+
"forceJsExtensions": true
11+
}
12+
}
13+
}
14+
}
15+
},
16+
"root": true
417
}

packages/engine/openapi-ts.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ import { defineConfig } from "@hey-api/openapi-ts";
33
export default defineConfig({
44
input: "https://engine.thirdweb.com/openapi",
55
output: { format: "biome", lint: "biome", path: "src/client" },
6-
plugins: ["@hey-api/client-fetch"],
76
});

packages/engine/package.json

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@
55
"type": "git",
66
"url": "git+https://github.com/thirdweb-dev/js.git#main"
77
},
8-
"license": "Apache-2.0",
9-
"bugs": {
10-
"url": "https://github.com/thirdweb-dev/js/issues"
11-
},
128
"author": "thirdweb eng <[email protected]>",
139
"type": "module",
1410
"main": "./dist/cjs/exports/thirdweb.js",
1511
"module": "./dist/esm/exports/thirdweb.js",
1612
"types": "./dist/types/exports/thirdweb.d.ts",
1713
"typings": "./dist/types/exports/thirdweb.d.ts",
14+
"license": "Apache-2.0",
15+
"bugs": {
16+
"url": "https://github.com/thirdweb-dev/js/issues"
17+
},
18+
"dependencies": {
19+
"@hey-api/client-fetch": "0.10.0"
20+
},
21+
"engines": {
22+
"node": ">=18"
23+
},
1824
"exports": {
1925
".": {
2026
"types": "./dist/types/exports/thirdweb.d.ts",
@@ -42,17 +48,14 @@
4248
}
4349
},
4450
"scripts": {
45-
"format": "biome format ./src --write",
46-
"lint": "biome check ./src",
47-
"fix": "biome check ./src --fix",
4851
"build": "pnpm clean && pnpm build:cjs && pnpm build:esm && pnpm build:types",
4952
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json",
5053
"build:esm": "tsc --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",
54+
"build:generate": "openapi-ts && pnpm format && pnpm fix",
5155
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
5256
"clean": "rimraf dist",
53-
"build:generate": "openapi-ts && pnpm format"
54-
},
55-
"engines": {
56-
"node": ">=18"
57+
"fix": "biome check --write ./src",
58+
"format": "biome format --write ./src",
59+
"lint": "biome check ./src"
5760
}
5861
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

33
import {
4-
type Config,
5-
createClient,
6-
createConfig,
7-
type ClientOptions as DefaultClientOptions,
4+
type Config,
5+
createClient,
6+
createConfig,
7+
type ClientOptions as DefaultClientOptions,
88
} from "./client/index.js";
99
import type { ClientOptions } from "./types.gen.js";
1010

@@ -17,12 +17,12 @@ import type { ClientOptions } from "./types.gen.js";
1717
* to ensure your client always has the correct values.
1818
*/
1919
export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =
20-
(
21-
override?: Config<DefaultClientOptions & T>,
22-
) => Config<Required<DefaultClientOptions> & T>;
20+
(
21+
override?: Config<DefaultClientOptions & T>,
22+
) => Config<Required<DefaultClientOptions> & T>;
2323

2424
export const client = createClient(
25-
createConfig<ClientOptions>({
26-
baseUrl: "https://engine.thirdweb.com",
27-
}),
25+
createConfig<ClientOptions>({
26+
baseUrl: "https://engine.thirdweb.com",
27+
}),
2828
);

0 commit comments

Comments
 (0)