Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ type ExecutionResult4337Serialized =
}
| {
status: "FAILED";
error: string;
error: {
stage: string;
message: string;
errorCode: string;
inner_error: object;
nonce_used: string;
account_address: string;
};
}
| {
status: "SUBMITTED";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ export function TransactionDetailsUI({
const status = executionResult?.status as keyof typeof statusDetails;
const errorMessage =
executionResult && "error" in executionResult
? executionResult.error
? executionResult.error.message
: executionResult && "revertData" in executionResult
? executionResult.revertData?.revertReason
: null;
const errorDetails =
executionResult && "error" in executionResult
? executionResult.error
: undefined;

const chain = chainId ? idToChain.get(Number.parseInt(chainId)) : undefined;
const explorer = chain?.explorers?.[0];
Expand Down Expand Up @@ -244,9 +248,16 @@ export function TransactionDetailsUI({
</CardTitle>
</CardHeader>
<CardContent>
<div className="rounded-md bg-destructive/10 p-4 text-destructive">
{errorMessage}
</div>
{errorDetails ? (
<CodeClient
code={JSON.stringify(errorDetails, null, 2)}
lang="json"
/>
) : (
<div className="rounded-md bg-destructive/10 p-4 text-destructive">
errorMessage
</div>
)}
</CardContent>
</Card>
)}
Expand Down
7 changes: 4 additions & 3 deletions packages/engine/openapi-ts.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { defineConfig } from "@hey-api/openapi-ts";

export default defineConfig({
input: "https://engine.thirdweb.com/openapi",
output: { format: "biome", lint: "biome", path: "src/client" },
plugins: ["@hey-api/client-fetch"],
// input: "https://engine.thirdweb.com/openapi",
input: "http://localhost:3009/openapi",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider environment-based configuration for API endpoints.

Hardcoding localhost URLs in configuration files can lead to issues if accidentally deployed to production. Consider using environment variables to dynamically set the input URL based on the deployment environment.

-	// input: "https://engine.thirdweb.com/openapi",
-	input: "http://localhost:3009/openapi",
+	input: process.env.OPENAPI_INPUT_URL || "https://engine.thirdweb.com/openapi",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// input: "https://engine.thirdweb.com/openapi",
input: "http://localhost:3009/openapi",
input: process.env.OPENAPI_INPUT_URL || "https://engine.thirdweb.com/openapi",
🤖 Prompt for AI Agents
In packages/engine/openapi-ts.config.ts around lines 4 to 5, the input URL is
hardcoded to localhost, which risks incorrect URLs in different environments.
Replace the hardcoded URL with a dynamic value sourced from environment
variables, such as process.env.API_BASE_URL, and provide a fallback if needed.
This ensures the input URL adapts based on the deployment environment and avoids
accidental production misconfigurations.

output: { format: "biome", lint: "biome", path: "src/client" },
plugins: ["@hey-api/client-fetch"],
});
62 changes: 31 additions & 31 deletions packages/engine/package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
{
"name": "@thirdweb-dev/engine",
"version": "3.0.3",
"repository": {
"type": "git",
"url": "git+https://github.com/thirdweb-dev/js.git#main"
},
"license": "Apache-2.0",
"author": "thirdweb eng <[email protected]>",
"bugs": {
"url": "https://github.com/thirdweb-dev/js/issues"
},
"author": "thirdweb eng <[email protected]>",
"type": "module",
"main": "./dist/cjs/exports/thirdweb.js",
"module": "./dist/esm/exports/thirdweb.js",
"types": "./dist/types/exports/thirdweb.d.ts",
"typings": "./dist/types/exports/thirdweb.d.ts",
"dependencies": {
"@hey-api/client-fetch": "0.10.0"
},
"devDependencies": {
"@biomejs/biome": "2.0.4",
"@hey-api/openapi-ts": "0.72.1",
"rimraf": "6.0.1",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=18"
},
"exports": {
".": {
"types": "./dist/types/exports/thirdweb.d.ts",
"default": "./dist/cjs/exports/thirdweb.js",
"import": "./dist/esm/exports/thirdweb.js",
"default": "./dist/cjs/exports/thirdweb.js"
"types": "./dist/types/exports/thirdweb.d.ts"
},
"./package.json": "./package.json"
},
"files": [
"dist/*",
"src/*"
],
"dependencies": {
"@hey-api/client-fetch": "0.10.0"
},
"devDependencies": {
"@biomejs/biome": "2.0.4",
"@hey-api/openapi-ts": "0.72.1",
"rimraf": "6.0.1",
"tslib": "^2.8.1"
},
"license": "Apache-2.0",
"main": "./dist/cjs/exports/thirdweb.js",
"module": "./dist/esm/exports/thirdweb.js",
"name": "@thirdweb-dev/engine",
"peerDependencies": {
"typescript": ">=5.0.4"
},
Expand All @@ -44,18 +39,23 @@
"optional": true
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/thirdweb-dev/js.git#main"
},
"scripts": {
"format": "biome format ./src --write",
"lint": "biome check ./src",
"fix": "biome check ./src --fix",
"build": "pnpm clean && pnpm build:cjs && pnpm build:esm && pnpm build:types",
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json",
"build:esm": "tsc --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",
"build:generate": "openapi-ts && pnpm format",
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
"clean": "rimraf dist",
"build:generate": "openapi-ts && pnpm format"
"fix": "biome check ./src --fix",
"format": "biome format ./src --write",
"lint": "biome check ./src"
},
"engines": {
"node": ">=18"
}
"type": "module",
"types": "./dist/types/exports/thirdweb.d.ts",
"typings": "./dist/types/exports/thirdweb.d.ts",
"version": "3.0.3"
}
20 changes: 10 additions & 10 deletions packages/engine/src/client/client.gen.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// This file is auto-generated by @hey-api/openapi-ts

import {
type Config,
createClient,
createConfig,
type ClientOptions as DefaultClientOptions,
type Config,
createClient,
createConfig,
type ClientOptions as DefaultClientOptions,
} from "@hey-api/client-fetch";
import type { ClientOptions } from "./types.gen.js";

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

export const client = createClient(
createConfig<ClientOptions>({
baseUrl: "https://engine.thirdweb.com",
}),
createConfig<ClientOptions>({
baseUrl: "http://localhost:3009",
}),
);
Loading
Loading