From 22d736cb249e699efbc2a3da4bca5fb5a2332fe0 Mon Sep 17 00:00:00 2001 From: Firekeeper <0xFirekeeper@gmail.com> Date: Fri, 5 Sep 2025 08:09:24 +0700 Subject: [PATCH] Refactor wallet user API integration to use tw api (#7987) --- apps/dashboard/knip.json | 1 + apps/dashboard/package.json | 1 + .../searchUsers.ts | 169 +- apps/dashboard/src/@/constants/urls.ts | 5 +- .../src/@/hooks/useEmbeddedWallets.ts | 143 +- packages/api/src/client/sdk.gen.ts | 1308 ++-- packages/api/src/client/types.gen.ts | 5459 ++++++++++------- pnpm-lock.yaml | 7 +- 8 files changed, 4390 insertions(+), 2703 deletions(-) diff --git a/apps/dashboard/knip.json b/apps/dashboard/knip.json index 0daf302b2..03076122b 100644 --- a/apps/dashboard/knip.json +++ b/apps/dashboard/knip.json @@ -8,6 +8,7 @@ ], "ignoreBinaries": ["only-allow"], "ignoreDependencies": [ + "@thirdweb-dev/api", "@thirdweb-dev/service-utils", "@thirdweb-dev/vault-sdk", "thirdweb", diff --git a/apps/dashboard/package.json b/apps/dashboard/package.json index 17484f661..d8e299df3 100644 --- a/apps/dashboard/package.json +++ b/apps/dashboard/package.json @@ -23,6 +23,7 @@ "@shazow/whatsabi": "0.22.2", "@tanstack/react-query": "5.81.5", "@tanstack/react-table": "^8.21.3", + "@thirdweb-dev/api": "workspace:*", "@thirdweb-dev/service-utils": "workspace:*", "@thirdweb-dev/vault-sdk": "workspace:*", "@vercel/functions": "2.2.2", diff --git a/apps/dashboard/src/@/components/in-app-wallet-users-content/searchUsers.ts b/apps/dashboard/src/@/components/in-app-wallet-users-content/searchUsers.ts index b772bab0c..36fe6882b 100644 --- a/apps/dashboard/src/@/components/in-app-wallet-users-content/searchUsers.ts +++ b/apps/dashboard/src/@/components/in-app-wallet-users-content/searchUsers.ts @@ -1,7 +1,79 @@ +import type { + ListUserWalletsData, + ListUserWalletsResponses, +} from "@thirdweb-dev/api"; +import { configure, listUserWallets } from "@thirdweb-dev/api"; import type { WalletUser } from "thirdweb/wallets"; -import { THIRDWEB_EWS_API_HOST } from "@/constants/urls"; +import { THIRDWEB_API_HOST } from "@/constants/urls"; import type { SearchType } from "./types"; +// Configure the API client to use the correct base URL +configure({ + override: { + baseUrl: THIRDWEB_API_HOST, + }, +}); + +// Extract types from the generated API +type APIWallet = ListUserWalletsResponses[200]["result"]["wallets"][0]; +type APIProfile = APIWallet["profiles"][0]; + +// Transform API response to match existing WalletUser format +function transformToWalletUser(apiWallet: APIWallet): WalletUser { + return { + id: getProfileId(apiWallet.profiles[0]) || "", + linkedAccounts: apiWallet.profiles.map((profile) => { + // Create details object based on the profile data + let details: + | { email: string; [key: string]: string } + | { phone: string; [key: string]: string } + | { address: string; [key: string]: string } + | { id: string; [key: string]: string }; + + const profileId = getProfileId(profile); + + if ("email" in profile && profile.email) { + details = { email: profile.email, id: profileId }; + } else if ("phone" in profile && profile.phone) { + details = { phone: profile.phone, id: profileId }; + } else if ("walletAddress" in profile && profile.walletAddress) { + details = { address: profile.walletAddress, id: profileId }; + } else { + details = { id: profileId }; + } + + return { + type: profile.type, + details, + }; + }), + wallets: apiWallet.address + ? [ + { + address: apiWallet.address, + createdAt: apiWallet.createdAt || new Date().toISOString(), + type: "enclave" as const, + }, + ] + : [], + }; +} + +// Helper function to safely get ID from any profile type +function getProfileId(profile: APIProfile | undefined): string { + if (!profile) return ""; + + if ("id" in profile) { + return profile.id; + } else if ("credentialId" in profile) { + return profile.credentialId; + } else if ("identifier" in profile) { + return profile.identifier; + } + + return ""; +} + export async function searchUsers( authToken: string, clientId: string | undefined, @@ -10,50 +82,57 @@ export async function searchUsers( searchType: SearchType, query: string, ): Promise { - const url = new URL(`${THIRDWEB_EWS_API_HOST}/api/2024-05-05/account/list`); + try { + // Prepare query parameters + const queryParams: ListUserWalletsData["query"] = { + limit: 50, + }; - // Add clientId or ecosystemSlug parameter - if (ecosystemSlug) { - url.searchParams.append("ecosystemSlug", `ecosystem.${ecosystemSlug}`); - } else if (clientId) { - url.searchParams.append("clientId", clientId); + // Add search parameter based on search type + switch (searchType) { + case "email": + queryParams.email = query; + break; + case "phone": + queryParams.phone = query; + break; + case "id": + queryParams.id = query; + break; + case "address": + queryParams.address = query; + break; + case "externalWallet": + queryParams.externalWalletAddress = query; + break; + } + + // Use the generated API function with Bearer authentication + const response = await listUserWallets({ + query: queryParams, + headers: { + Authorization: `Bearer ${authToken}`, + "Content-Type": "application/json", + "x-thirdweb-team-id": teamId, + ...(clientId && { "x-client-id": clientId }), + ...(ecosystemSlug && { + "x-ecosystem-id": `ecosystem.${ecosystemSlug}`, + }), + }, + }); + + // Handle response + if (response.error || !response.data) { + console.error( + "Error searching users:", + response.error || "No data returned", + ); + return []; + } + + return response.data.result.wallets.map(transformToWalletUser); + } catch (error) { + console.error("Error searching users:", error); + return []; } - - // Add search parameter based on search type - switch (searchType) { - case "email": - url.searchParams.append("email", query); - break; - case "phone": - url.searchParams.append("phone", query); - break; - case "id": - url.searchParams.append("id", query); - break; - case "address": - url.searchParams.append("address", query); - break; - case "externalWallet": - url.searchParams.append("externalWalletAddress", query); - break; - } - - const response = await fetch(url.toString(), { - headers: { - Authorization: `Bearer ${authToken}`, - "Content-Type": "application/json", - "x-thirdweb-team-id": teamId, - ...(clientId && { "x-client-id": clientId }), - }, - method: "GET", - }); - - if (!response.ok) { - throw new Error( - `Failed to search users: ${response.status} ${response.statusText}`, - ); - } - - const data = await response.json(); - return data.users as WalletUser[]; } diff --git a/apps/dashboard/src/@/constants/urls.ts b/apps/dashboard/src/@/constants/urls.ts index de4529096..fc30a7f78 100644 --- a/apps/dashboard/src/@/constants/urls.ts +++ b/apps/dashboard/src/@/constants/urls.ts @@ -1,6 +1,5 @@ -export const THIRDWEB_EWS_API_HOST = - process.env.NEXT_PUBLIC_THIRDWEB_EWS_API_HOST || - "https://in-app-wallet.thirdweb.com"; +export const THIRDWEB_API_HOST = + process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb-dev.com"; export const THIRDWEB_PAY_DOMAIN = process.env.NEXT_PUBLIC_PAY_URL || "pay.thirdweb-dev.com"; diff --git a/apps/dashboard/src/@/hooks/useEmbeddedWallets.ts b/apps/dashboard/src/@/hooks/useEmbeddedWallets.ts index 2a5bf9ad1..1ca70f938 100644 --- a/apps/dashboard/src/@/hooks/useEmbeddedWallets.ts +++ b/apps/dashboard/src/@/hooks/useEmbeddedWallets.ts @@ -1,9 +1,25 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; +import type { + ListUserWalletsData, + ListUserWalletsResponses, +} from "@thirdweb-dev/api"; +import { configure, listUserWallets } from "@thirdweb-dev/api"; import { useActiveAccount } from "thirdweb/react"; import type { WalletUser } from "thirdweb/wallets"; -import { THIRDWEB_EWS_API_HOST } from "@/constants/urls"; +import { THIRDWEB_API_HOST } from "@/constants/urls"; import { embeddedWalletsKeys } from "../query-keys/cache-keys"; +// Configure the API client to use the correct base URL +configure({ + override: { + baseUrl: THIRDWEB_API_HOST, + }, +}); + +// Extract types from the generated API +type APIWallet = ListUserWalletsResponses[200]["result"]["wallets"][0]; +type APIProfile = APIWallet["profiles"][0]; + const fetchAccountList = ({ jwt, clientId, @@ -18,37 +34,104 @@ const fetchAccountList = ({ pageNumber: number; }) => { return async () => { - const url = new URL(`${THIRDWEB_EWS_API_HOST}/api/2024-05-05/account/list`); + try { + // Prepare query parameters for the new API + const queryParams: ListUserWalletsData["query"] = { + page: pageNumber, + limit: 50, // Keep the same page size + }; - // Add clientId or ecosystemSlug parameter - if (ecosystemSlug) { - url.searchParams.append("ecosystemSlug", `ecosystem.${ecosystemSlug}`); - } else if (clientId) { - url.searchParams.append("clientId", clientId); + // Use the generated API function with Bearer authentication + const response = await listUserWallets({ + query: queryParams, + headers: { + Authorization: `Bearer ${jwt}`, + "Content-Type": "application/json", + "x-thirdweb-team-id": teamId, + ...(clientId && { "x-client-id": clientId }), + ...(ecosystemSlug && { + "x-ecosystem-id": `ecosystem.${ecosystemSlug}`, + }), + }, + }); + + // Handle response + if (response.error || !response.data) { + const errorMessage = + typeof response.error === "string" + ? response.error + : "No data returned"; + throw new Error(errorMessage); + } + + // Transform the response to match the expected format + return { + users: response.data.result.wallets.map(transformToWalletUser), + hasMore: response.data.result.pagination.hasMore ?? false, + }; + } catch (error) { + console.error("Failed to fetch wallets:", error); + throw error; } - - url.searchParams.append("page", pageNumber.toString()); - - const res = await fetch(url.href, { - headers: { - Authorization: `Bearer ${jwt}`, - "Content-Type": "application/json", - "x-thirdweb-team-id": teamId, - ...(clientId && { "x-client-id": clientId }), - }, - method: "GET", - }); - if (!res.ok) { - throw new Error(`Failed to fetch wallets: ${await res.text()}`); - } - - const json = await res.json(); - return json as { - users: WalletUser[]; - }; }; }; +// Transform API response to match existing WalletUser format +function transformToWalletUser(apiWallet: APIWallet): WalletUser { + return { + id: getProfileId(apiWallet.profiles[0]) || "", + linkedAccounts: apiWallet.profiles.map((profile) => { + // Create details object based on the profile data + let details: + | { email: string; [key: string]: string } + | { phone: string; [key: string]: string } + | { address: string; [key: string]: string } + | { id: string; [key: string]: string }; + + const profileId = getProfileId(profile); + + if ("email" in profile && profile.email) { + details = { email: profile.email, id: profileId }; + } else if ("phone" in profile && profile.phone) { + details = { phone: profile.phone, id: profileId }; + } else if ("walletAddress" in profile && profile.walletAddress) { + details = { address: profile.walletAddress, id: profileId }; + } else { + details = { id: profileId }; + } + + return { + type: profile.type, + details, + }; + }), + wallets: apiWallet.address + ? [ + { + address: apiWallet.address, + createdAt: apiWallet.createdAt || new Date().toISOString(), + type: "enclave" as const, + }, + ] + : [], + }; +} + +// Helper function to safely get ID from any profile type +function getProfileId(profile: APIProfile | undefined): string { + if (!profile) return ""; + + if ("id" in profile) { + return profile.id; + } else if ("credentialId" in profile) { + return profile.credentialId; + } else if ("identifier" in profile) { + return profile.identifier; + } + + return ""; +} + export function useEmbeddedWallets(params: { clientId?: string; ecosystemSlug?: string; @@ -98,6 +181,7 @@ export function useAllEmbeddedWallets(params: { authToken: string }) { while (true) { const res = await queryClient.fetchQuery<{ users: WalletUser[]; + hasMore: boolean; }>({ queryFn: fetchAccountList({ clientId, @@ -113,12 +197,13 @@ export function useAllEmbeddedWallets(params: { authToken: string }) { ), }); - if (res.users.length === 0) { + responses.push(...res.users); + + if (!res.hasMore) { break; } page++; - responses.push(...res.users); } return responses; diff --git a/packages/api/src/client/sdk.gen.ts b/packages/api/src/client/sdk.gen.ts index 3babdae46..ae0575b85 100644 --- a/packages/api/src/client/sdk.gen.ts +++ b/packages/api/src/client/sdk.gen.ts @@ -7,36 +7,56 @@ import type { } from "./client/index.js"; import { client as _heyApiClient } from "./client.gen.js"; import type { - BuyTokenWithUsdData, - BuyTokenWithUsdErrors, - BuyTokenWithUsdResponses, - CreateWalletData, - CreateWalletErrors, - CreateWalletResponses, + BridgeSwapData, + BridgeSwapErrors, + BridgeSwapResponses, + ChatData, + ChatResponses, + CompleteAuthenticationData, + CompleteAuthenticationErrors, + CompleteAuthenticationResponses, + CreatePaymentData, + CreatePaymentErrors, + CreatePaymentResponses, + CreateServerWalletData, + CreateServerWalletErrors, + CreateServerWalletResponses, + CreateTokenData, + CreateTokenErrors, + CreateTokenResponses, + CreateUserWalletData, + CreateUserWalletErrors, + CreateUserWalletResponses, DeployContractData, DeployContractErrors, DeployContractResponses, - GeneratePasskeyChallengeData, - GeneratePasskeyChallengeErrors, - GeneratePasskeyChallengeResponses, - GenerateSiwePayloadData, - GenerateSiwePayloadErrors, - GenerateSiwePayloadResponses, GetContractEventsData, GetContractEventsErrors, GetContractEventsResponses, + GetContractMetadataData, + GetContractMetadataErrors, + GetContractMetadataResponses, + GetContractSignaturesData, + GetContractSignaturesErrors, + GetContractSignaturesResponses, GetContractTransactionsData, GetContractTransactionsErrors, GetContractTransactionsResponses, + GetMyWalletData, + GetMyWalletErrors, + GetMyWalletResponses, + GetPaymentHistoryData, + GetPaymentHistoryErrors, + GetPaymentHistoryResponses, + GetTokenOwnersData, + GetTokenOwnersErrors, + GetTokenOwnersResponses, GetTransactionByIdData, GetTransactionByIdErrors, GetTransactionByIdResponses, GetWalletBalanceData, GetWalletBalanceErrors, GetWalletBalanceResponses, - GetWalletDetailsData, - GetWalletDetailsErrors, - GetWalletDetailsResponses, GetWalletNftsData, GetWalletNftsErrors, GetWalletNftsResponses, @@ -46,26 +66,37 @@ import type { GetWalletTransactionsData, GetWalletTransactionsErrors, GetWalletTransactionsResponses, - InitOauthData, - InitOauthErrors, + InitiateAuthenticationData, + InitiateAuthenticationErrors, + InitiateAuthenticationResponses, ListContractsData, ListContractsErrors, ListContractsResponses, + ListServerWalletsData, + ListServerWalletsErrors, + ListServerWalletsResponses, + ListTokensData, + ListTokensErrors, + ListTokensResponses, ListTransactionsData, ListTransactionsErrors, ListTransactionsResponses, - ListWalletsData, - ListWalletsErrors, - ListWalletsResponses, + ListUserWalletsData, + ListUserWalletsErrors, + ListUserWalletsResponses, + LlmsTxtData, + LlmsTxtResponses, + McpServerData, + McpServerResponses, + PaymentsPurchaseData, + PaymentsPurchaseErrors, + PaymentsPurchaseResponses, ReadContractData, ReadContractErrors, ReadContractResponses, - SellTokenForUsdData, - SellTokenForUsdErrors, - SellTokenForUsdResponses, - SendCodeData, - SendCodeErrors, - SendCodeResponses, + SendTokensData, + SendTokensErrors, + SendTokensResponses, SendTransactionsData, SendTransactionsErrors, SendTransactionsResponses, @@ -75,18 +106,8 @@ import type { SignTypedDataData, SignTypedDataErrors, SignTypedDataResponses, - TransferTokenWithUsdData, - TransferTokenWithUsdErrors, - TransferTokenWithUsdResponses, - VerifyCodeData, - VerifyCodeErrors, - VerifyCodeResponses, - VerifyPasskeyData, - VerifyPasskeyErrors, - VerifyPasskeyResponses, - VerifySiweSignatureData, - VerifySiweSignatureErrors, - VerifySiweSignatureResponses, + SocialAuthenticationData, + SocialAuthenticationErrors, WriteContractData, WriteContractErrors, WriteContractResponses, @@ -110,54 +131,37 @@ export type Options< }; /** - * List Contracts - * Retrieves a list of all smart contracts imported by the authenticated client on the thirdweb dashboard. This endpoint provides access to contracts that have been added to your dashboard for management and interaction. Results include contract metadata, deployment information, and import timestamps. + * Initiate Auth + * Start any authentication flow in one unified endpoint. This endpoint supports all authentication methods including SMS, email, OAuth, passkey, and SIWE (Sign-In with Ethereum). * - * **Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + * **Supported Methods:** + * - **SMS** - Send verification code to phone number + * - **Email** - Send verification code to email address + * - **OAuth** - ⚠️ **DEPRECATED**: Use `/auth/social` instead for OAuth flows + * - **Passkey** - Generate WebAuthn challenge for biometric authentication + * - **SIWE** - Generate Sign-In with Ethereum payload * - * **ABI Enrichment**: When `includeAbi=true`, the endpoint will fetch the contract ABI (Application Binary Interface) from the thirdweb contract service for each contract. The ABI contains function signatures, event definitions, and interface specifications required for contract interaction. + * **OAuth Migration:** + * The OAuth method in this endpoint is deprecated. Please use the new `/auth/social` endpoint instead: + * - **Old**: `POST /auth/initiate` with `{"method": "oauth", "provider": "google", "redirectUrl": "..."}` + * - **New**: `GET /auth/social?provider=google&redirectUrl=...` * - * **Metadata Enrichment**: When `includeMetadata=true`, the endpoint will fetch additional metadata from the thirdweb contract metadata service for each contract. This includes information like contract name, description, compilation details, and more. The metadata is returned in an optional `metadata` object within each contract. + * **Flow:** + * 1. Choose your authentication method + * 2. Provide method-specific parameters + * 3. Receive challenge data to complete authentication + * 4. Use the /complete endpoint to finish the process + * + * NOTE: for custom authentication (JWT, auth-payload) and for guest authentication, you can skip this step and use the `/complete` endpoint directly. + * + * **Authentication:** Requires `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ -export const listContracts = ( - options?: Options, -) => { - return (options?.client ?? _heyApiClient).get< - ListContractsResponses, - ListContractsErrors, - ThrowOnError - >({ - security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, - ], - url: "/v1/contracts", - ...options, - }); -}; - -/** - * Deploy Contract - * Deploy a new smart contract to a blockchain network. This endpoint allows you to deploy contracts by providing the contract source URL, target chain, constructor parameters, and optional salt for deterministic deployment. - * - * **Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. - */ -export const deployContract = ( - options?: Options, +export const initiateAuthentication = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - DeployContractResponses, - DeployContractErrors, + InitiateAuthenticationResponses, + InitiateAuthenticationErrors, ThrowOnError >({ security: [ @@ -165,16 +169,8 @@ export const deployContract = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], - url: "/v1/contracts", + url: "/v1/auth/initiate", ...options, headers: { "Content-Type": "application/json", @@ -184,17 +180,46 @@ export const deployContract = ( }; /** - * Read Contract Methods - * Executes multiple read-only contract method calls in a single batch request. This endpoint allows efficient batch reading from multiple contracts on the same chain, significantly reducing the number of HTTP requests needed. Each call specifies the contract address, method signature, and optional parameters. Results are returned in the same order as the input calls, with individual success/failure status for each operation. + * Complete Auth + * Complete the authentication flow and receive your wallet credentials. After initiating authentication, use this endpoint to submit the required verification data. * - * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + * **Completion Methods:** + * - **SMS/Email** - Submit the verification code you received + * - **Passkey** - Provide the WebAuthn signature response + * - **SIWE** - Submit your signed Ethereum message + * - **Guest** - Create an ephemeral guest wallet + * - **Custom (JWT, auth-payload)** - Send your JWT token or custom payload + * + * **Response:** + * - `isNewUser` - Whether this is a new wallet creation + * - `token` - JWT token for authenticated API requests + * - `type` - The authentication method used + * - `walletAddress` - Your new or existing wallet address + * + * **Next step - Verify your token:** + * ```javascript + * // Verify the token and get complete wallet details (server-side) + * fetch('/v1/wallets/me', { + * headers: { + * 'Authorization': 'Bearer ' + token, + * 'x-secret-key': 'your-secret-key' + * } + * }) + * .then(response => response.json()) + * .then(data => { + * console.log('Wallet verified:', data.result.address); + * console.log('Auth profiles:', data.result.profiles); + * }); + * ``` + * + * **Authentication:** Requires `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ -export const readContract = ( - options?: Options, +export const completeAuthentication = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - ReadContractResponses, - ReadContractErrors, + CompleteAuthenticationResponses, + CompleteAuthenticationErrors, ThrowOnError >({ security: [ @@ -202,16 +227,8 @@ export const readContract = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], - url: "/v1/contracts/read", + url: "/v1/auth/complete", ...options, headers: { "Content-Type": "application/json", @@ -221,168 +238,161 @@ export const readContract = ( }; /** - * Get Contract Transactions - * Retrieves transactions for a specific smart contract address across one or more blockchain networks. This endpoint provides comprehensive transaction data including block information, gas details, transaction status, and function calls. Results can be filtered, paginated, and sorted to meet specific requirements. + * Social Auth + * Complete OAuth authentication with social providers in a single step. Unlike other auth methods that require separate initiate/complete calls, OAuth is handled entirely through redirects. * - * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + * **OAuth Flow (Self-Contained):** + * 1. Redirect your user to this endpoint with provider and redirectUrl + * 2. User completes OAuth flow with the provider + * 3. User is redirected back to your redirectUrl with wallet credentials + * + * **Why OAuth is different:** OAuth providers handle the challenge/response flow externally, so no separate `/complete` step is needed. + * + * **Example:** + * Redirect user to: `GET /v1/auth/social?provider=google&redirectUrl=https://myapp.com/auth/callback` + * + * **Callback Handling:** + * After OAuth completion, user arrives at your redirectUrl with an `authResult` query parameter: + * ``` + * https://myapp.com/auth/callback?authResult=%7B%22storedToken%22%3A%7B%22authDetails%22%3A%7B...%7D%2C%22cookieString%22%3A%22eyJ...%22%7D%7D + * ``` + * + * **Extract JWT token in your callback:** + * ```javascript + * // Parse the authResult from URL + * const urlParams = new URLSearchParams(window.location.search); + * const authResultString = urlParams.get('authResult'); + * const authResult = JSON.parse(authResultString!); + * + * // Extract the JWT token + * const token = authResult.storedToken.cookieString; + * ``` + * + * **Verify and use the JWT token:** + * ```javascript + * // Use the JWT token for authenticated requests + * fetch('/v1/wallets/me', { + * headers: { + * 'Authorization': 'Bearer ' + token, + * 'x-secret-key': 'your-secret-key' + * } + * }) + * .then(response => response.json()) + * .then(data => { + * console.log('Wallet verified:', data.result.address); + * console.log('Auth profiles:', data.result.profiles); + * }); + * ``` + * + * **Authentication Options:** + * Choose one of two ways to provide your client credentials: + * + * **Option 1: Query Parameter (Recommended for OAuth flows)** + * ``` + * GET /v1/auth/social?provider=google&redirectUrl=https://myapp.com/callback&clientId=your_client_id + * ``` + * + * **Option 2: Header (Alternative)** + * ``` + * GET /v1/auth/social?provider=google&redirectUrl=https://myapp.com/callback + * Headers: x-client-id: your_client_id + * ``` */ -export const getContractTransactions = ( - options: Options, +export const socialAuthentication = ( + options: Options, ) => { return (options.client ?? _heyApiClient).get< - GetContractTransactionsResponses, - GetContractTransactionsErrors, + unknown, + SocialAuthenticationErrors, ThrowOnError >({ - security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, - ], - url: "/v1/contracts/{address}/transactions", + url: "/v1/auth/social", ...options, }); }; /** - * Get Contract Events - * Retrieves events emitted by a specific smart contract address across one or more blockchain networks. This endpoint provides comprehensive event data including block information, transaction details, event topics, and optional ABI decoding. Results can be filtered, paginated, and sorted to meet specific requirements. + * Get My Wallet + * Retrieve the authenticated user's wallet information including wallet addresses and linked authentication wallets. This endpoint provides comprehensive user data for the currently authenticated session. * - * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. - */ -export const getContractEvents = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).get< - GetContractEventsResponses, - GetContractEventsErrors, - ThrowOnError - >({ - security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, - ], - url: "/v1/contracts/{address}/events", - ...options, - }); -}; - -/** - * Write Contract Methods - * Executes write operations (transactions) on smart contracts. This is a convenience endpoint that simplifies contract interaction by accepting method signatures and parameters directly, without requiring manual transaction encoding. All calls are executed against the same contract address and chain, making it ideal for batch operations. + * **Returns:** + * - Primary wallet address + * - Smart wallet address (if available) + * - Wallet creation timestamp + * - Public key in hexadecimal format (if available) + * - All linked authentication profiles (email, phone, OAuth providers) * - * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. + * **Authentication:** Requires `Authorization: Bearer ` header with a valid user authentication token. */ -export const writeContract = ( - options?: Options, +export const getMyWallet = ( + options?: Options, ) => { - return (options?.client ?? _heyApiClient).post< - WriteContractResponses, - WriteContractErrors, + return (options?.client ?? _heyApiClient).get< + GetMyWalletResponses, + GetMyWalletErrors, ThrowOnError >({ security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, { scheme: "bearer", type: "http", }, + { + name: "x-client-id", + type: "apiKey", + }, ], - url: "/v1/contracts/write", + url: "/v1/wallets/me", ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, }); }; /** - * List Wallets - * Get all wallet details with pagination for your project. + * List User Wallets + * Get all user wallet details with filtering and pagination for your project. * * **Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. */ -export const listWallets = ( - options?: Options, +export const listUserWallets = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).get< - ListWalletsResponses, - ListWalletsErrors, + ListUserWalletsResponses, + ListUserWalletsErrors, ThrowOnError >({ security: [ - { - name: "x-client-id", - type: "apiKey", - }, { name: "x-secret-key", type: "apiKey", }, - { - scheme: "bearer", - type: "http", - }, ], - url: "/v1/wallets", + url: "/v1/wallets/user", ...options, }); }; /** - * Create Wallet - * Creates a server wallet from a unique identifier. If the wallet already exists, it will return the existing wallet. Requires project authentication with `x-secret-key` header. + * Create User Wallet + * Create a user wallet with a wallet based on their authentication strategy. This endpoint creates a wallet in advance that can be claimed later when the user authenticates. + * + * **Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. */ -export const createWallet = ( - options?: Options, +export const createUserWallet = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - CreateWalletResponses, - CreateWalletErrors, + CreateUserWalletResponses, + CreateUserWalletErrors, ThrowOnError >({ security: [ - { - name: "x-client-id", - type: "apiKey", - }, { name: "x-secret-key", type: "apiKey", }, - { - scheme: "bearer", - type: "http", - }, ], - url: "/v1/wallets", + url: "/v1/wallets/user", ...options, headers: { "Content-Type": "application/json", @@ -392,8 +402,62 @@ export const createWallet = ( }; /** - * Get Wallet Native Balance - * Get native token balance for a wallet address across multiple blockchain networks. This endpoint retrieves native token balances (ETH, MATIC, BNB, etc.) for a given wallet address on multiple chains simultaneously, making it efficient for cross-chain native balance checking. + * List Server Wallets + * Get all server wallet details with pagination for your project. + * + * **Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + */ +export const listServerWallets = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).get< + ListServerWalletsResponses, + ListServerWalletsErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/wallets/server", + ...options, + }); +}; + +/** + * Create Server Wallet + * Creates a server wallet from a unique identifier. If the wallet already exists, it will return the existing wallet. + * + * **Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + */ +export const createServerWallet = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + CreateServerWalletResponses, + CreateServerWalletErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/wallets/server", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Get Balance + * Get native or ERC20 token balance for a wallet address. Can retrieve live balances for any ERC20 token on a signle chain, or native token balances across multiple chains. * * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. */ @@ -410,14 +474,6 @@ export const getWalletBalance = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], url: "/v1/wallets/{address}/balance", ...options, @@ -425,7 +481,7 @@ export const getWalletBalance = ( }; /** - * Get Wallet Transactions + * Get Transactions * Retrieves transactions for a specific wallet address across one or more blockchain networks. This endpoint provides comprehensive transaction data including both incoming and outgoing transactions, with block information, gas details, transaction status, and function calls. Results can be filtered, paginated, and sorted to meet specific requirements. * * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. @@ -443,14 +499,6 @@ export const getWalletTransactions = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], url: "/v1/wallets/{address}/transactions", ...options, @@ -458,7 +506,7 @@ export const getWalletTransactions = ( }; /** - * Get Wallet Tokens + * Get Tokens * Retrieves token balances for a specific wallet address across one or more blockchain networks. This endpoint provides comprehensive token data including ERC-20 tokens with their balances, metadata, and price information. Results can be filtered by chain and paginated to meet specific requirements. * * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. @@ -476,14 +524,6 @@ export const getWalletTokens = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], url: "/v1/wallets/{address}/tokens", ...options, @@ -491,7 +531,7 @@ export const getWalletTokens = ( }; /** - * Get Wallet NFTs + * Get NFTs * Retrieves NFTs for a specific wallet address across one or more blockchain networks. This endpoint provides comprehensive NFT data including metadata, attributes, and collection information. Results can be filtered by chain and paginated to meet specific requirements. * * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. @@ -509,14 +549,6 @@ export const getWalletNfts = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], url: "/v1/wallets/{address}/nfts", ...options, @@ -524,65 +556,162 @@ export const getWalletNfts = ( }; /** - * Get Wallet Details - * Retrieves detailed user information for a previously created wallet. This endpoint fetches user data including authentication details and linked accounts. + * Sign Message + * Signs an arbitrary message using the specified wallet. This endpoint supports both text and hexadecimal message formats. The signing is performed using thirdweb Engine with smart wallet support for gasless transactions. + * + * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. + */ +export const signMessage = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + SignMessageResponses, + SignMessageErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/wallets/sign-message", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Sign Typed Data + * Signs structured data according to the EIP-712 standard using the specified wallet. This is commonly used for secure message signing in DeFi protocols, NFT marketplaces, and other dApps that require structured data verification. The typed data includes domain separation and type definitions for enhanced security. + * + * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. + */ +export const signTypedData = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + SignTypedDataResponses, + SignTypedDataErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/wallets/sign-typed-data", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Send Tokens + * Send tokens to multiple recipients in a single transaction batch. Supports native tokens (ETH, MATIC, etc.), ERC20 tokens, ERC721 NFTs, and ERC1155 tokens. The token type is automatically determined based on the provided parameters and ERC165 interface detection: + * + * - **Native Token**: No `tokenAddress` provided + * - **ERC20**: `tokenAddress` provided, no `tokenId` + * - **ERC721/ERC1155**: `tokenAddress` and `tokenId` provided. Auto detects contract type: + * - ERC721: quantity must be '1' + * - ERC1155: any quantity allowed (including '1') + * + * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. + */ +export const sendTokens = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + SendTokensResponses, + SendTokensErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/wallets/send", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * List Contracts + * Retrieves a list of all smart contracts imported by the authenticated client on the thirdweb dashboard. This endpoint provides access to contracts that have been added to your dashboard for management and interaction. Results include contract metadata, deployment information, and import timestamps. + * + * **Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + * + * **Note**: For detailed contract metadata including compilation information, ABI, and source code, use the dedicated metadata endpoint: `GET /v1/contracts/{chainId}/{address}/metadata`. + */ +export const listContracts = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).get< + ListContractsResponses, + ListContractsErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/contracts", + ...options, + }); +}; + +/** + * Deploy Contract + * Deploy a new smart contract to a blockchain network using raw bytecode. This endpoint allows you to deploy contracts by providing the contract bytecode, ABI, constructor parameters, and optional salt for deterministic deployment. * * **Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. */ -export const getWalletDetails = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).get< - GetWalletDetailsResponses, - GetWalletDetailsErrors, - ThrowOnError - >({ - security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, - ], - url: "/v1/wallets/{address}", - ...options, - }); -}; - -/** - * Send Login Code - * Send email or phone code for wallet authentication - */ -export const sendCode = ( - options?: Options, +export const deployContract = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - SendCodeResponses, - SendCodeErrors, + DeployContractResponses, + DeployContractErrors, ThrowOnError >({ security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, { scheme: "bearer", type: "http", }, + { + name: "x-client-id", + type: "apiKey", + }, ], - url: "/v1/wallets/login/code", + url: "/v1/contracts", ...options, headers: { "Content-Type": "application/json", @@ -592,15 +721,17 @@ export const sendCode = ( }; /** - * Login with Code - * Verify email or phone code for wallet authentication + * Read Contract + * Executes multiple read-only contract method calls in a single batch request. This endpoint allows efficient batch reading from multiple contracts on the same chain, significantly reducing the number of HTTP requests needed. Each call specifies the contract address, method signature, and optional parameters. Results are returned in the same order as the input calls, with individual success/failure status for each operation. + * + * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. */ -export const verifyCode = ( - options?: Options, +export const readContract = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - VerifyCodeResponses, - VerifyCodeErrors, + ReadContractResponses, + ReadContractErrors, ThrowOnError >({ security: [ @@ -608,16 +739,8 @@ export const verifyCode = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], - url: "/v1/wallets/login/code/verify", + url: "/v1/contracts/read", ...options, headers: { "Content-Type": "application/json", @@ -627,94 +750,30 @@ export const verifyCode = ( }; /** - * Login with OAuth - * Initiate OAuth flow for a given provider (google, apple, github, etc). Open this URL in a browser to begin authentication. After authentication, the user will be redirected to the redirect URL with an authResult parameter. + * Write Contract + * Executes write operations (transactions) on smart contracts. This is a convenience endpoint that simplifies contract interaction by accepting method signatures and parameters directly, without requiring manual transaction encoding. All calls are executed against the same contract address and chain, making it ideal for batch operations. + * + * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. */ -export const initOauth = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).get< - unknown, - InitOauthErrors, - ThrowOnError - >({ - security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, - ], - url: "/v1/wallets/login/oauth/{provider}", - ...options, - }); -}; - -/** - * Generate Passkey Challenge - * Generate passkey challenge for wallet authentication - */ -export const generatePasskeyChallenge = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).get< - GeneratePasskeyChallengeResponses, - GeneratePasskeyChallengeErrors, - ThrowOnError - >({ - security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, - ], - url: "/v1/wallets/login/passkey", - ...options, - }); -}; - -/** - * Login with Passkey - * Verify passkey challenge for wallet authentication - */ -export const verifyPasskey = ( - options?: Options, +export const writeContract = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - VerifyPasskeyResponses, - VerifyPasskeyErrors, + WriteContractResponses, + WriteContractErrors, ThrowOnError >({ security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, { scheme: "bearer", type: "http", }, + { + name: "x-client-id", + type: "apiKey", + }, ], - url: "/v1/wallets/login/passkey/verify", + url: "/v1/contracts/write", ...options, headers: { "Content-Type": "application/json", @@ -724,15 +783,17 @@ export const verifyPasskey = ( }; /** - * Generate SIWE Payload - * Generate SIWE payload for wallet authentication + * Get Transactions + * Retrieves transactions for a specific smart contract address on a specific blockchain network. This endpoint provides comprehensive transaction data including block information, gas details, transaction status, and function calls. Results can be filtered, paginated, and sorted to meet specific requirements. + * + * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. */ -export const generateSiwePayload = ( - options: Options, +export const getContractTransactions = ( + options: Options, ) => { return (options.client ?? _heyApiClient).get< - GenerateSiwePayloadResponses, - GenerateSiwePayloadErrors, + GetContractTransactionsResponses, + GetContractTransactionsErrors, ThrowOnError >({ security: [ @@ -740,30 +801,24 @@ export const generateSiwePayload = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], - url: "/v1/wallets/login/siwe", + url: "/v1/contracts/{chainId}/{address}/transactions", ...options, }); }; /** - * Login with SIWE - * Verify SIWE signature for wallet authentication + * Get Events + * Retrieves events emitted by a specific smart contract address on a specific blockchain network. This endpoint provides comprehensive event data including block information, transaction details, event topics, and optional ABI decoding. Results can be filtered, paginated, and sorted to meet specific requirements. + * + * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. */ -export const verifySiweSignature = ( - options?: Options, +export const getContractEvents = ( + options: Options, ) => { - return (options?.client ?? _heyApiClient).post< - VerifySiweSignatureResponses, - VerifySiweSignatureErrors, + return (options.client ?? _heyApiClient).get< + GetContractEventsResponses, + GetContractEventsErrors, ThrowOnError >({ security: [ @@ -771,21 +826,88 @@ export const verifySiweSignature = ( name: "x-client-id", type: "apiKey", }, + ], + url: "/v1/contracts/{chainId}/{address}/events", + ...options, + }); +}; + +/** + * Get Metadata + * Retrieves detailed metadata for a specific smart contract from the thirdweb contract metadata service. This includes compilation information, ABI, documentation, and other contract-related metadata. Note: Source code is excluded from the response to keep it lightweight and suitable for programmatic access. + * + * **Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + * + * **Metadata Source**: The metadata is fetched from the thirdweb contract metadata service and includes detailed Solidity compilation information, contract ABI, and developer documentation. + */ +export const getContractMetadata = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).get< + GetContractMetadataResponses, + GetContractMetadataErrors, + ThrowOnError + >({ + security: [ { name: "x-secret-key", type: "apiKey", }, + ], + url: "/v1/contracts/{chainId}/{address}/metadata", + ...options, + }); +}; + +/** + * Get Signatures + * Retrieves human-readable ABI signatures for a specific smart contract. This endpoint fetches the contract metadata from the thirdweb service, extracts the ABI, and converts it into an array of human-readable function and event signatures that can be used directly with contract interaction methods. + * + * **Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly. + * + * **Usage**: The returned signatures can be used directly in contract read/write operations or event filtering. Each signature follows the standard Solidity format and includes function parameters, return types, state mutability, and event indexing information. + */ +export const getContractSignatures = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).get< + GetContractSignaturesResponses, + GetContractSignaturesErrors, + ThrowOnError + >({ + security: [ { - scheme: "bearer", - type: "http", + name: "x-secret-key", + type: "apiKey", }, ], - url: "/v1/wallets/login/siwe/verify", + url: "/v1/contracts/{chainId}/{address}/signatures", + ...options, + }); +}; + +/** + * Get Transaction + * Retrieves detailed information about a specific transaction using its unique identifier. Returns comprehensive transaction data including execution status, blockchain details, and any associated metadata. + * + * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + */ +export const getTransactionById = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).get< + GetTransactionByIdResponses, + GetTransactionByIdErrors, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/transactions/{transactionId}", ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, }); }; @@ -808,14 +930,6 @@ export const listTransactions = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], url: "/v1/transactions", ...options, @@ -824,7 +938,7 @@ export const listTransactions = ( /** * Send Transactions - * Submits a blockchain transaction. Supports three types of transactions: native token transfers, encoded transactions with custom data, and smart contract method calls. The transaction type is determined by the 'type' field in the request body. + * Submits pre-encoded blockchain transactions with custom data payloads. This endpoint is for low-level transaction submission where you have already encoded the transaction data. For smart contract method calls, use /v1/contracts/write. For native token transfers, use /v1/wallets/send. * * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. */ @@ -837,18 +951,14 @@ export const sendTransactions = ( ThrowOnError >({ security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, { scheme: "bearer", type: "http", }, + { + name: "x-client-id", + type: "apiKey", + }, ], url: "/v1/transactions", ...options, @@ -860,17 +970,170 @@ export const sendTransactions = ( }; /** - * Get Transaction by ID - * Retrieves detailed information about a specific transaction using its unique identifier. Returns comprehensive transaction data including execution status, blockchain details, and any associated metadata. + * Create Payment + * Create a payment to be executed. Users can complete the payment via hosted UI (link is returned), a transaction execution referencing the product ID, or embedded widgets with the product ID. + * + * **Authentication**: This endpoint requires project authentication. + */ +export const createPayment = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + CreatePaymentResponses, + CreatePaymentErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/payments", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Get Payment History + * Get payment history for a specific payment link + */ +export const getPaymentHistory = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).get< + GetPaymentHistoryResponses, + GetPaymentHistoryErrors, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/payments/{id}", + ...options, + }); +}; + +/** + * Complete Payment + * Completes a payment using its default token and amount. If the user does not have sufficient funds in the product's default payment token a 402 status will be returned containing a link and raw quote for purchase fulfillment. + * + * **Authentication**: This endpoint requires project authentication. + */ +export const paymentsPurchase = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).post< + PaymentsPurchaseResponses, + PaymentsPurchaseErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/payments/{id}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); +}; + +/** + * List Tokens + * Lists or search existing tokens based on the provided filters. Supports querying by chain ID, token address, symbol, and/or name. + * + * * * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. */ -export const getTransactionById = ( - options: Options, +export const listTokens = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).get< + ListTokensResponses, + ListTokensErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/tokens", + ...options, + }); +}; + +/** + * Create Token + * Create a new ERC20 token with the provided metadata and starting price. The token is immediately available for purchase using thirdweb Payments. + * + * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. + */ +export const createToken = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + CreateTokenResponses, + CreateTokenErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/tokens", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Get Owners + * Retrieves a paginated list of owners for a given ERC-20 token contract on a specific chain. + * + * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + */ +export const getTokenOwners = ( + options: Options, ) => { return (options.client ?? _heyApiClient).get< - GetTransactionByIdResponses, - GetTransactionByIdErrors, + GetTokenOwnersResponses, + GetTokenOwnersErrors, ThrowOnError >({ security: [ @@ -878,49 +1141,37 @@ export const getTransactionById = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], - url: "/v1/transactions/{transactionId}", + url: "/v1/tokens/{chainId}/{address}/owners", ...options, }); }; /** - * Sign Message - * Signs an arbitrary message using a connected wallet. This endpoint supports both text and hexadecimal message formats. The signing is performed using thirdweb Engine with smart account support for gasless transactions. + * Swap or Bridge Tokens + * Swap one token for another using the optimal route available. You can specify a tokenIn amount (if exact='input') or tokenOut amount (if exact='output'), but not both. The corresponding output or input amount will be returned as the quote. * * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. */ -export const signMessage = ( - options?: Options, +export const bridgeSwap = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - SignMessageResponses, - SignMessageErrors, + BridgeSwapResponses, + BridgeSwapErrors, ThrowOnError >({ security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, { scheme: "bearer", type: "http", }, + { + name: "x-client-id", + type: "apiKey", + }, ], - url: "/v1/sign/message", + url: "/v1/bridge/swap", ...options, headers: { "Content-Type": "application/json", @@ -930,17 +1181,21 @@ export const signMessage = ( }; /** - * Sign Typed Data - * Signs structured data according to the EIP-712 standard. This is commonly used for secure message signing in DeFi protocols, NFT marketplaces, and other dApps that require structured data verification. The typed data includes domain separation and type definitions for enhanced security. + * Chat + * Thirdweb AI chat completion API (BETA). * - * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. + * Send natural language queries to interact with any EVM chain, read data, prepare transactions, swap tokens, deploy contracts, payments and more. + * + * Compatible with standard OpenAI API chat completion format, can be used raw or with any popular AI library. + * + * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. */ -export const signTypedData = ( - options?: Options, +export const chat = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - SignTypedDataResponses, - SignTypedDataErrors, + ChatResponses, + unknown, ThrowOnError >({ security: [ @@ -948,16 +1203,8 @@ export const signTypedData = ( name: "x-client-id", type: "apiKey", }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, ], - url: "/v1/sign/typed-data", + url: "/ai/chat", ...options, headers: { "Content-Type": "application/json", @@ -967,34 +1214,36 @@ export const signTypedData = ( }; /** - * Buy Token - * Purchase tokens using a USD amount. The system will automatically handle wallet creation if needed, check your wallet balance, and execute the optimal cross-chain route to get the tokens you want. + * MCP Server + * Model Context Protocol (MCP) server endpoint that exposes all thirdweb API endpoints as MCP tools. This allows LLMs and AI assistants to interact with the thirdweb API through the standardized MCP protocol. * - * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. + * Add this MCP server to any MCP client: + * + * ```json + * { + * "mcpServers": { + * "thirdweb-api": { + * "url": "https://api.thirdweb.com/mcp?secretKey=YOUR_SECRET_KEY_HERE" + * } + * } + * } + * ``` */ -export const buyTokenWithUsd = ( - options?: Options, +export const mcpServer = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - BuyTokenWithUsdResponses, - BuyTokenWithUsdErrors, + McpServerResponses, + unknown, ThrowOnError >({ security: [ - { - name: "x-client-id", - type: "apiKey", - }, { name: "x-secret-key", type: "apiKey", }, - { - scheme: "bearer", - type: "http", - }, ], - url: "/v1/tokens/buy", + url: "/mcp", ...options, headers: { "Content-Type": "application/json", @@ -1004,75 +1253,18 @@ export const buyTokenWithUsd = ( }; /** - * Sell Token - * Sell tokens for a USD amount. The system will automatically handle the optimal cross-chain route to convert your tokens to USD. - * - * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. + * llms.txt + * The full openAPI reference for the thirdweb API in LLMs.txt format. Useful for AI assistants to understand the API and its capabilities. No authentication is required. Copy paste the contents of [https://api.thirdweb.com/llms.txt](https://api.thirdweb.com/llms.txt) into your source code to make your AI assistant understand the API and its capabilities. */ -export const sellTokenForUsd = ( - options?: Options, +export const llmsTxt = ( + options?: Options, ) => { - return (options?.client ?? _heyApiClient).post< - SellTokenForUsdResponses, - SellTokenForUsdErrors, + return (options?.client ?? _heyApiClient).get< + LlmsTxtResponses, + unknown, ThrowOnError >({ - security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, - ], - url: "/v1/tokens/sell", + url: "/llms.txt", ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, - }); -}; - -/** - * Transfer Token - * Transfer tokens worth a USD amount to another wallet address. The system will calculate the required token amount based on current prices and execute the transfer. - * - * **Authentication**: This endpoint requires project authentication and wallet authentication. For backend usage, use `x-secret-key` header. For frontend usage, use `x-client-id` + `Authorization: Bearer ` headers. - */ -export const transferTokenWithUsd = ( - options?: Options, -) => { - return (options?.client ?? _heyApiClient).post< - TransferTokenWithUsdResponses, - TransferTokenWithUsdErrors, - ThrowOnError - >({ - security: [ - { - name: "x-client-id", - type: "apiKey", - }, - { - name: "x-secret-key", - type: "apiKey", - }, - { - scheme: "bearer", - type: "http", - }, - ], - url: "/v1/tokens/transfer", - ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, }); }; diff --git a/packages/api/src/client/types.gen.ts b/packages/api/src/client/types.gen.ts index 14304854b..b6112d8de 100644 --- a/packages/api/src/client/types.gen.ts +++ b/packages/api/src/client/types.gen.ts @@ -1,1011 +1,424 @@ // This file is auto-generated by @hey-api/openapi-ts -export type ListContractsData = { - body?: never; +export type InitiateAuthenticationData = { + /** + * Authentication Initiate Request + * Request to initiate authentication flow. Choose one of the supported authentication methods: sms, email, oauth, passkey, or siwe. The required fields depend on the authentication method selected. + */ + body?: + | { + /** + * Authentication method: SMS + */ + method: "sms"; + /** + * Phone number in E.164 format (e.g., +1234567890) + */ + phone: string; + } + | { + /** + * Authentication method: Email + */ + method: "email"; + /** + * Email address for verification code + */ + email: string; + } + | { + /** + * Authentication method: OAuth + */ + method: "oauth"; + /** + * Social login provider + */ + provider: + | "google" + | "apple" + | "facebook" + | "discord" + | "farcaster" + | "telegram" + | "line" + | "x" + | "coinbase" + | "github" + | "twitch" + | "steam" + | "tiktok"; + /** + * Custom redirect URL after OAuth completion + */ + redirectUrl?: string; + } + | { + /** + * Authentication method: Passkey + */ + method: "passkey"; + /** + * Whether to create a new passkey or use existing one + */ + type: "sign-up" | "sign-in"; + /** + * Username for passkey (optional, for identification) + */ + username?: string; + } + | { + /** + * Authentication method: Sign-In with Ethereum + */ + method: "siwe"; + /** + * Ethereum wallet address for SIWE + */ + address: string; + /** + * Chain ID for SIWE (defaults to 1) + */ + chainId?: number; + }; path?: never; - query?: { - /** - * Whether to include the contract ABI (Application Binary Interface) for each contract. When true, fetches the ABI from the thirdweb contract service and returns it in an optional 'abi' array within each contract. - */ - includeAbi?: string; - /** - * Whether to include contract metadata from the thirdweb contract metadata service. When true, fetches additional metadata for each contract and returns it in an optional 'metadata' object within each contract. - */ - includeMetadata?: string; - /** - * The number of contracts to return (default: 20, max: 100). - */ - limit?: number; - /** - * The page number for pagination (default: 1). - */ - page?: number; - }; - url: "/v1/contracts"; + query?: never; + url: "/v1/auth/initiate"; }; -export type ListContractsErrors = { +export type InitiateAuthenticationErrors = { + /** + * Invalid request - Check your method and parameters + */ + 400: unknown; + /** + * Rate limit exceeded - Please wait before trying again + */ + 429: unknown; +}; + +export type InitiateAuthenticationResponses = { + /** + * Authentication Initiate Response + * Response from authentication initiation. Contains method-specific data needed to complete authentication. + */ + 200: + | { + /** + * Authentication method: SMS + */ + method: "sms"; + /** + * Whether the SMS code was sent successfully + */ + success: boolean; + } + | { + /** + * Authentication method: Email + */ + method: "email"; + /** + * Whether the email code was sent successfully + */ + success: boolean; + } + | { + /** + * Authentication method: OAuth + */ + method: "oauth"; + /** + * URL to redirect user for OAuth authentication + */ + redirectUrl: string; + } + | { + /** + * Authentication method: Passkey + */ + method: "passkey"; + /** + * Server verification ID for passkey + */ + serverVerificationId: string; + /** + * Base64-encoded WebAuthn challenge + */ + challenge: string; + /** + * Challenge type (sign-up or sign-in) + */ + type: string; + } + | { + /** + * Authentication method: Sign-In with Ethereum + */ + method: "siwe"; + /** + * SIWE message string to be signed + */ + payload: string; + }; +}; + +export type InitiateAuthenticationResponse = + InitiateAuthenticationResponses[keyof InitiateAuthenticationResponses]; + +export type CompleteAuthenticationData = { + /** + * Authentication Complete Request + * Request to complete authentication flow. Choose the same method used in initiate: sms, email, oauth, passkey, siwe, guest, or custom. The required fields depend on the authentication method. + */ + body?: + | { + /** + * Authentication method: SMS + */ + method: "sms"; + /** + * Phone number that received the code + */ + phone: string; + /** + * Verification code received via SMS + */ + code: string; + } + | { + /** + * Authentication method: Email + */ + method: "email"; + /** + * Email address that received the code + */ + email: string; + /** + * Verification code received via email + */ + code: string; + } + | { + /** + * Authentication method: Passkey + */ + method: "passkey"; + /** + * Passkey operation type + */ + type: "sign-up" | "sign-in"; + /** + * Base64-encoded authenticator data + */ + authenticatorData: string; + /** + * Base64-encoded credential ID + */ + credentialId: string; + /** + * Server verification ID from initiate response + */ + serverVerificationId: string; + /** + * Base64-encoded client data JSON + */ + clientData: string; + /** + * Base64-encoded signature (for sign-in) + */ + signature?: string; + /** + * Origin of the request + */ + origin?: string; + /** + * Relying party identifier + */ + rpId?: string; + /** + * Username for the passkey + */ + username?: string; + /** + * Credential data for passkey registration + */ + credential?: { + /** + * Public key for the credential + */ + publicKey: string; + /** + * Algorithm used for the credential + */ + algorithm: "RS256" | "ES256"; + }; + } + | { + /** + * Authentication method: Sign-In with Ethereum + */ + method: "siwe"; + /** + * Hex-encoded signed SIWE message + */ + signature: string; + /** + * The original SIWE payload that was signed + */ + payload: string; + } + | { + /** + * Authentication method: Custom + */ + method: "custom"; + /** + * Custom authentication type + */ + type: "jwt" | "auth-payload"; + /** + * JWT token for OIDC authentication + */ + jwt?: unknown; + /** + * Custom authentication payload + */ + payload?: unknown; + } + | { + /** + * Authentication method: Guest + */ + method: "guest"; + /** + * Optional guest session ID - if not provided, a random one will be generated with no persistence guarantees. + */ + sessionId?: string; + }; + path?: never; + query?: never; + url: "/v1/auth/complete"; +}; + +export type CompleteAuthenticationErrors = { + /** + * Invalid credentials or request - Check your challenge ID and verification data + */ + 400: unknown; + /** + * Rate limit exceeded - Please wait before trying again + */ + 429: unknown; +}; + +export type CompleteAuthenticationResponses = { + /** + * Successful authentication response. Returns wallet address plus authentication tokens. + */ + 200: { + /** + * Whether this is a newly created user/wallet + */ + isNewUser: boolean; + /** + * JWT authentication token for API access + */ + token: string; + /** + * Type of authentication completed + */ + type: string; + /** + * The wallet address + */ + walletAddress: string; + }; +}; + +export type CompleteAuthenticationResponse = + CompleteAuthenticationResponses[keyof CompleteAuthenticationResponses]; + +export type SocialAuthenticationData = { + body?: never; + path?: never; + query: { + /** + * The OAuth provider to use + */ + provider: + | "google" + | "apple" + | "facebook" + | "discord" + | "farcaster" + | "telegram" + | "line" + | "x" + | "coinbase" + | "github" + | "twitch" + | "steam" + | "tiktok"; + /** + * URL to redirect the user to after OAuth completion + */ + redirectUrl: string; + /** + * Client ID (alternative to x-client-id header for standard OAuth flows) + */ + clientId?: string; + }; + url: "/v1/auth/social"; +}; + +export type SocialAuthenticationErrors = { /** * Invalid request parameters */ 400: unknown; - /** - * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. - */ - 401: unknown; - /** - * Rate limit exceeded - */ - 429: unknown; - /** - * Internal server error - */ - 500: unknown; }; -export type ListContractsResponses = { - /** - * Successfully retrieved list of contracts - */ - 200: { - result: { - /** - * Array of contracts imported by the client. - */ - contracts: Array<{ - /** - * The contract ABI (Application Binary Interface) as an array of objects. Contains function definitions, event signatures, constructor parameters, error definitions, and other contract interface specifications. Only present when includeAbi=true. - */ - abi?: Array<{ - [key: string]: unknown; - }>; - /** - * The contract address. - */ - address: string; - /** - * The chain ID where the contract is deployed. - */ - chainId: string; - /** - * The date when the contract was deployed. - */ - deployedAt?: string; - /** - * The contract ID. - */ - id?: string; - /** - * The date when the contract was imported to the dashboard. - */ - importedAt: string; - /** - * Additional contract metadata from the thirdweb contract metadata service. Only present when includeMetadata=true. Contains compilation details, ABI information, and Solidity metadata. - */ - metadata?: { - /** - * The chain ID where the contract is deployed. - */ - chainId: number; - /** - * Array of compilation target paths. - */ - compilationTarget?: Array; - /** - * The contract address. - */ - contractAddress: string; - /** - * The implementation address for proxy contracts. - */ - implementationAddress?: string; - /** - * Whether the ABI is a composite of multiple contracts. - */ - isCompositeAbi?: boolean; - /** - * Whether the ABI is partial or complete. - */ - isPartialAbi?: boolean; - /** - * Solidity metadata object as defined in the Solidity documentation. Contains compiler settings, sources, and other compilation metadata. - */ - metadata?: { - [key: string]: unknown; - }; - /** - * The strategy used to retrieve the metadata. - */ - strategy?: string; - }; - /** - * The contract name, if available. - */ - name?: string; - /** - * The contract symbol, if available. - */ - symbol?: string; - /** - * The contract type (e.g., ERC20, ERC721, etc.). - */ - type?: string; - }>; - pagination: { - /** - * Whether there are more items available - */ - hasMore?: boolean; - /** - * Number of items per page - */ - limit: number; - /** - * Current page number - */ - page: number; - /** - * Total number of items available - */ - totalCount?: number; - }; - }; - }; -}; - -export type ListContractsResponse = - ListContractsResponses[keyof ListContractsResponses]; - -export type DeployContractData = { - body?: { - /** - * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). - */ - chainId: number; - /** - * Object containing constructor parameters for the contract deployment (e.g., { param1: 'value1', param2: 123 }). - */ - constructorParams?: { - [key: string]: unknown; - }; - /** - * The URL to the contract source from thirdweb.com (e.g., https://thirdweb.com/thirdweb.eth/TokenERC20). Version suffixes will be automatically stripped. - */ - contractUrl: string; - /** - * The wallet address that will deploy the contract. - */ - from: string; - /** - * Optional salt value for deterministic contract deployment. - */ - salt?: string; - }; - path?: never; - query?: never; - url: "/v1/contracts"; -}; - -export type DeployContractErrors = { - /** - * Invalid request parameters - */ - 400: unknown; - /** - * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. - */ - 401: unknown; - /** - * Rate limit exceeded - */ - 429: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type DeployContractResponses = { - /** - * Contract deployed successfully - */ - 200: { - result: { - /** - * The deployed contract address. - */ - address: string; - /** - * The chain ID where the contract was deployed. - */ - chainId: number; - /** - * The unique identifier for the transaction that deployed the contract. Will not be returned if the contract was already deployed at the predicted address. - */ - transactionId?: string; - }; - }; -}; - -export type DeployContractResponse = - DeployContractResponses[keyof DeployContractResponses]; - -export type ReadContractData = { - body?: { - /** - * Array of contract method calls to execute. Each call specifies a contract address, method signature, and optional parameters. - */ - calls: Array<{ - /** - * The smart contract address. Must be a valid Ethereum-compatible address (42 characters, starting with 0x). - */ - contractAddress: string; - /** - * The contract function signature to call (e.g., 'function approve(address spender, uint256 amount)' or `function balanceOf(address)`). Must start with 'function' followed by the function name and parameters as defined in the contract ABI. - */ - method: string; - /** - * Array of parameters to pass to the contract method, in the correct order and format. - */ - params?: Array; - /** - * Amount of native token to send with the transaction in wei. Required for payable methods. - */ - value?: string; - }>; - /** - * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). - */ - chainId: number; - }; - path?: never; - query?: never; - url: "/v1/contracts/read"; -}; - -export type ReadContractErrors = { - /** - * Invalid request parameters. This occurs when the chainId is not supported, contract addresses are invalid, function signatures are malformed, or the calls array is empty. - */ - 400: unknown; - /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. - */ - 401: unknown; - /** - * Internal server error. This may occur due to engine connectivity issues, RPC node unavailability, or unexpected server errors. - */ - 500: unknown; -}; - -export type ReadContractResponses = { - /** - * Contract read operations completed successfully. Returns an array of results corresponding to each input call, including both successful and failed operations. - */ - 200: { - /** - * Array of results corresponding to each contract read call. Results are returned in the same order as the input calls. - */ - result: Array<{ - /** - * The result of the contract read operation. The type and format depend on the method's return value as defined in the contract ABI. - */ - data?: unknown; - /** - * Error message if the contract read operation failed. - */ - error?: string; - /** - * Indicates whether the contract read operation was successful. - */ - success: boolean; - }>; - }; -}; - -export type ReadContractResponse = - ReadContractResponses[keyof ReadContractResponses]; - -export type GetContractTransactionsData = { - body?: never; - path: { - /** - * The smart contract address. Must be a valid Ethereum-compatible address (42 characters, starting with 0x). - */ - address: string; - }; - query: { - /** - * Chain ID(s) to request transaction data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 - */ - chainId: Array; - /** - * Whether to enable ABI decoding of transaction data. When true, returns decoded function calls if ABI is available. - */ - decode?: boolean; - /** - * The number of transactions to return per chain (default: 20, max: 500). - */ - limit?: number; - /** - * The page number for pagination (default: 0, max: 20). - */ - page?: number; - /** - * Sort order - ascending or descending (default: desc). - */ - sortOrder?: "asc" | "desc"; - /** - * Start time for filtering transactions (Unix timestamp). Default is 3 months ago. - */ - startTime?: number; - }; - url: "/v1/contracts/{address}/transactions"; -}; - -export type GetContractTransactionsErrors = { - /** - * Invalid request parameters. This occurs when the contract address format is invalid, chainId array is empty or exceeds the maximum limit of 50, or pagination parameters are out of range. - */ - 400: unknown; - /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. - */ - 401: unknown; - /** - * Contract not found or no transactions available for the specified contract address on the given blockchain networks. - */ - 404: unknown; - /** - * Internal server error. This may occur due to network connectivity issues, external service unavailability, or unexpected server errors. - */ - 500: unknown; -}; - -export type GetContractTransactionsResponses = { - /** - * Contract transactions retrieved successfully. Returns transaction data with metadata including pagination information and chain details. When decode=true, includes decoded function calls if ABI is available. - */ - 200: { - result: { - /** - * Array of contract transactions. - */ - data: Array<{ - /** - * The hash of the block containing this transaction. - */ - blockHash: string; - /** - * The block number containing this transaction. - */ - blockNumber: number; - /** - * The timestamp of the block (Unix timestamp). - */ - blockTimestamp: number; - /** - * The chain ID where the transaction occurred. - */ - chainId: string; - /** - * Contract address created if this was a contract creation transaction. - */ - contractAddress?: string; - /** - * Total gas used by all transactions in this block up to and including this one. - */ - cumulativeGasUsed?: number; - /** - * The transaction input data. - */ - data: string; - /** - * Decoded transaction data (only present when decode=true and ABI is available). - */ - decoded?: { - /** - * Object containing decoded function parameters. - */ - inputs: { - [key: string]: unknown; - }; - /** - * The function name. - */ - name: string; - /** - * The function signature. - */ - signature: string; - }; - /** - * The effective gas price paid (in wei as string). - */ - effectiveGasPrice?: string; - /** - * The address that initiated the transaction. - */ - fromAddress: string; - /** - * The function selector (first 4 bytes of the transaction data). - */ - functionSelector: string; - /** - * The gas limit for the transaction. - */ - gas: number; - /** - * The gas price used for the transaction (in wei as string). - */ - gasPrice: string; - /** - * The amount of gas used by the transaction. - */ - gasUsed?: number; - /** - * The transaction hash. - */ - hash: string; - /** - * Maximum fee per gas (EIP-1559). - */ - maxFeePerGas?: string; - /** - * Maximum priority fee per gas (EIP-1559). - */ - maxPriorityFeePerGas?: string; - /** - * The transaction nonce. - */ - nonce: number; - /** - * The transaction status (1 for success, 0 for failure). - */ - status: number; - /** - * The address that received the transaction. - */ - toAddress: string; - /** - * The index of the transaction within the block. - */ - transactionIndex: number; - /** - * The transaction type (0=legacy, 1=EIP-2930, 2=EIP-1559). - */ - transactionType?: number; - /** - * The value transferred in the transaction (in wei as string). - */ - value: string; - }>; - pagination: { - /** - * Whether there are more items available - */ - hasMore?: boolean; - /** - * Number of items per page - */ - limit: number; - /** - * Current page number - */ - page: number; - /** - * Total number of items available - */ - totalCount?: number; - }; - }; - }; -}; - -export type GetContractTransactionsResponse = - GetContractTransactionsResponses[keyof GetContractTransactionsResponses]; - -export type GetContractEventsData = { - body?: never; - path: { - /** - * The smart contract address. Must be a valid Ethereum-compatible address (42 characters, starting with 0x). - */ - address: string; - }; - query: { - /** - * Chain ID(s) to request event data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 - */ - chainId: Array; - /** - * Whether to enable ABI decoding of event data. When true, returns decoded event parameters if ABI is available. - */ - decode?: boolean; - /** - * Maximum number of events to return per chain. Must be between 1 and 500. Default is 20. - */ - limit?: number; - /** - * Page number for pagination (0-based). Must be between 0 and 20. Default is 0. - */ - page?: number; - /** - * Sort order for the results. Always sorts by block_number. 'desc' for newest first, 'asc' for oldest first. Default is 'desc'. - */ - sortOrder?: "asc" | "desc"; - /** - * Start time for filtering events (Unix timestamp). Default is 3 months ago. - */ - startTime?: number; - }; - url: "/v1/contracts/{address}/events"; -}; - -export type GetContractEventsErrors = { - /** - * Invalid request parameters. This occurs when the contract address format is invalid, chainId array is empty or exceeds the maximum limit of 50, or pagination parameters are out of range. - */ - 400: unknown; - /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. - */ - 401: unknown; - /** - * Contract not found or no events available for the specified contract address on the given blockchain networks. - */ - 404: unknown; - /** - * Internal server error. This may occur due to network connectivity issues, external service unavailability, or unexpected server errors. - */ - 500: unknown; -}; - -export type GetContractEventsResponses = { - /** - * Contract events retrieved successfully. Returns event data with metadata including pagination information and chain details. When decode=true, includes decoded event parameters if ABI is available. - */ - 200: { - result: { - /** - * Array of contract events. - */ - events: Array<{ - /** - * The contract address that emitted the event. - */ - address: string; - /** - * The hash of the block containing this event. - */ - blockHash: string; - /** - * The block number where the event was emitted. - */ - blockNumber: number; - /** - * The timestamp of the block (Unix timestamp). - */ - blockTimestamp: number; - /** - * The chain ID where the event occurred. - */ - chainId: string; - /** - * The non-indexed event data as a hex string. - */ - data: string; - /** - * Decoded event data (only present when decode=true and ABI is available). - */ - decoded?: { - /** - * The event name. - */ - name: string; - /** - * Object containing decoded parameters. - */ - params: { - [key: string]: unknown; - }; - /** - * The event signature. - */ - signature: string; - }; - /** - * The index of the log within the transaction. - */ - logIndex: number; - /** - * Array of indexed event topics (including event signature). - */ - topics: Array; - /** - * The hash of the transaction containing this event. - */ - transactionHash: string; - /** - * The index of the transaction within the block. - */ - transactionIndex: number; - }>; - pagination: { - /** - * Whether there are more items available - */ - hasMore?: boolean; - /** - * Number of items per page - */ - limit: number; - /** - * Current page number - */ - page: number; - /** - * Total number of items available - */ - totalCount?: number; - }; - }; - }; -}; - -export type GetContractEventsResponse = - GetContractEventsResponses[keyof GetContractEventsResponses]; - -export type WriteContractData = { - body?: { - /** - * Array of contract method calls to execute. Each call specifies a contract address, method signature, and optional parameters. - */ - calls: Array<{ - /** - * The smart contract address. Must be a valid Ethereum-compatible address (42 characters, starting with 0x). - */ - contractAddress: string; - /** - * The contract function signature to call (e.g., 'function approve(address spender, uint256 amount)' or `function balanceOf(address)`). Must start with 'function' followed by the function name and parameters as defined in the contract ABI. - */ - method: string; - /** - * Array of parameters to pass to the contract method, in the correct order and format. - */ - params?: Array; - /** - * Amount of native token to send with the transaction in wei. Required for payable methods. - */ - value?: string; - }>; - /** - * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). - */ - chainId: number; - /** - * The wallet address that will send the transaction. - */ - from: string; - }; - path?: never; - query?: never; - url: "/v1/contracts/write"; -}; - -export type WriteContractErrors = { - /** - * Invalid request parameters. This occurs when contract parameters are malformed, method signatures are invalid, insufficient balance, or unsupported contract methods. - */ - 400: unknown; - /** - * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. - */ - 401: unknown; - /** - * Contract not found. The specified contract address does not exist on the given blockchain network or is not accessible. - */ - 404: unknown; - /** - * Internal server error. This may occur due to blockchain connectivity issues, gas estimation failures, contract execution errors, or unexpected server errors. - */ - 500: unknown; -}; - -export type WriteContractResponses = { - /** - * Contract write operations submitted successfully. Returns transaction IDs for tracking and monitoring. - */ - 200: { - result: { - /** - * Array of unique identifiers for the submitted transactions. Use these to track transaction status. - */ - transactionIds: Array; - }; - }; -}; - -export type WriteContractResponse = - WriteContractResponses[keyof WriteContractResponses]; - -export type ListWalletsData = { +export type GetMyWalletData = { body?: never; path?: never; - query?: { - limit?: number; - page?: number; - /** - * Type of wallet to fetch, default is user - */ - type?: "user" | "server"; - }; - url: "/v1/wallets"; + query?: never; + url: "/v1/wallets/me"; }; -export type ListWalletsErrors = { +export type GetMyWalletErrors = { /** - * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. + * Authentication required. The request must include a valid `Authorization: Bearer ` header. */ 401: unknown; + /** + * Wallet not found. The authenticated user does not exist in the system. + */ + 404: unknown; /** * Internal server error. This may occur due to service unavailability or unexpected server errors. */ 500: unknown; }; -export type ListWalletsResponses = { +export type GetMyWalletResponses = { /** - * Returns a list of wallet addresses, smart wallet addresses, and auth details. + * Wallet retrieved successfully. Returns comprehensive user information including wallet addresses, public key, and linked wallets. */ 200: { result: { /** - * Pagination information + * The EOA (Externally Owned Wallet) address of the wallet. This is the traditional wallet address. */ - pagination: { - /** - * Whether there are more items available - */ - hasMore?: boolean; - /** - * Number of items per page - */ - limit: number; - /** - * Current page number - */ - page: number; - /** - * Total number of items available - */ - totalCount?: number; - }; - /** - * Array of user or server wallets - */ - wallets: Array<{ - /** - * The EOA (Externally Owned Account) address of the wallet. This is the traditional wallet address. - */ - address: string; - /** - * The date and time the wallet was created - */ - createdAt: string; - /** - * The profiles linked to the wallet, can be email, phone, google etc, or backend for developer created wallets - */ - profiles: Array< - | { - email: string; - emailVerified: boolean; - familyName?: string; - givenName?: string; - hd: string; - id: string; - locale: string; - name?: string; - picture: string; - type: "google"; - } - | { - email?: string; - firstName?: string; - id: string; - lastName?: string; - name?: string; - picture?: string; - type: "facebook"; - } - | { - email?: string; - emailVerified: boolean; - id: string; - isPrivateEmail: boolean; - type: "apple"; - } - | { - avatar?: string; - id: string; - name?: string; - type: "github"; - username: string; - } - | { - avatar: string; - email?: string; - emailVerified: boolean; - id: string; - type: "discord"; - username: string; - } - | { - avatar?: string; - id: string; - name: string; - type: "coinbase"; - } - | { - id: string; - name: string; - type: "x"; - username: string; - } - | { - avatar?: string; - id: string; - metadata: { - avatar: { - large?: string; - medium?: string; - small?: string; - }; - personaname?: string; - profileurl?: string; - realname?: string; - }; - type: "steam"; - username?: string; - } - | { - firstName?: string; - id: string; - lastName?: string; - picture?: string; - type: "telegram"; - username?: string; - } - | { - avatar?: string; - description?: string; - email?: string; - id: string; - type: "twitch"; - username: string; - } - | { - avatar?: string; - id: string; - type: "line"; - username?: string; - } - | { - fid: string; - id: string; - type: "farcaster"; - walletAddress?: string; - } - | { - algorithm: string; - credentialId: string; - publicKey: string; - type: "passkey"; - } - | { - email: string; - id: string; - type: "email"; - } - | { - id: string; - pregeneratedIdentifier: string; - type: "pre_generation"; - } - | { - id: string; - phone: string; - type: "phone"; - } - | { - id: string; - type: "siwe"; - walletAddress: string; - } - | { - id: string; - type: "guest"; - } - | { - id: string; - type: "backend"; - } - | { - identifier: string; - type: "server"; - } - | { - authProviderId?: string; - email?: string; - id: string; - phone?: string; - type: "custom_jwt"; - walletAddress?: string; - } - | { - authProviderId?: string; - email?: string; - id: string; - phone?: string; - type: "custom_auth_endpoint"; - walletAddress?: string; - } - >; - /** - * The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced account features. - */ - smartWalletAddress?: string; - }>; - }; - }; -}; - -export type ListWalletsResponse = - ListWalletsResponses[keyof ListWalletsResponses]; - -export type CreateWalletData = { - body?: { - /** - * Unique identifier for wallet creation or retrieval. Can be user ID, email, or any unique string. The same identifier will always return the same wallet. - */ - identifier: string; - }; - path?: never; - query?: never; - url: "/v1/wallets"; -}; - -export type CreateWalletErrors = { - /** - * Invalid request parameters. This occurs when the identifier format is invalid or required parameters are missing. - */ - 400: unknown; - /** - * Authentication required. For backend usage, include `x-secret-key` header. - */ - 401: unknown; - /** - * Internal server error. This may occur due to wallet service unavailability, smart account deployment issues, or unexpected server errors. - */ - 500: unknown; -}; - -export type CreateWalletResponses = { - /** - * Wallet created or connected successfully. Returns wallet addresses for subsequent operations. - */ - 200: { - result: { - /** - * The EOA (Externally Owned Account) address of the wallet. This is the traditional wallet address. - */ - address: string; + address?: string; /** * The date and time the wallet was created */ - createdAt: string; + createdAt?: string; /** - * The profiles linked to the wallet, can be email, phone, google etc, or backend for developer created wallets + * AuthenticationProviderDetail + * Authentication provider details with type-based discrimination */ profiles: Array< | { @@ -1062,6 +475,14 @@ export type CreateWalletResponses = { name: string; type: "x"; username: string; + profileImageUrl?: string; + } + | { + id: string; + displayName: string; + avatarUrl: string; + unionId?: string; + type: "tiktok"; } | { avatar?: string; @@ -1163,21 +584,981 @@ export type CreateWalletResponses = { } >; /** - * The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced account features. + * The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced wallet features. */ smartWalletAddress?: string; + /** + * The wallet's public key in hexadecimal format. Useful for peer-to-peer encryption and cryptographic operations. + */ + publicKey?: string; }; }; }; -export type CreateWalletResponse = - CreateWalletResponses[keyof CreateWalletResponses]; +export type GetMyWalletResponse = + GetMyWalletResponses[keyof GetMyWalletResponses]; + +export type ListUserWalletsData = { + body?: never; + path?: never; + query?: { + limit?: number; + page?: number; + email?: string; + phone?: string; + address?: string; + externalWalletAddress?: string; + id?: string; + }; + url: "/v1/wallets/user"; +}; + +export type ListUserWalletsErrors = { + /** + * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. + */ + 401: unknown; + /** + * Internal server error. This may occur due to service unavailability or unexpected server errors. + */ + 500: unknown; +}; + +export type ListUserWalletsResponses = { + /** + * Returns a list of user wallet addresses, smart wallet addresses, and auth details. + */ + 200: { + result: { + /** + * Pagination information + */ + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; + /** + * Array of user wallets + */ + wallets: Array<{ + /** + * The EOA (Externally Owned Wallet) address of the wallet. This is the traditional wallet address. + */ + address?: string; + /** + * The date and time the wallet was created + */ + createdAt?: string; + /** + * AuthenticationProviderDetail + * Authentication provider details with type-based discrimination + */ + profiles: Array< + | { + email: string; + emailVerified: boolean; + familyName?: string; + givenName?: string; + hd: string; + id: string; + locale: string; + name?: string; + picture: string; + type: "google"; + } + | { + email?: string; + firstName?: string; + id: string; + lastName?: string; + name?: string; + picture?: string; + type: "facebook"; + } + | { + email?: string; + emailVerified: boolean; + id: string; + isPrivateEmail: boolean; + type: "apple"; + } + | { + avatar?: string; + id: string; + name?: string; + type: "github"; + username: string; + } + | { + avatar: string; + email?: string; + emailVerified: boolean; + id: string; + type: "discord"; + username: string; + } + | { + avatar?: string; + id: string; + name: string; + type: "coinbase"; + } + | { + id: string; + name: string; + type: "x"; + username: string; + profileImageUrl?: string; + } + | { + id: string; + displayName: string; + avatarUrl: string; + unionId?: string; + type: "tiktok"; + } + | { + avatar?: string; + id: string; + metadata: { + avatar: { + large?: string; + medium?: string; + small?: string; + }; + personaname?: string; + profileurl?: string; + realname?: string; + }; + type: "steam"; + username?: string; + } + | { + firstName?: string; + id: string; + lastName?: string; + picture?: string; + type: "telegram"; + username?: string; + } + | { + avatar?: string; + description?: string; + email?: string; + id: string; + type: "twitch"; + username: string; + } + | { + avatar?: string; + id: string; + type: "line"; + username?: string; + } + | { + fid: string; + id: string; + type: "farcaster"; + walletAddress?: string; + } + | { + algorithm: string; + credentialId: string; + publicKey: string; + type: "passkey"; + } + | { + email: string; + id: string; + type: "email"; + } + | { + id: string; + pregeneratedIdentifier: string; + type: "pre_generation"; + } + | { + id: string; + phone: string; + type: "phone"; + } + | { + id: string; + type: "siwe"; + walletAddress: string; + } + | { + id: string; + type: "guest"; + } + | { + id: string; + type: "backend"; + } + | { + identifier: string; + type: "server"; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_jwt"; + walletAddress?: string; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_auth_endpoint"; + walletAddress?: string; + } + >; + /** + * The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced wallet features. + */ + smartWalletAddress?: string; + /** + * The wallet's public key in hexadecimal format. Useful for peer-to-peer encryption and cryptographic operations. + */ + publicKey?: string; + }>; + }; + }; +}; + +export type ListUserWalletsResponse = + ListUserWalletsResponses[keyof ListUserWalletsResponses]; + +export type CreateUserWalletData = { + /** + * Request body for pre-generating a wallet + */ + body?: { + type: + | "google" + | "apple" + | "facebook" + | "discord" + | "email" + | "phone" + | "custom_auth_endpoint" + | "custom_jwt" + | "siwe"; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + walletAddress?: string; + email?: string; + phone?: string; + userId?: string; + }; + path?: never; + query?: never; + url: "/v1/wallets/user"; +}; + +export type CreateUserWalletErrors = { + /** + * Invalid request. This may occur due to missing required fields based on the authentication strategy, invalid strategy, or malformed request data. + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. + */ + 401: unknown; + /** + * Internal server error. This may occur due to service unavailability or unexpected server errors. + */ + 500: unknown; +}; + +export type CreateUserWalletResponses = { + /** + * Successfully created a user wallet with wallet. + */ + 200: { + result: { + /** + * The EOA (Externally Owned Wallet) address of the wallet. This is the traditional wallet address. + */ + address?: string; + /** + * The date and time the wallet was created + */ + createdAt?: string; + /** + * AuthenticationProviderDetail + * Authentication provider details with type-based discrimination + */ + profiles: Array< + | { + email: string; + emailVerified: boolean; + familyName?: string; + givenName?: string; + hd: string; + id: string; + locale: string; + name?: string; + picture: string; + type: "google"; + } + | { + email?: string; + firstName?: string; + id: string; + lastName?: string; + name?: string; + picture?: string; + type: "facebook"; + } + | { + email?: string; + emailVerified: boolean; + id: string; + isPrivateEmail: boolean; + type: "apple"; + } + | { + avatar?: string; + id: string; + name?: string; + type: "github"; + username: string; + } + | { + avatar: string; + email?: string; + emailVerified: boolean; + id: string; + type: "discord"; + username: string; + } + | { + avatar?: string; + id: string; + name: string; + type: "coinbase"; + } + | { + id: string; + name: string; + type: "x"; + username: string; + profileImageUrl?: string; + } + | { + id: string; + displayName: string; + avatarUrl: string; + unionId?: string; + type: "tiktok"; + } + | { + avatar?: string; + id: string; + metadata: { + avatar: { + large?: string; + medium?: string; + small?: string; + }; + personaname?: string; + profileurl?: string; + realname?: string; + }; + type: "steam"; + username?: string; + } + | { + firstName?: string; + id: string; + lastName?: string; + picture?: string; + type: "telegram"; + username?: string; + } + | { + avatar?: string; + description?: string; + email?: string; + id: string; + type: "twitch"; + username: string; + } + | { + avatar?: string; + id: string; + type: "line"; + username?: string; + } + | { + fid: string; + id: string; + type: "farcaster"; + walletAddress?: string; + } + | { + algorithm: string; + credentialId: string; + publicKey: string; + type: "passkey"; + } + | { + email: string; + id: string; + type: "email"; + } + | { + id: string; + pregeneratedIdentifier: string; + type: "pre_generation"; + } + | { + id: string; + phone: string; + type: "phone"; + } + | { + id: string; + type: "siwe"; + walletAddress: string; + } + | { + id: string; + type: "guest"; + } + | { + id: string; + type: "backend"; + } + | { + identifier: string; + type: "server"; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_jwt"; + walletAddress?: string; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_auth_endpoint"; + walletAddress?: string; + } + >; + /** + * The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced wallet features. + */ + smartWalletAddress?: string; + /** + * The wallet's public key in hexadecimal format. Useful for peer-to-peer encryption and cryptographic operations. + */ + publicKey?: string; + }; + }; +}; + +export type CreateUserWalletResponse = + CreateUserWalletResponses[keyof CreateUserWalletResponses]; + +export type ListServerWalletsData = { + body?: never; + path?: never; + query?: { + limit?: number; + page?: number; + }; + url: "/v1/wallets/server"; +}; + +export type ListServerWalletsErrors = { + /** + * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. + */ + 401: unknown; + /** + * Internal server error. This may occur due to service unavailability or unexpected server errors. + */ + 500: unknown; +}; + +export type ListServerWalletsResponses = { + /** + * Returns a list of server wallet addresses, smart wallet addresses, and auth details. + */ + 200: { + result: { + /** + * Pagination information + */ + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; + /** + * Array of server wallets + */ + wallets: Array<{ + /** + * The EOA (Externally Owned Wallet) address of the wallet. This is the traditional wallet address. + */ + address?: string; + /** + * The date and time the wallet was created + */ + createdAt?: string; + /** + * AuthenticationProviderDetail + * Authentication provider details with type-based discrimination + */ + profiles: Array< + | { + email: string; + emailVerified: boolean; + familyName?: string; + givenName?: string; + hd: string; + id: string; + locale: string; + name?: string; + picture: string; + type: "google"; + } + | { + email?: string; + firstName?: string; + id: string; + lastName?: string; + name?: string; + picture?: string; + type: "facebook"; + } + | { + email?: string; + emailVerified: boolean; + id: string; + isPrivateEmail: boolean; + type: "apple"; + } + | { + avatar?: string; + id: string; + name?: string; + type: "github"; + username: string; + } + | { + avatar: string; + email?: string; + emailVerified: boolean; + id: string; + type: "discord"; + username: string; + } + | { + avatar?: string; + id: string; + name: string; + type: "coinbase"; + } + | { + id: string; + name: string; + type: "x"; + username: string; + profileImageUrl?: string; + } + | { + id: string; + displayName: string; + avatarUrl: string; + unionId?: string; + type: "tiktok"; + } + | { + avatar?: string; + id: string; + metadata: { + avatar: { + large?: string; + medium?: string; + small?: string; + }; + personaname?: string; + profileurl?: string; + realname?: string; + }; + type: "steam"; + username?: string; + } + | { + firstName?: string; + id: string; + lastName?: string; + picture?: string; + type: "telegram"; + username?: string; + } + | { + avatar?: string; + description?: string; + email?: string; + id: string; + type: "twitch"; + username: string; + } + | { + avatar?: string; + id: string; + type: "line"; + username?: string; + } + | { + fid: string; + id: string; + type: "farcaster"; + walletAddress?: string; + } + | { + algorithm: string; + credentialId: string; + publicKey: string; + type: "passkey"; + } + | { + email: string; + id: string; + type: "email"; + } + | { + id: string; + pregeneratedIdentifier: string; + type: "pre_generation"; + } + | { + id: string; + phone: string; + type: "phone"; + } + | { + id: string; + type: "siwe"; + walletAddress: string; + } + | { + id: string; + type: "guest"; + } + | { + id: string; + type: "backend"; + } + | { + identifier: string; + type: "server"; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_jwt"; + walletAddress?: string; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_auth_endpoint"; + walletAddress?: string; + } + >; + /** + * The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced wallet features. + */ + smartWalletAddress?: string; + /** + * The wallet's public key in hexadecimal format. Useful for peer-to-peer encryption and cryptographic operations. + */ + publicKey?: string; + }>; + }; + }; +}; + +export type ListServerWalletsResponse = + ListServerWalletsResponses[keyof ListServerWalletsResponses]; + +export type CreateServerWalletData = { + /** + * Request body for creating a wallet + */ + body?: { + /** + * Unique identifier for wallet creation or retrieval. Can be user ID, email, or any unique string. The same identifier will always return the same wallet. + */ + identifier: string; + }; + path?: never; + query?: never; + url: "/v1/wallets/server"; +}; + +export type CreateServerWalletErrors = { + /** + * Invalid request parameters. This occurs when the identifier format is invalid or required parameters are missing. + */ + 400: unknown; + /** + * Authentication required. For backend usage, include `x-secret-key` header. + */ + 401: unknown; + /** + * Internal server error. This may occur due to wallet service unavailability, smart wallet deployment issues, or unexpected server errors. + */ + 500: unknown; +}; + +export type CreateServerWalletResponses = { + /** + * Server wallet created or connected successfully. Returns wallet addresses for subsequent operations. + */ + 200: { + result: { + /** + * The EOA (Externally Owned Wallet) address of the wallet. This is the traditional wallet address. + */ + address?: string; + /** + * The date and time the wallet was created + */ + createdAt?: string; + /** + * AuthenticationProviderDetail + * Authentication provider details with type-based discrimination + */ + profiles: Array< + | { + email: string; + emailVerified: boolean; + familyName?: string; + givenName?: string; + hd: string; + id: string; + locale: string; + name?: string; + picture: string; + type: "google"; + } + | { + email?: string; + firstName?: string; + id: string; + lastName?: string; + name?: string; + picture?: string; + type: "facebook"; + } + | { + email?: string; + emailVerified: boolean; + id: string; + isPrivateEmail: boolean; + type: "apple"; + } + | { + avatar?: string; + id: string; + name?: string; + type: "github"; + username: string; + } + | { + avatar: string; + email?: string; + emailVerified: boolean; + id: string; + type: "discord"; + username: string; + } + | { + avatar?: string; + id: string; + name: string; + type: "coinbase"; + } + | { + id: string; + name: string; + type: "x"; + username: string; + profileImageUrl?: string; + } + | { + id: string; + displayName: string; + avatarUrl: string; + unionId?: string; + type: "tiktok"; + } + | { + avatar?: string; + id: string; + metadata: { + avatar: { + large?: string; + medium?: string; + small?: string; + }; + personaname?: string; + profileurl?: string; + realname?: string; + }; + type: "steam"; + username?: string; + } + | { + firstName?: string; + id: string; + lastName?: string; + picture?: string; + type: "telegram"; + username?: string; + } + | { + avatar?: string; + description?: string; + email?: string; + id: string; + type: "twitch"; + username: string; + } + | { + avatar?: string; + id: string; + type: "line"; + username?: string; + } + | { + fid: string; + id: string; + type: "farcaster"; + walletAddress?: string; + } + | { + algorithm: string; + credentialId: string; + publicKey: string; + type: "passkey"; + } + | { + email: string; + id: string; + type: "email"; + } + | { + id: string; + pregeneratedIdentifier: string; + type: "pre_generation"; + } + | { + id: string; + phone: string; + type: "phone"; + } + | { + id: string; + type: "siwe"; + walletAddress: string; + } + | { + id: string; + type: "guest"; + } + | { + id: string; + type: "backend"; + } + | { + identifier: string; + type: "server"; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_jwt"; + walletAddress?: string; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_auth_endpoint"; + walletAddress?: string; + } + >; + /** + * The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced wallet features. + */ + smartWalletAddress?: string; + /** + * The wallet's public key in hexadecimal format. Useful for peer-to-peer encryption and cryptographic operations. + */ + publicKey?: string; + }; + }; +}; + +export type CreateServerWalletResponse = + CreateServerWalletResponses[keyof CreateServerWalletResponses]; export type GetWalletBalanceData = { body?: never; path: { /** - * A valid Ethereum address, which is a 40-character hexadecimal string (0x prefixed) representing an account on the Ethereum blockchain. + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). */ address: string; }; @@ -1186,6 +1567,10 @@ export type GetWalletBalanceData = { * Chain ID(s) to request balance data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 */ chainId: Array; + /** + * The token contract address. Omit for native token (ETH, MATIC, etc.). + */ + tokenAddress?: string; }; url: "/v1/wallets/{address}/balance"; }; @@ -1250,35 +1635,51 @@ export type GetWalletTransactionsData = { body?: never; path: { /** - * A valid Ethereum address, which is a 40-character hexadecimal string (0x prefixed) representing an account on the Ethereum blockchain. + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). */ address: string; }; query: { /** - * Chain ID(s) to request transaction data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 + * Filter by block timestamp (Unix timestamp) greater than or equal to this value */ - chainId: Array; + filterBlockTimestampGte?: number; /** - * Whether to enable ABI decoding of transaction data. When true, returns decoded function calls if ABI is available. + * Filter by block timestamp (Unix timestamp) less than or equal to this value */ - decode?: boolean; + filterBlockTimestampLte?: number; /** - * The number of transactions to return per chain (default: 20, max: 500). + * Filter by block number greater than or equal to this value */ - limit?: number; + filterBlockNumberGte?: number; /** - * The page number for pagination (default: 0, max: 20). + * Filter by block number less than or equal to this value + */ + filterBlockNumberLte?: number; + /** + * Filter by transaction value (in wei) greater than this value + */ + filterValueGt?: string; + /** + * Filter by function selector (4-byte method ID), e.g., '0xa9059cbb' for ERC-20 transfer + */ + filterFunctionSelector?: string; + /** + * Current page number */ page?: number; /** - * Sort order - ascending or descending (default: desc). + * Number of items per page + */ + limit?: number; + /** + * Sort order: 'asc' for ascending, 'desc' for descending */ sortOrder?: "asc" | "desc"; /** - * Start time for filtering transactions (Unix timestamp). Default is 3 months ago. + * Chain ID(s) to request transaction data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 */ - startTime?: number; + chainId: Array; }; url: "/v1/wallets/{address}/transactions"; }; @@ -1304,7 +1705,7 @@ export type GetWalletTransactionsErrors = { export type GetWalletTransactionsResponses = { /** - * Wallet transactions retrieved successfully. Returns transaction data with metadata including pagination information and chain details. When decode=true, includes decoded function calls if ABI is available. + * Wallet transactions retrieved successfully. Returns transaction data with metadata including pagination information and chain details. Includes decoded function calls when ABI is available. */ 200: { result: { @@ -1316,11 +1717,11 @@ export type GetWalletTransactionsResponses = { /** * Number of items per page */ - limit: number; + limit?: number; /** * Current page number */ - page: number; + page?: number; /** * Total number of items available */ @@ -1359,7 +1760,7 @@ export type GetWalletTransactionsResponses = { */ data: string; /** - * Decoded transaction data (only present when decode=true and ABI is available). + * Decoded transaction data (included when ABI is available). */ decoded?: { /** @@ -1449,7 +1850,7 @@ export type GetWalletTokensData = { body?: never; path: { /** - * A valid Ethereum address, which is a 40-character hexadecimal string (0x prefixed) representing an account on the Ethereum blockchain. + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). */ address: string; }; @@ -1458,12 +1859,16 @@ export type GetWalletTokensData = { * Chain ID(s) to request token data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 */ chainId: Array; + /** + * Token addresses to filter by. If provided, only tokens with these addresses will be returned. + */ + tokenAddresses?: Array; /** * The number of tokens to return per chain (default: 20, max: 500). */ limit?: number; /** - * The page number for pagination (default: 0, max: 20). + * The page number for pagination (default: 1, max: 20). */ page?: number; }; @@ -1503,11 +1908,11 @@ export type GetWalletTokensResponses = { /** * Number of items per page */ - limit: number; + limit?: number; /** * Current page number */ - page: number; + page?: number; /** * Total number of items available */ @@ -1533,6 +1938,16 @@ export type GetWalletTokensResponses = { * The token name */ name?: string; + /** + * The token icon URI + */ + icon_uri?: string; + /** + * Price data + */ + prices?: { + [key: string]: number; + }; /** * Price data for the token */ @@ -1586,7 +2001,7 @@ export type GetWalletNftsData = { body?: never; path: { /** - * A valid Ethereum address, which is a 40-character hexadecimal string (0x prefixed) representing an account on the Ethereum blockchain. + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). */ address: string; }; @@ -1595,12 +2010,16 @@ export type GetWalletNftsData = { * Chain ID(s) to request NFT data for. You can specify multiple chain IDs by repeating the parameter, up to a maximum of 50. Example: ?chainId=1&chainId=137 */ chainId: Array; + /** + * NFT contract addresses to filter by. If provided, only NFTs with these addresses will be returned. + */ + contractAddresses?: Array; /** * The number of NFTs to return per chain (default: 20, max: 500). */ limit?: number; /** - * The page number for pagination (default: 0, max: 20). + * The page number for pagination (default: 1, max: 20). */ page?: number; }; @@ -1721,11 +2140,11 @@ export type GetWalletNftsResponses = { /** * Number of items per page */ - limit: number; + limit?: number; /** * Current page number */ - page: number; + page?: number; /** * Total number of items available */ @@ -1738,881 +2157,205 @@ export type GetWalletNftsResponses = { export type GetWalletNftsResponse = GetWalletNftsResponses[keyof GetWalletNftsResponses]; -export type GetWalletDetailsData = { - body?: never; - path: { - /** - * A valid Ethereum address, which is a 40-character hexadecimal string (0x prefixed) representing an account on the Ethereum blockchain. - */ - address: string; - }; - query?: never; - url: "/v1/wallets/{address}"; -}; - -export type GetWalletDetailsErrors = { +export type SignMessageData = { /** - * Invalid request parameters. This occurs when the wallet address format is invalid or malformed. - */ - 400: unknown; - /** - * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. - */ - 401: unknown; - /** - * Wallet not found. The specified wallet address does not exist or is not associated with any user in the system. - */ - 404: unknown; - /** - * Internal server error. This may occur due to service unavailability, network connectivity issues, or unexpected server errors. - */ - 500: unknown; -}; - -export type GetWalletDetailsResponses = { - /** - * Wallet details retrieved successfully. Returns comprehensive user information including authentication details and linked accounts. - */ - 200: { - result: { - /** - * The EOA (Externally Owned Account) address of the wallet. This is the traditional wallet address. - */ - address: string; - /** - * The date and time the wallet was created - */ - createdAt: string; - /** - * The profiles linked to the wallet, can be email, phone, google etc, or backend for developer created wallets - */ - profiles: Array< - | { - email: string; - emailVerified: boolean; - familyName?: string; - givenName?: string; - hd: string; - id: string; - locale: string; - name?: string; - picture: string; - type: "google"; - } - | { - email?: string; - firstName?: string; - id: string; - lastName?: string; - name?: string; - picture?: string; - type: "facebook"; - } - | { - email?: string; - emailVerified: boolean; - id: string; - isPrivateEmail: boolean; - type: "apple"; - } - | { - avatar?: string; - id: string; - name?: string; - type: "github"; - username: string; - } - | { - avatar: string; - email?: string; - emailVerified: boolean; - id: string; - type: "discord"; - username: string; - } - | { - avatar?: string; - id: string; - name: string; - type: "coinbase"; - } - | { - id: string; - name: string; - type: "x"; - username: string; - } - | { - avatar?: string; - id: string; - metadata: { - avatar: { - large?: string; - medium?: string; - small?: string; - }; - personaname?: string; - profileurl?: string; - realname?: string; - }; - type: "steam"; - username?: string; - } - | { - firstName?: string; - id: string; - lastName?: string; - picture?: string; - type: "telegram"; - username?: string; - } - | { - avatar?: string; - description?: string; - email?: string; - id: string; - type: "twitch"; - username: string; - } - | { - avatar?: string; - id: string; - type: "line"; - username?: string; - } - | { - fid: string; - id: string; - type: "farcaster"; - walletAddress?: string; - } - | { - algorithm: string; - credentialId: string; - publicKey: string; - type: "passkey"; - } - | { - email: string; - id: string; - type: "email"; - } - | { - id: string; - pregeneratedIdentifier: string; - type: "pre_generation"; - } - | { - id: string; - phone: string; - type: "phone"; - } - | { - id: string; - type: "siwe"; - walletAddress: string; - } - | { - id: string; - type: "guest"; - } - | { - id: string; - type: "backend"; - } - | { - identifier: string; - type: "server"; - } - | { - authProviderId?: string; - email?: string; - id: string; - phone?: string; - type: "custom_jwt"; - walletAddress?: string; - } - | { - authProviderId?: string; - email?: string; - id: string; - phone?: string; - type: "custom_auth_endpoint"; - walletAddress?: string; - } - >; - /** - * The smart wallet address with EIP-4337 support. This address enables gasless transactions and advanced account features. - */ - smartWalletAddress?: string; - }; - }; -}; - -export type GetWalletDetailsResponse = - GetWalletDetailsResponses[keyof GetWalletDetailsResponses]; - -export type SendCodeData = { - /** - * Request body for sending an OTP code to either email or phone - */ - body?: - | { - /** - * The email address to send the OTP code to - */ - email: string; - /** - * Send code to email address - */ - type: "email"; - } - | { - /** - * The phone number to send the OTP code to - */ - phone: string; - /** - * Send code to phone number - */ - type: "phone"; - }; - path?: never; - query?: never; - url: "/v1/wallets/login/code"; -}; - -export type SendCodeErrors = { - /** - * Invalid request parameters - */ - 400: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type SendCodeResponses = { - /** - * OTP sent successfully - */ - 200: { - success: boolean; - }; -}; - -export type SendCodeResponse = SendCodeResponses[keyof SendCodeResponses]; - -export type VerifyCodeData = { - /** - * Request body for verifying an OTP code for either email or phone - */ - body?: - | { - /** - * The 6-digit OTP code sent to the email address - */ - code: string; - /** - * The email address to verify - */ - email: string; - /** - * Verify code for email address - */ - type: "email"; - } - | { - /** - * The 6-digit OTP code sent to the phone number - */ - code: string; - /** - * The phone number to verify - */ - phone: string; - /** - * Verify code for phone number - */ - type: "phone"; - }; - path?: never; - query?: never; - url: "/v1/wallets/login/code/verify"; -}; - -export type VerifyCodeErrors = { - /** - * Invalid OTP or request parameters - */ - 400: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type VerifyCodeResponses = { - /** - * OTP verified successfully - */ - 200: { - isNewUser: boolean; - token: string; - type: string; - walletAddress: string; - }; -}; - -export type VerifyCodeResponse = VerifyCodeResponses[keyof VerifyCodeResponses]; - -export type InitOauthData = { - body?: never; - path?: never; - query: { - /** - * The thirdweb project client ID - */ - clientId: string; - /** - * The redirect URL post authentication - */ - redirectUrl?: string; - }; - url: "/v1/wallets/login/oauth/{provider}"; -}; - -export type InitOauthErrors = { - /** - * Invalid request parameters - */ - 400: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type GeneratePasskeyChallengeData = { - body?: never; - path?: never; - query: { - /** - * Authentication type for passkey - either sign-up for new users or sign-in for existing users - */ - type: "sign-up" | "sign-in"; - /** - * Optional username for passkey registration - */ - username?: string; - }; - url: "/v1/wallets/login/passkey"; -}; - -export type GeneratePasskeyChallengeErrors = { - /** - * Invalid request parameters - */ - 400: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type GeneratePasskeyChallengeResponses = { - /** - * Response containing passkey challenge data - */ - 200: { - /** - * Server verification ID for the passkey challenge - */ - serverVerificationId: string; - /** - * Passkey challenge string - */ - challenge: string; - /** - * Authentication type for passkey - either sign-up for new users or sign-in for existing users - */ - type: "sign-up" | "sign-in"; - }; -}; - -export type GeneratePasskeyChallengeResponse = - GeneratePasskeyChallengeResponses[keyof GeneratePasskeyChallengeResponses]; - -export type VerifyPasskeyData = { - /** - * Request body for validating passkey authentication + * Request body for signing a message */ body?: { /** - * Authentication type for passkey - either sign-up for new users or sign-in for existing users - */ - type: "sign-up" | "sign-in"; - /** - * Authenticator data from the passkey response - */ - authenticatorData: string; - /** - * Credential ID from the passkey response - */ - credentialId: string; - /** - * Server verification ID from the challenge - */ - serverVerificationId: string; - /** - * Client data from the passkey response - */ - clientData: string; - /** - * Origin of the request - */ - origin?: string; - /** - * Relying Party ID - */ - rpId?: string; - /** - * Signature for passkey sign in - */ - signature?: string; - /** - * Username for passkey registration - */ - username?: string; - /** - * Credential data for passkey registration - */ - credential?: { - /** - * Public key for the credential - */ - publicKey: string; - /** - * Algorithm used for the credential - */ - algorithm: "RS256" | "ES256"; - }; - }; - path?: never; - query?: never; - url: "/v1/wallets/login/passkey/verify"; -}; - -export type VerifyPasskeyErrors = { - /** - * Invalid passkey or request parameters - */ - 400: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type VerifyPasskeyResponses = { - /** - * Passkey verified successfully - */ - 200: { - isNewUser: boolean; - token: string; - type: string; - walletAddress: string; - }; -}; - -export type VerifyPasskeyResponse = - VerifyPasskeyResponses[keyof VerifyPasskeyResponses]; - -export type GenerateSiwePayloadData = { - body?: never; - path?: never; - query: { - /** - * The Ethereum wallet address to generate SIWE payload for - */ - address: string; - /** - * The chain ID for the SIWE payload - */ - chainId: number; - }; - url: "/v1/wallets/login/siwe"; -}; - -export type GenerateSiwePayloadErrors = { - /** - * Invalid request parameters - */ - 400: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type GenerateSiwePayloadResponses = { - /** - * SIWE (Sign-In with Ethereum) payload structure - */ - 200: { - /** - * The domain requesting the signature - */ - domain: string; - /** - * The Ethereum address performing the signing - */ - address: string; - /** - * A human-readable ASCII assertion that the user will sign - */ - statement: string; - /** - * A URI referring to the resource that is the subject of the signing - */ - uri?: string; - /** - * The current version of the SIWE Message - */ - version: string; - /** - * The Chain ID to which the session is bound - */ - chain_id?: string; - /** - * A randomized token used to prevent replay attacks - */ - nonce: string; - /** - * The time when the message was generated - */ - issued_at: string; - /** - * The time when the signed authentication message is no longer valid - */ - expiration_time: string; - /** - * The time when the signed authentication message will become valid - */ - invalid_before: string; - /** - * A list of information or references to information the user wishes to have resolved - */ - resources?: Array; - }; -}; - -export type GenerateSiwePayloadResponse = - GenerateSiwePayloadResponses[keyof GenerateSiwePayloadResponses]; - -export type VerifySiweSignatureData = { - /** - * Request body for verifying SIWE signature - */ - body?: { - /** - * The signature generated by signing the SIWE payload - */ - signature: string; - /** - * SIWE (Sign-In with Ethereum) payload structure - */ - payload: { - /** - * The domain requesting the signature - */ - domain: string; - /** - * The Ethereum address performing the signing - */ - address: string; - /** - * A human-readable ASCII assertion that the user will sign - */ - statement: string; - /** - * A URI referring to the resource that is the subject of the signing - */ - uri?: string; - /** - * The current version of the SIWE Message - */ - version: string; - /** - * The Chain ID to which the session is bound - */ - chain_id?: string; - /** - * A randomized token used to prevent replay attacks - */ - nonce: string; - /** - * The time when the message was generated - */ - issued_at: string; - /** - * The time when the signed authentication message is no longer valid - */ - expiration_time: string; - /** - * The time when the signed authentication message will become valid - */ - invalid_before: string; - /** - * A list of information or references to information the user wishes to have resolved - */ - resources?: Array; - }; - }; - path?: never; - query?: never; - url: "/v1/wallets/login/siwe/verify"; -}; - -export type VerifySiweSignatureErrors = { - /** - * Invalid signature or request parameters - */ - 400: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type VerifySiweSignatureResponses = { - /** - * SIWE signature verified successfully - */ - 200: { - isNewUser: boolean; - token: string; - type: string; - walletAddress: string; - }; -}; - -export type VerifySiweSignatureResponse = - VerifySiweSignatureResponses[keyof VerifySiweSignatureResponses]; - -export type ListTransactionsData = { - body?: never; - path?: never; - query?: { - /** - * Filter transactions by sender wallet address. - */ - from?: string; - /** - * Number of transactions to return per page (1-100). - */ - limit?: number; - /** - * Page number for pagination, starting from 1. - */ - page?: number; - }; - url: "/v1/transactions"; -}; - -export type ListTransactionsErrors = { - /** - * Invalid request parameters. This occurs when pagination parameters are out of range or wallet address format is invalid. - */ - 400: unknown; - /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. - */ - 401: unknown; - /** - * Internal server error. This may occur due to engine connectivity issues, database unavailability, or unexpected server errors. - */ - 500: unknown; -}; - -export type ListTransactionsResponses = { - /** - * Transactions retrieved successfully. Returns a paginated list of transactions with metadata including creation and confirmation timestamps. - */ - 200: { - result: { - pagination: { - /** - * Whether there are more items available - */ - hasMore?: boolean; - /** - * Number of items per page - */ - limit: number; - /** - * Current page number - */ - page: number; - /** - * Total number of items available - */ - totalCount?: number; - }; - transactions: Array<{ - /** - * Index within transaction batch - */ - batchIndex: number; - /** - * ISO timestamp when transaction was cancelled, if applicable - */ - cancelledAt: string; - /** - * Blockchain network identifier as string - */ - chainId: string; - /** - * Client identifier that initiated the transaction - */ - clientId: string; - /** - * ISO timestamp when transaction was confirmed on-chain - */ - confirmedAt: string; - /** - * Block number where transaction was confirmed - */ - confirmedAtBlockNumber: string; - /** - * ISO timestamp when transaction was created - */ - createdAt: string; - /** - * Additional metadata and enriched transaction information - */ - enrichedData?: unknown; - /** - * Error message if transaction failed - */ - errorMessage: string; - /** - * Parameters used for transaction execution - */ - executionParams?: unknown; - /** - * Result data from transaction execution - */ - executionResult?: unknown; - /** - * Sender wallet address - */ - from: string; - /** - * Unique transaction identifier - */ - id: string; - /** - * On-chain transaction hash once confirmed - */ - transactionHash: string; - /** - * Original transaction parameters and data - */ - transactionParams?: unknown; - }>; - }; - }; -}; - -export type ListTransactionsResponse = - ListTransactionsResponses[keyof ListTransactionsResponses]; - -export type SendTransactionsData = { - /** - * Transaction Request - * Request object containing an array of blockchain transactions to execute. All transactions must use the same from address and chainId. Supports batching multiple transactions of different types in a single request. - */ - body?: { - /** - * The blockchain network identifier where all transactions will be executed. - */ - chainId: number; - /** - * The wallet address that will send the transaction. + * The wallet address or ENS name that will sign the message. */ from: string; /** - * Transaction - * A blockchain transaction of one of three supported types: contract call, encoded transaction, or native token transfer. + * The blockchain network identifier where the signing will occur. Common values include: 1 (Ethereum), 137 (Polygon), 56 (BSC). */ - transactions: Array< - | { - /** - * The smart contract address to interact with. - */ - contractAddress: string; - /** - * The contract function signature to call (e.g., 'function approve(address spender, uint256 amount)'). Must start with 'function' followed by the function name and parameters as defined in the contract ABI. - */ - method: string; - /** - * Array of parameters to pass to the contract method, in the correct order and format. - */ - params?: Array; - /** - * Transaction type for smart contract method calls - */ - type: "contract-call"; - /** - * Amount of native token to send with the transaction in wei. Required for payable methods. - */ - value?: string; - } - | { - /** - * Transaction data in hexadecimal format for contract interactions or custom payloads. - */ - data: string; - /** - * The target address for the encoded transaction. - */ - to: string; - /** - * Transaction type for pre-encoded transaction data - */ - type: "encoded"; - /** - * Amount of native token to send in wei (smallest unit). Use '0' or omit for non-value transactions. - */ - value?: string; - } - | { - /** - * The recipient wallet address. - */ - to: string; - /** - * Transaction type for native token transfers - */ - type: "native-transfer"; - /** - * Amount of native token to send in wei (smallest unit). - */ - value: string; - } - >; + chainId: number; + /** + * The message to be signed. Can be plain text or hexadecimal format (starting with 0x). The format is automatically detected. + */ + message: string; }; path?: never; query?: never; - url: "/v1/transactions"; + url: "/v1/wallets/sign-message"; }; -export type SendTransactionsErrors = { +export type SignMessageErrors = { /** - * Invalid request parameters. This occurs when transaction parameters are malformed, insufficient balance, invalid contract data, or unsupported transaction type. + * Invalid request parameters. This occurs when the wallet address format is invalid, chainId is not supported, or the message format is incorrect. + */ + 400: unknown; + /** + * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. + */ + 401: unknown; + /** + * Internal server error. This may occur due to wallet connectivity issues, signing service unavailability, or unexpected server errors. + */ + 500: unknown; +}; + +export type SignMessageResponses = { + /** + * Message signed successfully. Returns the cryptographic signature that can be used for verification. + */ + 200: { + result: { + /** + * The cryptographic signature in hexadecimal format. This can be used for verification and authentication purposes. + */ + signature: string; + }; + }; +}; + +export type SignMessageResponse = + SignMessageResponses[keyof SignMessageResponses]; + +export type SignTypedDataData = { + /** + * Request body for signing typed data + */ + body?: { + /** + * The wallet address or ENS name that will sign the typed data. + */ + from: string; + /** + * The blockchain network identifier for EIP-712 domain separation. + */ + chainId: number; + /** + * EIP-712 domain separator containing contract and chain information for signature verification. + */ + domain: { + /** + * Chain ID as string for domain separation + */ + chainId?: string; + /** + * The domain name (e.g., token name) + */ + name?: string; + /** + * Optional salt for additional entropy + */ + salt?: string; + /** + * The contract address that will verify this signature + */ + verifyingContract?: string; + /** + * Domain version for signature compatibility + */ + version?: string; + }; + /** + * The structured data to be signed, matching the defined types schema. + */ + message: { + [key: string]: unknown; + }; + /** + * The primary type name from the types object that defines the main structure being signed. + */ + primaryType: string; + /** + * Type definitions for the structured data, following EIP-712 specifications. + */ + types: { + [key: string]: Array<{ + /** + * The field name + */ + name: string; + /** + * The Solidity type (e.g., 'address', 'uint256') + */ + type: string; + }>; + }; + }; + path?: never; + query?: never; + url: "/v1/wallets/sign-typed-data"; +}; + +export type SignTypedDataErrors = { + /** + * Invalid request parameters. This occurs when the typed data structure is malformed, domain parameters are incorrect, or wallet address format is invalid. + */ + 400: unknown; + /** + * Authentication required. The request must include valid `x-wallet-access-token` headers for accessing the wallet, as well as a x-client-id (frontend) or x-secret-key (backend) for project authentication. + */ + 401: unknown; + /** + * Internal server error. This may occur due to wallet connectivity issues, signing service unavailability, or unexpected server errors. + */ + 500: unknown; +}; + +export type SignTypedDataResponses = { + /** + * Typed data signed successfully. Returns the EIP-712 compliant signature that can be used for on-chain verification. + */ + 200: { + result: { + /** + * The cryptographic signature in hexadecimal format. This can be used for verification and authentication purposes. + */ + signature: string; + }; + }; +}; + +export type SignTypedDataResponse = + SignTypedDataResponses[keyof SignTypedDataResponses]; + +export type SendTokensData = { + /** + * Request body for sending tokens to multiple recipients. Supports native tokens, ERC20, ERC721, and ERC1155 transfers based on the provided parameters. + */ + body?: { + /** + * The wallet address or ENS name that will send the tokens. + */ + from: string; + /** + * The blockchain network identifier where the transfer will be executed. + */ + chainId: number; + /** + * Array of recipients and quantities. Maximum 100 recipients per request. + */ + recipients: Array<{ + /** + * The recipient wallet address or ENS name + */ + address: string; + /** + * The amount to send. For native tokens and ERC20: amount in wei/smallest unit. For ERC721: should be '1'. For ERC1155: the number of tokens to transfer. + */ + quantity: string; + }>; + /** + * The token contract address. Omit for native token (ETH, MATIC, etc.) transfers. + */ + tokenAddress?: string; + /** + * The token ID for NFT transfers (ERC721/ERC1155). Required for NFT transfers. + */ + tokenId?: string; + }; + path?: never; + query?: never; + url: "/v1/wallets/send"; +}; + +export type SendTokensErrors = { + /** + * Invalid request parameters. This occurs when token parameters are malformed, insufficient balance, invalid contract data, or unsupported token type. */ 400: unknown; /** @@ -2625,9 +2368,341 @@ export type SendTransactionsErrors = { 500: unknown; }; -export type SendTransactionsResponses = { +export type SendTokensResponses = { /** - * Transaction submitted successfully. Returns the transaction ID for tracking and monitoring. + * Tokens sent successfully. Returns transaction IDs for tracking and monitoring. + */ + 200: { + result: { + /** + * Array of transaction IDs for the submitted transfers. One ID per recipient. + */ + transactionIds: Array; + }; + }; +}; + +export type SendTokensResponse = SendTokensResponses[keyof SendTokensResponses]; + +export type ListContractsData = { + body?: never; + path?: never; + query?: { + /** + * The number of contracts to return (default: 20, max: 100). + */ + limit?: number; + /** + * The page number for pagination (default: 1). + */ + page?: number; + }; + url: "/v1/contracts"; +}; + +export type ListContractsErrors = { + /** + * Invalid request parameters + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. + */ + 401: unknown; + /** + * Rate limit exceeded + */ + 429: unknown; + /** + * Internal server error + */ + 500: unknown; +}; + +export type ListContractsResponses = { + /** + * Successfully retrieved list of contracts + */ + 200: { + result: { + /** + * Array of contracts imported by the client. + */ + contracts: Array<{ + /** + * The contract address. + */ + address: string; + /** + * The chain ID where the contract is deployed. + */ + chainId: string; + /** + * The date when the contract was deployed. + */ + deployedAt?: string; + /** + * The contract ID. + */ + id?: string; + /** + * The date when the contract was imported to the dashboard. + */ + importedAt: string; + /** + * The contract name, if available. + */ + name?: string; + /** + * The contract symbol, if available. + */ + symbol?: string; + /** + * The contract type (e.g., ERC20, ERC721, etc.). + */ + type?: string; + }>; + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; + }; + }; +}; + +export type ListContractsResponse = + ListContractsResponses[keyof ListContractsResponses]; + +export type DeployContractData = { + /** + * Contract deployment specification for raw bytecode deployment. + */ + body?: { + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + chainId: number; + /** + * The wallet address or ENS name that will deploy the contract. + */ + from: string; + /** + * The contract bytecode as a hex string. + */ + bytecode: string; + /** + * The contract ABI array. + */ + abi: Array; + /** + * Object containing constructor parameters for the contract deployment (e.g., { param1: 'value1', param2: 123 }). + */ + constructorParams?: { + [key: string]: unknown; + }; + /** + * Optional salt value for deterministic contract deployment. + */ + salt?: string; + }; + path?: never; + query?: never; + url: "/v1/contracts"; +}; + +export type DeployContractErrors = { + /** + * Invalid request parameters + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. + */ + 401: unknown; + /** + * Rate limit exceeded + */ + 429: unknown; + /** + * Internal server error + */ + 500: unknown; +}; + +export type DeployContractResponses = { + /** + * Contract deployed successfully + */ + 200: { + result: { + /** + * The deployed contract address. + */ + address: string; + /** + * The chain ID where the contract was deployed. + */ + chainId: number; + /** + * The unique identifier for the transaction that deployed the contract. Will not be returned if the contract was already deployed at the predicted address. + */ + transactionId?: string; + }; + }; +}; + +export type DeployContractResponse = + DeployContractResponses[keyof DeployContractResponses]; + +export type ReadContractData = { + body?: { + /** + * Array of contract method calls to execute. Each call specifies a contract address, method signature, and optional parameters. + */ + calls: Array<{ + /** + * The smart contract address or ENS name. + */ + contractAddress: string; + /** + * The contract function signature to call (e.g., 'function approve(address spender, uint256 amount)' or `function balanceOf(address)`). Must start with 'function' followed by the function name and parameters as defined in the contract ABI. + */ + method: string; + /** + * Array of parameters to pass to the contract method, in the correct order and format. + */ + params?: Array; + /** + * Amount of native token to send with the transaction in wei. Required for payable methods. + */ + value?: string; + }>; + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + chainId: number; + }; + path?: never; + query?: never; + url: "/v1/contracts/read"; +}; + +export type ReadContractErrors = { + /** + * Invalid request parameters. This occurs when the chainId is not supported, contract addresses are invalid, function signatures are malformed, or the calls array is empty. + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + */ + 401: unknown; + /** + * Internal server error. This may occur due to engine connectivity issues, RPC node unavailability, or unexpected server errors. + */ + 500: unknown; +}; + +export type ReadContractResponses = { + /** + * Contract read operations completed successfully. Returns an array of results corresponding to each input call, including both successful and failed operations. + */ + 200: { + /** + * Array of results corresponding to each contract read call. Results are returned in the same order as the input calls. + */ + result: Array<{ + /** + * The result of the contract read operation. The type and format depend on the method's return value as defined in the contract ABI. + */ + data?: unknown; + /** + * Error message if the contract read operation failed. + */ + error?: string; + /** + * Indicates whether the contract read operation was successful. + */ + success: boolean; + }>; + }; +}; + +export type ReadContractResponse = + ReadContractResponses[keyof ReadContractResponses]; + +export type WriteContractData = { + body?: { + /** + * Array of contract method calls to execute. Each call specifies a contract address, method signature, and optional parameters. + */ + calls: Array<{ + /** + * The smart contract address or ENS name. + */ + contractAddress: string; + /** + * The contract function signature to call (e.g., 'function approve(address spender, uint256 amount)' or `function balanceOf(address)`). Must start with 'function' followed by the function name and parameters as defined in the contract ABI. + */ + method: string; + /** + * Array of parameters to pass to the contract method, in the correct order and format. + */ + params?: Array; + /** + * Amount of native token to send with the transaction in wei. Required for payable methods. + */ + value?: string; + }>; + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + chainId: number; + /** + * The wallet address or ENS name that will send the transaction. + */ + from: string; + }; + path?: never; + query?: never; + url: "/v1/contracts/write"; +}; + +export type WriteContractErrors = { + /** + * Invalid request parameters. This occurs when contract parameters are malformed, method signatures are invalid, insufficient balance, or unsupported contract methods. + */ + 400: unknown; + /** + * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. + */ + 401: unknown; + /** + * Contract not found. The specified contract address does not exist on the given blockchain network or is not accessible. + */ + 404: unknown; + /** + * Internal server error. This may occur due to blockchain connectivity issues, gas estimation failures, contract execution errors, or unexpected server errors. + */ + 500: unknown; +}; + +export type WriteContractResponses = { + /** + * Contract write operations submitted successfully. Returns transaction IDs for tracking and monitoring. */ 200: { result: { @@ -2639,8 +2714,601 @@ export type SendTransactionsResponses = { }; }; -export type SendTransactionsResponse = - SendTransactionsResponses[keyof SendTransactionsResponses]; +export type WriteContractResponse = + WriteContractResponses[keyof WriteContractResponses]; + +export type GetContractTransactionsData = { + body?: never; + path: { + /** + * The blockchain network identifier where the contract is deployed. + */ + chainId: number; + /** + * The smart contract address or ENS name. + */ + address: string; + }; + query?: { + /** + * Filter by transaction sender address + */ + filterFromAddress?: string; + /** + * Filter by transaction recipient address + */ + filterToAddress?: string; + /** + * Filter by block timestamp (Unix timestamp) greater than or equal to this value + */ + filterBlockTimestampGte?: number; + /** + * Filter by block timestamp (Unix timestamp) less than or equal to this value + */ + filterBlockTimestampLte?: number; + /** + * Filter by block number greater than or equal to this value + */ + filterBlockNumberGte?: number; + /** + * Filter by block number less than or equal to this value + */ + filterBlockNumberLte?: number; + /** + * Filter by transaction value (in wei) greater than this value + */ + filterValueGt?: string; + /** + * Filter by function selector (4-byte method ID), e.g., '0xa9059cbb' for ERC-20 transfer + */ + filterFunctionSelector?: string; + /** + * Current page number + */ + page?: number; + /** + * Number of items per page + */ + limit?: number; + /** + * Sort order: 'asc' for ascending, 'desc' for descending + */ + sortOrder?: "asc" | "desc"; + }; + url: "/v1/contracts/{chainId}/{address}/transactions"; +}; + +export type GetContractTransactionsErrors = { + /** + * Invalid request parameters. This occurs when the contract address or chainId format is invalid, or pagination parameters are out of range. + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + */ + 401: unknown; + /** + * Contract not found or no transactions available for the specified contract address on the given blockchain network. + */ + 404: unknown; + /** + * Internal server error. This may occur due to network connectivity issues, external service unavailability, or unexpected server errors. + */ + 500: unknown; +}; + +export type GetContractTransactionsResponses = { + /** + * Contract transactions retrieved successfully. Returns transaction data with metadata including pagination information. Includes decoded function calls when ABI is available. + */ + 200: { + result: { + /** + * Array of contract transactions. + */ + data: Array<{ + /** + * The hash of the block containing this transaction. + */ + blockHash: string; + /** + * The block number containing this transaction. + */ + blockNumber: number; + /** + * The timestamp of the block (Unix timestamp). + */ + blockTimestamp: number; + /** + * The chain ID where the transaction occurred. + */ + chainId: string; + /** + * Contract address created if this was a contract creation transaction. + */ + contractAddress?: string; + /** + * Total gas used by all transactions in this block up to and including this one. + */ + cumulativeGasUsed?: number; + /** + * The transaction input data. + */ + data: string; + /** + * Decoded transaction data (included when ABI is available). + */ + decoded?: { + /** + * Object containing decoded function parameters. + */ + inputs: { + [key: string]: unknown; + }; + /** + * The function name. + */ + name: string; + /** + * The function signature. + */ + signature: string; + }; + /** + * The effective gas price paid (in wei as string). + */ + effectiveGasPrice?: string; + /** + * The address that initiated the transaction. + */ + fromAddress: string; + /** + * The function selector (first 4 bytes of the transaction data). + */ + functionSelector: string; + /** + * The gas limit for the transaction. + */ + gas: number; + /** + * The gas price used for the transaction (in wei as string). + */ + gasPrice: string; + /** + * The amount of gas used by the transaction. + */ + gasUsed?: number; + /** + * The transaction hash. + */ + hash: string; + /** + * Maximum fee per gas (EIP-1559). + */ + maxFeePerGas?: string; + /** + * Maximum priority fee per gas (EIP-1559). + */ + maxPriorityFeePerGas?: string; + /** + * The transaction nonce. + */ + nonce: number; + /** + * The transaction status (1 for success, 0 for failure). + */ + status: number; + /** + * The address that received the transaction. + */ + toAddress: string; + /** + * The index of the transaction within the block. + */ + transactionIndex: number; + /** + * The transaction type (0=legacy, 1=EIP-2930, 2=EIP-1559). + */ + transactionType?: number; + /** + * The value transferred in the transaction (in wei as string). + */ + value: string; + }>; + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; + }; + }; +}; + +export type GetContractTransactionsResponse = + GetContractTransactionsResponses[keyof GetContractTransactionsResponses]; + +export type GetContractEventsData = { + body?: never; + path: { + /** + * The blockchain network identifier where the contract is deployed. + */ + chainId: number; + /** + * The smart contract address or ENS name. + */ + address: string; + }; + query?: { + /** + * Filter by event signature hash, e.g., '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' for Transfer event + */ + signature?: string; + /** + * Filter by event topic 0 (event signature hash) + */ + filterTopic0?: string; + /** + * Filter by event topic 1 + */ + filterTopic1?: string; + /** + * Filter by event topic 2 + */ + filterTopic2?: string; + /** + * Filter by event topic 3 + */ + filterTopic3?: string; + /** + * Filter by block timestamp (Unix timestamp) greater than or equal to this value + */ + filterBlockTimestampGte?: number; + /** + * Filter by block timestamp (Unix timestamp) less than or equal to this value + */ + filterBlockTimestampLte?: number; + /** + * Filter by block number greater than or equal to this value + */ + filterBlockNumberGte?: number; + /** + * Filter by block number less than or equal to this value + */ + filterBlockNumberLte?: number; + /** + * Current page number + */ + page?: number; + /** + * Number of items per page + */ + limit?: number; + /** + * Sort order: 'asc' for ascending, 'desc' for descending + */ + sortOrder?: "asc" | "desc"; + }; + url: "/v1/contracts/{chainId}/{address}/events"; +}; + +export type GetContractEventsErrors = { + /** + * Invalid request parameters. This occurs when the contract address or chainId format is invalid, or pagination parameters are out of range. + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + */ + 401: unknown; + /** + * Contract not found or no events available for the specified contract address on the given blockchain network. + */ + 404: unknown; + /** + * Internal server error. This may occur due to network connectivity issues, external service unavailability, or unexpected server errors. + */ + 500: unknown; +}; + +export type GetContractEventsResponses = { + /** + * Contract events retrieved successfully. Returns event data with metadata including pagination information. Includes decoded event parameters when ABI is available. + */ + 200: { + result: { + /** + * Array of contract events. + */ + events: Array<{ + /** + * The contract address that emitted the event. + */ + address: string; + /** + * The hash of the block containing this event. + */ + blockHash: string; + /** + * The block number where the event was emitted. + */ + blockNumber: number; + /** + * The timestamp of the block (Unix timestamp). + */ + blockTimestamp: number; + /** + * The chain ID where the event occurred. + */ + chainId: string; + /** + * The non-indexed event data as a hex string. + */ + data: string; + /** + * Decoded event data (included when ABI is available). + */ + decoded?: { + /** + * The event name. + */ + name: string; + /** + * Object containing decoded parameters. + */ + params: { + [key: string]: unknown; + }; + /** + * The event signature. + */ + signature: string; + }; + /** + * The index of the log within the transaction. + */ + logIndex: number; + /** + * Array of indexed event topics (including event signature). + */ + topics: Array; + /** + * The hash of the transaction containing this event. + */ + transactionHash: string; + /** + * The index of the transaction within the block. + */ + transactionIndex: number; + }>; + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; + }; + }; +}; + +export type GetContractEventsResponse = + GetContractEventsResponses[keyof GetContractEventsResponses]; + +export type GetContractMetadataData = { + body?: never; + path: { + /** + * The blockchain network identifier where the contract is deployed. + */ + chainId: number; + /** + * The smart contract address or ENS name. + */ + address: string; + }; + query?: never; + url: "/v1/contracts/{chainId}/{address}/metadata"; +}; + +export type GetContractMetadataErrors = { + /** + * Invalid request parameters + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. + */ + 401: unknown; + /** + * Contract metadata not found + */ + 404: unknown; + /** + * Rate limit exceeded + */ + 429: unknown; + /** + * Internal server error + */ + 500: unknown; +}; + +export type GetContractMetadataResponses = { + /** + * Contract metadata from the thirdweb contract metadata service. + */ + 200: { + result: { + /** + * Compiler information including version. + */ + compiler?: { + /** + * Solidity compiler version used to compile the contract. + */ + version: string; + }; + /** + * Programming language of the contract (e.g., 'Solidity'). + */ + language?: string; + /** + * Compilation output including ABI and documentation. + */ + output?: { + /** + * Contract ABI (Application Binary Interface) as an array of function/event/error definitions. + */ + abi?: Array; + /** + * Developer documentation extracted from contract comments. + */ + devdoc?: { + [key: string]: unknown; + }; + /** + * User documentation extracted from contract comments. + */ + userdoc?: { + [key: string]: unknown; + }; + }; + /** + * Compilation settings including optimization and target configuration. + */ + settings?: { + /** + * Compilation target mapping source file names to contract names. + */ + compilationTarget?: { + [key: string]: string; + }; + /** + * EVM version target for compilation. + */ + evmVersion?: string; + /** + * Library addresses for linking. + */ + libraries?: { + [key: string]: unknown; + }; + /** + * Metadata settings for compilation. + */ + metadata?: { + /** + * Hash method used for bytecode metadata. + */ + bytecodeHash?: string; + }; + /** + * Optimizer settings used during compilation. + */ + optimizer?: { + /** + * Whether optimizer is enabled. + */ + enabled?: boolean; + /** + * Number of optimizer runs. + */ + runs?: number; + }; + /** + * Import remappings used during compilation. + */ + remappings?: Array; + }; + /** + * Metadata format version. + */ + version?: number; + }; + }; +}; + +export type GetContractMetadataResponse = + GetContractMetadataResponses[keyof GetContractMetadataResponses]; + +export type GetContractSignaturesData = { + body?: never; + path: { + /** + * The blockchain network identifier where the contract is deployed. + */ + chainId: number; + /** + * The smart contract address or ENS name. + */ + address: string; + }; + query?: never; + url: "/v1/contracts/{chainId}/{address}/signatures"; +}; + +export type GetContractSignaturesErrors = { + /** + * Invalid request parameters + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-secret-key` header for backend authentication. + */ + 401: unknown; + /** + * Contract metadata not found or ABI is not available + */ + 404: unknown; + /** + * Rate limit exceeded + */ + 429: unknown; + /** + * Internal server error + */ + 500: unknown; +}; + +export type GetContractSignaturesResponses = { + /** + * Contract ABI signatures in human-readable format. These signatures can be used directly with contract interaction methods. + */ + 200: { + /** + * Array of human-readable ABI signatures including functions and events. Each signature is formatted as a string that can be used directly in contract read/write operations or event filtering. + */ + result: Array; + }; +}; + +export type GetContractSignaturesResponse = + GetContractSignaturesResponses[keyof GetContractSignaturesResponses]; export type GetTransactionByIdData = { body?: never; @@ -2739,6 +3407,10 @@ export type GetTransactionByIdResponses = { * Original transaction parameters and data */ transactionParams?: unknown; + /** + * Transaction status + */ + status: "QUEUED" | "SUBMITTED" | "CONFIRMED" | "FAILED"; }; }; }; @@ -2746,29 +3418,178 @@ export type GetTransactionByIdResponses = { export type GetTransactionByIdResponse = GetTransactionByIdResponses[keyof GetTransactionByIdResponses]; -export type SignMessageData = { +export type ListTransactionsData = { + body?: never; + path?: never; + query?: { + /** + * Filter transactions by sender wallet address or ENS name. + */ + from?: string; + /** + * Number of transactions to return per page (1-100). + */ + limit?: number; + /** + * Page number for pagination, starting from 1. + */ + page?: number; + }; + url: "/v1/transactions"; +}; + +export type ListTransactionsErrors = { + /** + * Invalid request parameters. This occurs when pagination parameters are out of range or wallet address format is invalid. + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + */ + 401: unknown; + /** + * Internal server error. This may occur due to engine connectivity issues, database unavailability, or unexpected server errors. + */ + 500: unknown; +}; + +export type ListTransactionsResponses = { + /** + * Transactions retrieved successfully. Returns a paginated list of transactions with metadata including creation and confirmation timestamps. + */ + 200: { + result: { + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; + transactions: Array<{ + /** + * Index within transaction batch + */ + batchIndex: number; + /** + * ISO timestamp when transaction was cancelled, if applicable + */ + cancelledAt: string; + /** + * Blockchain network identifier as string + */ + chainId: string; + /** + * Client identifier that initiated the transaction + */ + clientId: string; + /** + * ISO timestamp when transaction was confirmed on-chain + */ + confirmedAt: string; + /** + * Block number where transaction was confirmed + */ + confirmedAtBlockNumber: string; + /** + * ISO timestamp when transaction was created + */ + createdAt: string; + /** + * Additional metadata and enriched transaction information + */ + enrichedData?: unknown; + /** + * Error message if transaction failed + */ + errorMessage: string; + /** + * Parameters used for transaction execution + */ + executionParams?: unknown; + /** + * Result data from transaction execution + */ + executionResult?: unknown; + /** + * Sender wallet address + */ + from: string; + /** + * Unique transaction identifier + */ + id: string; + /** + * On-chain transaction hash once confirmed + */ + transactionHash: string; + /** + * Original transaction parameters and data + */ + transactionParams?: unknown; + /** + * Transaction status + */ + status: "QUEUED" | "SUBMITTED" | "CONFIRMED" | "FAILED"; + }>; + }; + }; +}; + +export type ListTransactionsResponse = + ListTransactionsResponses[keyof ListTransactionsResponses]; + +export type SendTransactionsData = { + /** + * Transaction Request + * Request object containing an array of encoded blockchain transactions to execute. All transactions must use the same from address and chainId. For contract calls, use /v1/contracts/write. For native token transfers, use /v1/wallets/send. + */ body?: { /** - * The blockchain network identifier where the signing will occur. Common values include: 1 (Ethereum), 137 (Polygon), 56 (BSC). + * The blockchain network identifier where all transactions will be executed. */ chainId: number; /** - * The wallet address that will sign the message. + * The wallet address or ENS name that will send the transaction. */ from: string; /** - * The message to be signed. Can be plain text or hexadecimal format (starting with 0x). The format is automatically detected. + * Array of encoded blockchain transactions to execute. All transactions will use the same from address and chainId. */ - message: string; + transactions: Array<{ + /** + * Transaction data in hexadecimal format for contract interactions or custom payloads. + */ + data: string; + /** + * The target address or ENS name for the transaction. + */ + to: string; + /** + * Amount of native token to send in wei (smallest unit). Use '0' or omit for non-value transactions. + */ + value?: string; + }>; }; path?: never; query?: never; - url: "/v1/sign/message"; + url: "/v1/transactions"; }; -export type SignMessageErrors = { +export type SendTransactionsErrors = { /** - * Invalid request parameters. This occurs when the wallet address format is invalid, chainId is not supported, or the message format is incorrect. + * Invalid request parameters. This occurs when transaction data is malformed, insufficient balance, or invalid encoded data. */ 400: unknown; /** @@ -2776,155 +3597,78 @@ export type SignMessageErrors = { */ 401: unknown; /** - * Internal server error. This may occur due to wallet connectivity issues, signing service unavailability, or unexpected server errors. + * Internal server error. This may occur due to blockchain connectivity issues, gas estimation failures, or unexpected server errors. */ 500: unknown; }; -export type SignMessageResponses = { +export type SendTransactionsResponses = { /** - * Message signed successfully. Returns the cryptographic signature that can be used for verification. + * Encoded transactions submitted successfully. Returns the transaction IDs for tracking and monitoring. */ 200: { result: { /** - * The cryptographic signature in hexadecimal format. This can be used for verification and authentication purposes. + * Array of unique identifiers for the submitted transactions. Use these to track transaction status. */ - signature: string; + transactionIds: Array; }; }; }; -export type SignMessageResponse = - SignMessageResponses[keyof SignMessageResponses]; +export type SendTransactionsResponse = + SendTransactionsResponses[keyof SendTransactionsResponses]; -export type SignTypedDataData = { - body?: { - /** - * The blockchain network identifier for EIP-712 domain separation. - */ - chainId: number; - /** - * EIP-712 domain separator containing contract and chain information for signature verification. - */ - domain: { - /** - * Chain ID as string for domain separation - */ - chainId?: string; - /** - * The domain name (e.g., token name) - */ - name?: string; - /** - * Optional salt for additional entropy - */ - salt?: string; - /** - * The contract address that will verify this signature - */ - verifyingContract?: string; - /** - * Domain version for signature compatibility - */ - version?: string; - }; - /** - * The wallet address that will sign the typed data. - */ - from: string; - /** - * The structured data to be signed, matching the defined types schema. - */ - message: { - [key: string]: unknown; - }; - /** - * The primary type name from the types object that defines the main structure being signed. - */ - primaryType: string; - /** - * Type definitions for the structured data, following EIP-712 specifications. - */ - types: { - [key: string]: Array<{ - /** - * The field name - */ - name: string; - /** - * The Solidity type (e.g., 'address', 'uint256') - */ - type: string; - }>; - }; - }; - path?: never; - query?: never; - url: "/v1/sign/typed-data"; -}; - -export type SignTypedDataErrors = { +export type CreatePaymentData = { /** - * Invalid request parameters. This occurs when the typed data structure is malformed, domain parameters are incorrect, or wallet address format is invalid. - */ - 400: unknown; - /** - * Authentication required. The request must include valid `x-wallet-access-token` headers for accessing the wallet, as well as a x-client-id (frontend) or x-secret-key (backend) for project authentication. - */ - 401: unknown; - /** - * Internal server error. This may occur due to wallet connectivity issues, signing service unavailability, or unexpected server errors. - */ - 500: unknown; -}; - -export type SignTypedDataResponses = { - /** - * Typed data signed successfully. Returns the EIP-712 compliant signature that can be used for on-chain verification. - */ - 200: { - result: { - /** - * The cryptographic signature in hexadecimal format. This can be used for verification and authentication purposes. - */ - signature: string; - }; - }; -}; - -export type SignTypedDataResponse = - SignTypedDataResponses[keyof SignTypedDataResponses]; - -export type BuyTokenWithUsdData = { - /** - * Buy Token Request - * Request to buy tokens using a USD amount. The system will automatically use your wallet balance to purchase the specified tokens. + * Create Product Request + * Request to create a product to be purchased. Users can purchase the product via hosted UI (link is returned), a transaction execution referencing the product ID, or embedded widgets with the product ID. */ body?: { /** - * The USD amount to spend on the token purchase (as string to support decimals) + * The name of the product */ - amountUsd: string; + name: string; /** - * The blockchain network where the token will be received + * The description of the product */ - chainId: number; + description: string; /** - * The wallet address that will buy the tokens. + * The URL of the product image */ - from: string; + imageUrl?: string; /** - * The token address to purchase (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) + * The token to purchase */ - tokenAddress: string; + token: { + /** + * The token address to purchase (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) + */ + address: string; + /** + * The blockchain network where the token is located + */ + chainId: number; + /** + * The amount of the token to purchase in wei. + */ + amount: string; + }; + /** + * The wallet address or ENS name that will receive the payment for the product + */ + recipient: string; + /** + * App specific purchase data for this payment + */ + purchaseData?: unknown; }; path?: never; query?: never; - url: "/v1/tokens/buy"; + url: "/v1/payments"; }; -export type BuyTokenWithUsdErrors = { +export type CreatePaymentErrors = { /** * Invalid request parameters. */ @@ -2943,53 +3687,147 @@ export type BuyTokenWithUsdErrors = { 500: unknown; }; -export type BuyTokenWithUsdResponses = { +export type CreatePaymentResponses = { /** - * Buy Token Response - * Successful token purchase response containing executed transaction IDs + * Create Payment Response + * Successful payment creation response containing the payment ID and link to purchase the product */ 200: { result: { /** - * Transaction IDs that were executed for your token purchase + * The payment ID */ - transactionIds: Array; + id: string; + /** + * The link to purchase the product + */ + link: string; }; }; }; -export type BuyTokenWithUsdResponse = - BuyTokenWithUsdResponses[keyof BuyTokenWithUsdResponses]; +export type CreatePaymentResponse = + CreatePaymentResponses[keyof CreatePaymentResponses]; -export type SellTokenForUsdData = { +export type GetPaymentHistoryData = { + body?: never; + path: { + id: string; + }; + query?: never; + url: "/v1/payments/{id}"; +}; + +export type GetPaymentHistoryErrors = { /** - * Sell Token Request - * Request to sell tokens for USD value. The system will automatically convert your tokens to USDC on Arbitrum. + * Bad request + */ + 400: { + error: string; + }; + /** + * Payment link not found + */ + 404: { + error: string; + }; +}; + +export type GetPaymentHistoryError = + GetPaymentHistoryErrors[keyof GetPaymentHistoryErrors]; + +export type GetPaymentHistoryResponses = { + /** + * Payment history retrieved successfully + */ + 200: { + /** + * List of payments for the client + */ + data: Array<{ + id: string; + blockNumber?: string; + transactionId?: string; + onrampId?: string; + clientId: string; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + sender?: string; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + receiver: string; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + developerFeeRecipient?: string; + developerFeeBps?: number; + transactions: Array<{ + chainId: number; + transactionHash: string; + }>; + status: "PENDING" | "COMPLETED" | "FAILED" | "NOT_FOUND"; + type: "buy" | "sell" | "transfer" | "onramp"; + originAmount?: string; + destinationAmount: string; + paymentLinkId?: string; + purchaseData?: unknown; + originToken?: { + chainId: number; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + address: string; + symbol: string; + name: string; + decimals: number; + iconUri?: string; + }; + destinationToken: { + chainId: number; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + address: string; + symbol: string; + name: string; + decimals: number; + iconUri?: string; + }; + createdAt: string; + }>; + meta: { + /** + * Total number of payments + */ + totalCount: number; + }; + }; +}; + +export type GetPaymentHistoryResponse = + GetPaymentHistoryResponses[keyof GetPaymentHistoryResponses]; + +export type PaymentsPurchaseData = { + /** + * Purchase Product Request + * Request to purchase a product. The system will automatically use your wallet balance to purchase the specified product. */ body?: { /** - * The USD amount worth of tokens to sell (as string to support decimals) - */ - amountUsd: string; - /** - * The blockchain network where the token is located - */ - chainId: number; - /** - * The wallet address that will send the transaction. + * The wallet address or ENS name that will purchase the product. */ from: string; - /** - * The token address to sell (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) - */ - tokenAddress: string; }; - path?: never; + path: { + id: string; + }; query?: never; - url: "/v1/tokens/sell"; + url: "/v1/payments/{id}"; }; -export type SellTokenForUsdErrors = { +export type PaymentsPurchaseErrors = { /** * Invalid request parameters. */ @@ -2999,7 +3837,7 @@ export type SellTokenForUsdErrors = { */ 401: unknown; /** - * Payment required. Insufficient token balance to complete the sale. + * Payment required. Insufficient wallet balance to complete the purchase. */ 402: unknown; /** @@ -3008,59 +3846,58 @@ export type SellTokenForUsdErrors = { 500: unknown; }; -export type SellTokenForUsdResponses = { +export type PaymentsPurchaseResponses = { /** - * Sell Token Response - * Successful token sale response containing executed transaction IDs + * Product purchased successfully. Returns the transaction used for the purchase. */ 200: { result: { /** - * Transaction IDs that were executed for your token sale + * Transaction ID that was executed for your product purchase */ - transactionIds: Array; + transactionId: string; }; }; }; -export type SellTokenForUsdResponse = - SellTokenForUsdResponses[keyof SellTokenForUsdResponses]; +export type PaymentsPurchaseResponse = + PaymentsPurchaseResponses[keyof PaymentsPurchaseResponses]; -export type TransferTokenWithUsdData = { - /** - * Transfer Token Request - * Request to transfer tokens worth a USD amount to another wallet address. The system will calculate the token amount based on current prices and transfer the tokens. - */ - body?: { - /** - * The USD amount worth of tokens to transfer (as string to support decimals) - */ - amountUsd: string; - /** - * The blockchain network where the token is located - */ - chainId: number; - /** - * The wallet address that will send the transaction. - */ - from: string; - /** - * The wallet address that will receive the transferred tokens - */ - to: string; - /** - * The token address to transfer (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) - */ - tokenAddress: string; - }; +export type ListTokensData = { + body?: never; path?: never; - query?: never; - url: "/v1/tokens/transfer"; + query?: { + /** + * Number of tokens to return per page (1-100). + */ + limit?: number; + /** + * Page number for pagination, starting from 1. + */ + page?: number; + /** + * Limit tokens to a specific chain. + */ + chainId?: number; + /** + * Get a specific token by contract address + */ + tokenAddress?: string; + /** + * Limit tokens to a specific symbol. + */ + symbol?: string; + /** + * Limit tokens to a specific name. + */ + name?: string; + }; + url: "/v1/tokens"; }; -export type TransferTokenWithUsdErrors = { +export type ListTokensErrors = { /** - * Invalid request parameters or insufficient token balance. + * Invalid request parameters. */ 400: unknown; /** @@ -3068,7 +3905,142 @@ export type TransferTokenWithUsdErrors = { */ 401: unknown; /** - * Payment required. Insufficient wallet balance to complete the transfer. + * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. + */ + 500: unknown; +}; + +export type ListTokensResponses = { + /** + * Tokens returned successfully. + */ + 200: { + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; + tokens: Array<{ + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + chainId: number; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + address: string; + decimals: number; + symbol: string; + iconUri?: string; + /** + * Token price in different FIAT currencies. + */ + prices: { + [key: string]: number; + }; + }>; + }; +}; + +export type ListTokensResponse = ListTokensResponses[keyof ListTokensResponses]; + +export type CreateTokenData = { + /** + * Request schema for creating a new ERC20 token + */ + body?: { + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + chainId: number; + /** + * Token name + */ + name: string; + /** + * Token symbol + */ + symbol: string; + /** + * Token description + */ + description: string; + /** + * Token image URL + */ + imageUrl: string; + /** + * Wallet address or ENS that will deploy the token. + */ + from: string; + /** + * The token owner address, if different from `from`. + */ + owner?: string; + /** + * A salt to deterministically generate the token address. + */ + salt?: string; + /** + * The maximum token supply. + */ + maxSupply?: number; + /** + * Setup this token for a sale. + */ + sale?: { + type?: "pool"; + /** + * The initial token price in wei. This price is in the currency specified by `currency` (or the native token if not specified). + */ + startingPrice: string; + /** + * The number of tokens to allocate to the sale. + */ + amount: number; + /** + * The bps fee on the token pool. + */ + developerFeeBps?: number; + /** + * The address to send the developer fee to. Defaults to the token owner. + */ + developerFeeRecipient?: string; + /** + * The currency to price this token sale in. Defaults to the native token. + */ + currency?: string; + }; + }; + path?: never; + query?: never; + url: "/v1/tokens"; +}; + +export type CreateTokenErrors = { + /** + * Invalid request parameters. + */ + 400: unknown; + /** + * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. + */ + 401: unknown; + /** + * Payment required. Insufficient wallet balance to deploy the contract. */ 402: unknown; /** @@ -3077,24 +4049,379 @@ export type TransferTokenWithUsdErrors = { 500: unknown; }; -export type TransferTokenWithUsdResponses = { +export type CreateTokenResponses = { /** - * Transfer Token Response - * Successful token transfer response containing executed transaction IDs + * The token is being deployed. Returns the predicted token address. + */ + 202: { + /** + * The in-progress deployment transaction ID. + */ + transactionId: string; + /** + * The address the token was deployed at + */ + address: string; + }; +}; + +export type CreateTokenResponse = + CreateTokenResponses[keyof CreateTokenResponses]; + +export type GetTokenOwnersData = { + body?: never; + path: { + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + chainId: number; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + address: string; + }; + query?: { + /** + * Number of owners to return per page (1-100). + */ + limit?: number; + /** + * Page number for pagination, starting from 1. + */ + page?: number; + }; + url: "/v1/tokens/{chainId}/{address}/owners"; +}; + +export type GetTokenOwnersErrors = { + /** + * Invalid request parameters. + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + */ + 401: unknown; + /** + * Token not found or no owners available. + */ + 404: unknown; + /** + * Internal server error. + */ + 500: unknown; +}; + +export type GetTokenOwnersResponses = { + /** + * Token owners retrieved successfully. Returns owners with pagination information. */ 200: { result: { /** - * Transaction IDs that were executed for your token transfer + * Array of token owners with amounts. */ - transactionIds: Array; + owners: Array<{ + /** + * Owner wallet address + */ + address: string; + /** + * Token amount owned as a string + */ + amount: string; + }>; + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; }; }; }; -export type TransferTokenWithUsdResponse = - TransferTokenWithUsdResponses[keyof TransferTokenWithUsdResponses]; +export type GetTokenOwnersResponse = + GetTokenOwnersResponses[keyof GetTokenOwnersResponses]; + +export type BridgeSwapData = { + /** + * Swap Token Request + * Request to swap tokens using the optimal route available. You can specify a tokenIn amount (if exact='input') or tokenOut amount (if exact='output'), but not both. The corresponding output or input amount will be returned as the quote. + */ + body?: { + /** + * Whether to swap the exact input or output amount + */ + exact?: "input" | "output"; + tokenIn: { + /** + * The input token address to swap (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) + */ + address: string; + /** + * The blockchain network where the token is located + */ + chainId: number; + /** + * The amount of the input token to swap in wei. + */ + amount?: string; + /** + * The maximum amount of the input token to swap in wei. + */ + maxAmount?: string; + }; + tokenOut: { + /** + * The output token address to swap (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) + */ + address: string; + /** + * The blockchain network where the token is located + */ + chainId: number; + /** + * The amount of the output token to receive in wei. + */ + amount?: string; + /** + * The minimum amount of the output token to receive in wei. + */ + minAmount?: string; + }; + /** + * The wallet address or ENS name that will execute the swap. + */ + from: string; + }; + path?: never; + query?: never; + url: "/v1/bridge/swap"; +}; + +export type BridgeSwapErrors = { + /** + * Invalid request parameters. + */ + 400: unknown; + /** + * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. + */ + 401: unknown; + /** + * Payment required. Insufficient wallet balance to complete the purchase. + */ + 402: unknown; + /** + * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. + */ + 500: unknown; +}; + +export type BridgeSwapResponses = { + /** + * Swap Token Response + * Successful token swap response containing executed transaction ID + */ + 200: { + result: { + /** + * Payment transaction ID that was executed + */ + transactionId: string; + }; + }; +}; + +export type BridgeSwapResponse = BridgeSwapResponses[keyof BridgeSwapResponses]; + +export type ChatData = { + /** + * Chat Request + * Chat request + */ + body?: { + /** + * Natural language query for the AI assistant + */ + messages: Array<{ + role: "user" | "assistant" | "system" | "tool"; + content: + | string + | Array< + | { + type: "image"; + image_url?: string; + b64?: string; + } + | { + type: "text"; + text: string; + } + | { + type: "transaction"; + chain_id: number; + transaction_hash: string; + } + >; + }>; + /** + * Context for the AI assistant + */ + context?: { + /** + * Optional wallet address that will execute transactions + */ + from?: string; + /** + * Optional chain IDs for context + */ + chain_ids?: Array; + /** + * Optional session ID for conversation continuity. If not provided, a new session will be created + */ + session_id?: string; + /** + * Whether to automatically execute transactions. If not provided, the default is false + */ + auto_execute_transactions?: boolean; + }; + /** + * Enable server streaming of the AI response + */ + stream?: boolean; + }; + path?: never; + query?: never; + url: "/ai/chat"; +}; + +export type ChatResponses = { + /** + * Chat Response + * Chat response + */ + 200: { + /** + * The AI assistant's response + */ + message: string; + actions: Array< + | { + session_id: string; + request_id: string; + source?: string; + type: "sign_transaction"; + data: { + chain_id: number; + function?: string; + to: string; + value: string; + data: string; + }; + } + | { + session_id: string; + request_id: string; + source?: string; + type: "sign_swap"; + data: { + transaction: { + chain_id: number; + function?: string; + to: string; + value: string; + data: string; + }; + action: string; + intent: { + origin_chain_id: number; + origin_token_address: string; + destination_chain_id: number; + destination_token_address: string; + amount: string; + sender: string; + receiver: string; + maxSteps: number; + }; + from_token: { + address: string; + chain_id: number; + amount: string; + symbol: string; + decimals: number; + price: number; + }; + to_token: { + address: string; + chain_id: number; + amount: string; + symbol: string; + decimals: number; + price: number; + }; + }; + } + | { + session_id: string; + request_id: string; + source?: string; + type: "monitor_transaction"; + data: { + transaction_id: string; + }; + } + >; + session_id: string; + request_id: string; + }; +}; + +export type ChatResponse = ChatResponses[keyof ChatResponses]; + +export type McpServerData = { + body?: unknown; + path?: never; + query?: never; + url: "/mcp"; +}; + +export type McpServerResponses = { + /** + * MCP response + */ + 200: unknown; +}; + +export type LlmsTxtData = { + body?: never; + path?: never; + query?: never; + url: "/llms.txt"; +}; + +export type LlmsTxtResponses = { + /** + * LLMs.txt + */ + 200: string; +}; + +export type LlmsTxtResponse = LlmsTxtResponses[keyof LlmsTxtResponses]; export type ClientOptions = { - baseUrl: "https://api.thirdweb.com" | "http://localhost:3030" | (string & {}); + baseUrl: "https://api.thirdweb.com" | (string & {}); }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6c522ff24..2cec5a27e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -130,6 +130,9 @@ importers: '@tanstack/react-table': specifier: ^8.21.3 version: 8.21.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + '@thirdweb-dev/api': + specifier: workspace:* + version: link:../../packages/api '@thirdweb-dev/service-utils': specifier: workspace:* version: link:../../packages/service-utils @@ -31301,7 +31304,7 @@ snapshots: istanbul-lib-instrument@5.2.1: dependencies: '@babel/core': 7.28.0 - '@babel/parser': 7.28.0 + '@babel/parser': 7.28.3 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.2 semver: 7.7.2 @@ -32343,7 +32346,7 @@ snapshots: dependencies: '@babel/core': 7.28.0 '@babel/generator': 7.28.0 - '@babel/parser': 7.28.0 + '@babel/parser': 7.28.3 '@babel/types': 7.28.2 flow-enums-runtime: 0.0.6 metro: 0.81.4(bufferutil@4.0.9)(utf-8-validate@5.0.10)