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
5 changes: 5 additions & 0 deletions .changeset/shiny-olives-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/engine": patch
---

Update openAPI spec
29 changes: 22 additions & 7 deletions packages/engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: "<YOUR_CLIENT_ID>",
secretKey: "<PROJECT_SECRET_KEY>",
});
```

## 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": "<VAULT_ACCESS_TOKEN>",
},
body: {
executionOptions: {
from: "0x1234567891234567891234567891234567891234",
chainId: "1",
},
params: [
{
contractAddress: "0x1234567891234567891234567891234567891234",
method: "function transfer(address to, uint256 amount)",
params: [
"0x1234567891234567891234567891234567891234",
"1000000000000000000",
],
},
],
},
});
```
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/openapi-ts.config.ts
Original file line number Diff line number Diff line change
@@ -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"],
});
2 changes: 1 addition & 1 deletion packages/engine/src/client/client.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =

export const client = createClient(
createConfig<ClientOptions>({
baseUrl: "http://localhost:3009",
baseUrl: "https://engine.thirdweb.com",
}),
);
7 changes: 6 additions & 1 deletion packages/engine/src/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export type WriteContractResponses = {
transactions: Array<{
id: string;
batchIndex: number;
clientId: string;
chainId: string;
from: string | null;
transactionParams:
Expand Down Expand Up @@ -188,6 +189,7 @@ export type WriteContractResponses = {
transactions: Array<{
id: string;
batchIndex: number;
clientId: string;
chainId: string;
from: string | null;
transactionParams:
Expand Down Expand Up @@ -273,6 +275,7 @@ export type SendTransactionResponses = {
transactions: Array<{
id: string;
batchIndex: number;
clientId: string;
chainId: string;
from: string | null;
transactionParams:
Expand Down Expand Up @@ -317,6 +320,7 @@ export type SendTransactionResponses = {
transactions: Array<{
id: string;
batchIndex: number;
clientId: string;
chainId: string;
from: string | null;
transactionParams:
Expand Down Expand Up @@ -876,6 +880,7 @@ export type SearchTransactionsResponses = {
transactions: Array<{
id: string;
batchIndex: number;
clientId: string;
chainId: string;
from: string | null;
transactionParams:
Expand Down Expand Up @@ -1013,5 +1018,5 @@ export type GetTransactionAnalyticsSummaryResponse =
GetTransactionAnalyticsSummaryResponses[keyof GetTransactionAnalyticsSummaryResponses];

export type ClientOptions = {
baseUrl: "http://localhost:3009" | (string & {});
baseUrl: "https://engine.thirdweb.com" | (string & {});
};
Loading