From c25a4a55797159086c1c9078f0849e5366e80f0f Mon Sep 17 00:00:00 2001 From: Joaquim Verges Date: Thu, 15 May 2025 10:32:09 +1200 Subject: [PATCH 1/2] [Engine] Update OpenAPI spec and configuration --- .changeset/shiny-olives-pay.md | 5 ++++ packages/engine/README.md | 29 ++++++++++++++++++------ packages/engine/openapi-ts.config.ts | 2 +- packages/engine/src/client/client.gen.ts | 2 +- packages/engine/src/client/types.gen.ts | 7 +++++- 5 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 .changeset/shiny-olives-pay.md diff --git a/.changeset/shiny-olives-pay.md b/.changeset/shiny-olives-pay.md new file mode 100644 index 00000000000..1d3769c1a7b --- /dev/null +++ b/.changeset/shiny-olives-pay.md @@ -0,0 +1,5 @@ +--- +"@thirdweb-dev/engine": patch +--- + +Update openAPI spec diff --git a/packages/engine/README.md b/packages/engine/README.md index 0e55b8cdbe5..1d98f90eb17 100644 --- a/packages/engine/README.md +++ b/packages/engine/README.md @@ -5,23 +5,38 @@ This package is a thin openAPI wrapper for insight, our in-house indexer. ## Configuration ```ts -import { configure } from "@thirdweb-dev/insight"; +import { configure } from "@thirdweb-dev/engine"; // call this once at the startup of your application configure({ - clientId: "", + secretKey: "", }); ``` ## Example Usage ```ts -import { getV1Events } from "@thirdweb-dev/insight"; +import { writeContract } from "@thirdweb-dev/engine"; -const events = await getV1Events({ - query: { - chain: [1, 137], - filter_address: "0x1234567890123456789012345678901234567890", +const result = await writeContract({ + headers: { + "x-vault-access-token": "", + }, + body: { + executionOptions: { + from: "0x1234567891234567891234567891234567891234", + chainId: "1", + }, + params: [ + { + contractAddress: "0x1234567891234567891234567891234567891234", + method: "function transfer(address to, uint256 amount)", + params: [ + "0x1234567891234567891234567891234567891234", + "1000000000000000000", + ], + }, + ], }, }); ``` diff --git a/packages/engine/openapi-ts.config.ts b/packages/engine/openapi-ts.config.ts index f21fc337c5c..e1873082942 100644 --- a/packages/engine/openapi-ts.config.ts +++ b/packages/engine/openapi-ts.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from "@hey-api/openapi-ts"; export default defineConfig({ - input: "http://localhost:3009/openapi", // TODO: update to prod + input: "https://engine.thirdweb.com/openapi", output: { path: "src/client", lint: "biome", format: "biome" }, plugins: ["@hey-api/client-fetch"], }); diff --git a/packages/engine/src/client/client.gen.ts b/packages/engine/src/client/client.gen.ts index a0b05b5e1c0..3dca3c31b50 100644 --- a/packages/engine/src/client/client.gen.ts +++ b/packages/engine/src/client/client.gen.ts @@ -23,6 +23,6 @@ export type CreateClientConfig = export const client = createClient( createConfig({ - baseUrl: "http://localhost:3009", + baseUrl: "https://engine.thirdweb.com", }), ); diff --git a/packages/engine/src/client/types.gen.ts b/packages/engine/src/client/types.gen.ts index 0c35fc41fca..61c6801af2a 100644 --- a/packages/engine/src/client/types.gen.ts +++ b/packages/engine/src/client/types.gen.ts @@ -144,6 +144,7 @@ export type WriteContractResponses = { transactions: Array<{ id: string; batchIndex: number; + clientId: string; chainId: string; from: string | null; transactionParams: @@ -188,6 +189,7 @@ export type WriteContractResponses = { transactions: Array<{ id: string; batchIndex: number; + clientId: string; chainId: string; from: string | null; transactionParams: @@ -273,6 +275,7 @@ export type SendTransactionResponses = { transactions: Array<{ id: string; batchIndex: number; + clientId: string; chainId: string; from: string | null; transactionParams: @@ -317,6 +320,7 @@ export type SendTransactionResponses = { transactions: Array<{ id: string; batchIndex: number; + clientId: string; chainId: string; from: string | null; transactionParams: @@ -876,6 +880,7 @@ export type SearchTransactionsResponses = { transactions: Array<{ id: string; batchIndex: number; + clientId: string; chainId: string; from: string | null; transactionParams: @@ -1013,5 +1018,5 @@ export type GetTransactionAnalyticsSummaryResponse = GetTransactionAnalyticsSummaryResponses[keyof GetTransactionAnalyticsSummaryResponses]; export type ClientOptions = { - baseUrl: "http://localhost:3009" | (string & {}); + baseUrl: "https://engine.thirdweb.com" | (string & {}); }; From 205d8850ecdc2f3a63d4bdb3001eee924decbdd7 Mon Sep 17 00:00:00 2001 From: Joaquim Verges Date: Wed, 14 May 2025 15:37:35 -0700 Subject: [PATCH 2/2] Update packages/engine/README.md Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> Signed-off-by: Joaquim Verges --- packages/engine/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/engine/README.md b/packages/engine/README.md index 1d98f90eb17..859a0cd378c 100644 --- a/packages/engine/README.md +++ b/packages/engine/README.md @@ -29,10 +29,10 @@ const result = await writeContract({ }, params: [ { - contractAddress: "0x1234567891234567891234567891234567891234", + contractAddress: "0x1234567890123456789012345678901234567890", method: "function transfer(address to, uint256 amount)", params: [ - "0x1234567891234567891234567891234567891234", + "0x1234567890123456789012345678901234567890", "1000000000000000000", ], },