diff --git a/.changeset/calm-rivers-glow.md b/.changeset/calm-rivers-glow.md new file mode 100644 index 00000000000..4b2be106921 --- /dev/null +++ b/.changeset/calm-rivers-glow.md @@ -0,0 +1,5 @@ +--- +"@thirdweb-dev/api": minor +--- + +Update to latest API diff --git a/apps/dashboard/src/@/hooks/useEmbeddedWallets.ts b/apps/dashboard/src/@/hooks/useEmbeddedWallets.ts index aa335cd02e7..3f27a92bf4e 100644 --- a/apps/dashboard/src/@/hooks/useEmbeddedWallets.ts +++ b/apps/dashboard/src/@/hooks/useEmbeddedWallets.ts @@ -68,7 +68,7 @@ const fetchAccountList = ({ return { users: response.data.result.wallets.map(transformToWalletUser), hasMore: response.data.result.pagination.hasMore ?? false, - totalCount: response.data.result.pagination.totalCount, + totalCount: response.data.result.pagination.totalCount ?? undefined, }; } catch (error) { console.error("Failed to fetch wallets:", error); diff --git a/packages/api/src/client/sdk.gen.ts b/packages/api/src/client/sdk.gen.ts index 99cff5b9530..1ed1a56f61a 100644 --- a/packages/api/src/client/sdk.gen.ts +++ b/packages/api/src/client/sdk.gen.ts @@ -7,9 +7,24 @@ import type { } from "./client/index.js"; import { client as _heyApiClient } from "./client.gen.js"; import type { + BridgeCreatePaymentData, + BridgeCreatePaymentErrors, + BridgeCreatePaymentResponses, + BridgeGetPaymentHistoryData, + BridgeGetPaymentHistoryErrors, + BridgeGetPaymentHistoryResponses, + BridgePaymentsPurchaseData, + BridgePaymentsPurchaseErrors, + BridgePaymentsPurchaseResponses, + BridgeQuoteData, + BridgeQuoteErrors, + BridgeQuoteResponses, BridgeSwapData, BridgeSwapErrors, BridgeSwapResponses, + BroadcastSolanaTransactionData, + BroadcastSolanaTransactionErrors, + BroadcastSolanaTransactionResponses, ChatData, ChatResponses, CompleteAuthenticationData, @@ -18,9 +33,6 @@ import type { ConvertFiatToCryptoData, ConvertFiatToCryptoErrors, ConvertFiatToCryptoResponses, - CreatePaymentData, - CreatePaymentErrors, - CreatePaymentResponses, CreateServerWalletData, CreateServerWalletErrors, CreateServerWalletResponses, @@ -36,6 +48,9 @@ import type { DeployContractData, DeployContractErrors, DeployContractResponses, + DeploySolanaTokenData, + DeploySolanaTokenErrors, + DeploySolanaTokenResponses, FetchWithPaymentData, FetchWithPaymentErrors, FetchWithPaymentResponses, @@ -60,15 +75,15 @@ import type { GetMyWalletData, GetMyWalletErrors, GetMyWalletResponses, - GetPaymentHistoryData, - GetPaymentHistoryErrors, - GetPaymentHistoryResponses, GetSolanaTransactionData, GetSolanaTransactionErrors, GetSolanaTransactionResponses, GetSolanaWalletBalanceData, GetSolanaWalletBalanceErrors, GetSolanaWalletBalanceResponses, + GetSwapQuoteData, + GetSwapQuoteErrors, + GetSwapQuoteResponses, GetTokenOwnersData, GetTokenOwnersErrors, GetTokenOwnersResponses, @@ -87,15 +102,15 @@ import type { GetWalletTransactionsData, GetWalletTransactionsErrors, GetWalletTransactionsResponses, + GetX402AcceptsData, + GetX402AcceptsErrors, + GetX402AcceptsResponses, InitiateAuthenticationData, InitiateAuthenticationErrors, InitiateAuthenticationResponses, LinkAuthenticationData, LinkAuthenticationErrors, LinkAuthenticationResponses, - ListContractsData, - ListContractsErrors, - ListContractsResponses, ListPayableServicesData, ListPayableServicesErrors, ListPayableServicesResponses, @@ -114,13 +129,8 @@ import type { ListUserWalletsData, ListUserWalletsErrors, ListUserWalletsResponses, - LlmsTxtData, - LlmsTxtResponses, - McpServerData, - McpServerResponses, - PaymentsPurchaseData, - PaymentsPurchaseErrors, - PaymentsPurchaseResponses, + PostV1WalletsCreateSessionKeyData, + PostV1WalletsCreateSessionKeyResponses, ReadContractData, ReadContractErrors, ReadContractResponses, @@ -145,6 +155,9 @@ import type { SignSolanaMessageData, SignSolanaMessageErrors, SignSolanaMessageResponses, + SignSolanaTransactionData, + SignSolanaTransactionErrors, + SignSolanaTransactionResponses, SignTypedDataData, SignTypedDataErrors, SignTypedDataResponses, @@ -153,6 +166,9 @@ import type { SupportedX402PaymentsData, SupportedX402PaymentsErrors, SupportedX402PaymentsResponses, + SwapSolanaTokensData, + SwapSolanaTokensErrors, + SwapSolanaTokensResponses, UnlinkAuthenticationData, UnlinkAuthenticationErrors, UnlinkAuthenticationResponses, @@ -478,6 +494,35 @@ export const getMyWallet = ( }); }; +/** + * Create Session Key + * Create a session key for a smart account using EIP-7702. + */ +export const postV1WalletsCreateSessionKey = < + ThrowOnError extends boolean = false, +>( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + PostV1WalletsCreateSessionKeyResponses, + unknown, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/wallets/create-session-key", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + /** * List User Wallets * Get all user wallet details with filtering and pagination for your project. @@ -612,7 +657,7 @@ export const getWalletBalance = ( }; /** - * Get Transactions + * Get Wallet 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. @@ -637,7 +682,7 @@ export const getWalletTransactions = ( }; /** - * Get Tokens + * Get Wallet 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, sorted by balance or USD value, and customized to include/exclude spam tokens, native tokens, and tokens without price data. Supports pagination and metadata resolution options. * * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. @@ -662,7 +707,7 @@ export const getWalletTokens = ( }; /** - * Get NFTs + * Get Wallet 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. @@ -791,66 +836,6 @@ export const sendTokens = ( }); }; -/** - * 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 deployContract = ( - options?: Options, -) => { - return (options?.client ?? _heyApiClient).post< - DeployContractResponses, - DeployContractErrors, - ThrowOnError - >({ - security: [ - { - scheme: "bearer", - type: "http", - }, - { - name: "x-client-id", - type: "apiKey", - }, - ], - url: "/v1/contracts", - ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, - }); -}; - /** * 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. @@ -914,7 +899,7 @@ export const writeContract = ( }; /** - * Get Transactions + * Get Contract 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. @@ -939,7 +924,7 @@ export const getContractTransactions = ( }; /** - * Get Events + * Get Contract 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. @@ -964,7 +949,40 @@ export const getContractEvents = ( }; /** - * Get Metadata + * 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 deployContract = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + DeployContractResponses, + DeployContractErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/contracts", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Get Contract 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. @@ -991,7 +1009,7 @@ export const getContractMetadata = ( }; /** - * Get Signatures + * Get Contract 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. @@ -1101,96 +1119,7 @@ export const sendTransactions = ( }; /** - * 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, - }, - }); -}; - -/** - * x402 - Verify payment + * Verify payment * Verify an x402 payment payload against the provided payment requirements. Compatible with any standard x402 middleware. */ export const verifyX402Payment = ( @@ -1217,7 +1146,7 @@ export const verifyX402Payment = ( }; /** - * x402 - Settle payment + * Settle payment * Settle an x402 payment. Compatible with any standard x402 middleware. */ export const settleX402Payment = ( @@ -1244,7 +1173,7 @@ export const settleX402Payment = ( }; /** - * x402 - Supported payment methods + * Supported payment methods * List supported x402 payment methods, optionally filtered by token address and chainId. Compatible with any standard x402 middleware. */ export const supportedX402Payments = ( @@ -1257,7 +1186,7 @@ export const supportedX402Payments = ( >({ security: [ { - name: "x-secret-key", + name: "x-client-id", type: "apiKey", }, ], @@ -1267,7 +1196,7 @@ export const supportedX402Payments = ( }; /** - * x402 - Fetch with payment + * Fetch with payment * Fetch any given url. If the url returns HTTP 402 payment required, this endpoint handles payment with the authenticated wallet. * * Optionally pass a 'from' query parameter with the authenticated wallet address (server or user wallet) to complete the payment. @@ -1312,7 +1241,7 @@ export const fetchWithPayment = ( }; /** - * x402 - Discover resources + * Discover resources * Discover payable x402 compatible services and HTTP endpoints that can be paid for using the fetchWithPayment tool. Use this tool to browse services, APIs and endpoints to find what you need for your tasks. Each item has a resource url that you can call with the fetchWithPayment tool.Price is in the base units of the asset. For example, if the price is 1000000 and the asset is USDC (which is the default and has 6 decimals), the price is 1 USDC.Examples: if network is eip155:8453, asset is 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, max amount required is 10000, resource is https://api.example.com/paid-api, then you should interpret that as "the api.example.com/paid-api service costs 0.01 USDC per call". */ export const listPayableServices = ( @@ -1334,6 +1263,33 @@ export const listPayableServices = ( }); }; +/** + * Get payment accepts + * Transform payment configuration into x402 payment requirements. This endpoint converts high-level payment parameters (like USD amounts or ERC20 token specifications) into the standardized x402 payment requirements format used by x402-compatible middleware. + */ +export const getX402Accepts = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + GetX402AcceptsResponses, + GetX402AcceptsErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/payments/x402/accepts", + ...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. @@ -1506,6 +1462,33 @@ export const convertFiatToCrypto = ( }); }; +/** + * Get a Swap or Bridge Quote + * Get a live quote for swapping or bridging tokens without executing anything. Specify the exact input amount (exact='input') or the exact output amount (exact='output') and the other side is returned, along with the route steps. The quote is indicative and subject to change; use `/v1/bridge/swap` to execute. + * + * Maps to `/v1/bridge/swap` as: originChainId/originTokenAddress = tokenIn, destinationChainId/destinationTokenAddress = tokenOut. + * + * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + */ +export const bridgeQuote = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).get< + BridgeQuoteResponses, + BridgeQuoteErrors, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/bridge/quote", + ...options, + }); +}; + /** * 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. @@ -1539,6 +1522,95 @@ export const bridgeSwap = ( }); }; +/** + * 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 bridgeCreatePayment = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + BridgeCreatePaymentResponses, + BridgeCreatePaymentErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/bridge/payments", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Get Payment History + * Get payment history for a specific payment link + */ +export const bridgeGetPaymentHistory = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).get< + BridgeGetPaymentHistoryResponses, + BridgeGetPaymentHistoryErrors, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/bridge/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 bridgePaymentsPurchase = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).post< + BridgePaymentsPurchaseResponses, + BridgePaymentsPurchaseErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/bridge/payments/{id}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); +}; + /** * List Solana Wallets * List all Solana wallets created for your project. Supports pagination with page and limit parameters. @@ -1647,6 +1719,68 @@ export const signSolanaMessage = ( }); }; +/** + * Sign Solana Transaction + * Sign a Solana transaction using a server wallet without broadcasting it. Provide either a serialized transaction or the instructions to assemble one, along with execution options. + * + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. Optionally, include x-vault-access-token if your wallet is managed via Vault. + */ +export const signSolanaTransaction = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + SignSolanaTransactionResponses, + SignSolanaTransactionErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/solana/sign-transaction", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Broadcast Signed Solana Transaction + * Broadcast a signed Solana transaction to the network and wait for confirmation. This endpoint accepts a base64 encoded signed transaction (such as the output from /v1/solana/sign-transaction), submits it to the Solana blockchain, and polls until the transaction is confirmed (up to 30 seconds). + * + * The endpoint waits for the transaction to reach 'confirmed' or 'finalized' status before returning. If the transaction fails on-chain, detailed error information is returned including instruction index, error type, and the transaction signature for debugging. + * + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. + */ +export const broadcastSolanaTransaction = < + ThrowOnError extends boolean = false, +>( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + BroadcastSolanaTransactionResponses, + BroadcastSolanaTransactionErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/solana/broadcast-transaction", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + /** * Send Solana Tokens * Transfer native SOL or SPL tokens on Solana. Automatically handles token account creation for SPL tokens if needed. @@ -1706,17 +1840,19 @@ export const sendSolanaTransaction = ( }; /** - * Get Solana Transaction - * Retrieve the status and details of a queued Solana transaction using the identifier returned when the transaction was submitted. + * Get Solana Swap Quote + * Get a quote for swapping tokens on Solana. This endpoint returns the expected output amount and swap details without executing the transaction. * - * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. The secret key should never be exposed publicly. + * **Important**: Swaps are only available on Solana mainnet. + * + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. */ -export const getSolanaTransaction = ( - options: Options, +export const getSwapQuote = ( + options: Options, ) => { return (options.client ?? _heyApiClient).get< - GetSolanaTransactionResponses, - GetSolanaTransactionErrors, + GetSwapQuoteResponses, + GetSwapQuoteErrors, ThrowOnError >({ security: [ @@ -1725,36 +1861,36 @@ export const getSolanaTransaction = ( type: "apiKey", }, ], - url: "/v1/solana/transactions/:transactionId", + url: "/v1/solana/swap", ...options, }); }; /** - * Chat - * Thirdweb AI chat completion API (BETA). + * Swap Solana Tokens + * Execute a token swap on Solana. This endpoint handles the full swap flow: fetching the optimal swap route, signing the transaction with your server wallet, executing the swap, and polling until confirmation. * - * Send natural language queries to interact with any EVM chain, read data, prepare transactions, swap tokens, deploy contracts, payments and more. + * The swap uses aggregated liquidity across Solana DEXs to provide optimal routing. The endpoint waits for the transaction to reach 'confirmed' or 'finalized' status before returning (up to 30 seconds). * - * Compatible with standard OpenAI API chat completion format, can be used raw or with any popular AI library. + * **Important**: Swaps are only available on Solana mainnet. * - * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. */ -export const chat = ( - options?: Options, +export const swapSolanaTokens = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - ChatResponses, - unknown, + SwapSolanaTokensResponses, + SwapSolanaTokensErrors, ThrowOnError >({ security: [ { - name: "x-client-id", + name: "x-secret-key", type: "apiKey", }, ], - url: "/ai/chat", + url: "/v1/solana/swap", ...options, headers: { "Content-Type": "application/json", @@ -1764,27 +1900,46 @@ export const chat = ( }; /** - * 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. + * Get Solana Transaction + * Retrieve the status and details of a queued Solana transaction using the identifier returned when the transaction was submitted. * - * Add this MCP server to any MCP client: + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. The secret key should never be exposed publicly. + */ +export const getSolanaTransaction = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).get< + GetSolanaTransactionResponses, + GetSolanaTransactionErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/solana/transactions/:transactionId", + ...options, + }); +}; + +/** + * Deploy Solana Token + * Deploy a new SPL token or Token-2022 token on Solana. Creates a new mint account with the specified parameters and optionally mints initial supply. * - * ```json - * { - * "mcpServers": { - * "thirdweb-api": { - * "url": "https://api.thirdweb.com/mcp?secretKey=YOUR_SECRET_KEY_HERE" - * } - * } - * } - * ``` + * **Token Programs**: + * - `spl-token`: Standard SPL Token program - widely supported, recommended for most use cases + * - `token-2022`: Token Extensions program - supports advanced features like transfer fees, interest-bearing tokens, etc. + * + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. The secret key should never be exposed publicly. */ -export const mcpServer = ( - options?: Options, +export const deploySolanaToken = ( + options?: Options, ) => { return (options?.client ?? _heyApiClient).post< - McpServerResponses, - unknown, + DeploySolanaTokenResponses, + DeploySolanaTokenErrors, ThrowOnError >({ security: [ @@ -1793,7 +1948,7 @@ export const mcpServer = ( type: "apiKey", }, ], - url: "/mcp", + url: "/v1/solana/deploy", ...options, headers: { "Content-Type": "application/json", @@ -1803,18 +1958,36 @@ export const mcpServer = ( }; /** - * 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. + * Chat + * Thirdweb AI chat completion API (BETA). + * + * Send natural language queries to read on-chain data across any EVM chain - contracts, tokens, NFTs, balances, transactions, events and blocks - and to search the thirdweb documentation. + * + * Read-only: the API answers questions and does not build, sign or send transactions. + * + * 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 llmsTxt = ( - options?: Options, +export const chat = ( + options?: Options, ) => { - return (options?.client ?? _heyApiClient).get< - LlmsTxtResponses, + return (options?.client ?? _heyApiClient).post< + ChatResponses, unknown, ThrowOnError >({ - url: "/llms.txt", + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/ai/chat", ...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 fdf8574b727..e6e3af0831d 100644 --- a/packages/api/src/client/types.gen.ts +++ b/packages/api/src/client/types.gen.ts @@ -47,7 +47,8 @@ export type InitiateAuthenticationData = { | "github" | "twitch" | "steam" - | "tiktok"; + | "tiktok" + | "epic"; /** * Custom redirect URL after OAuth completion */ @@ -419,9 +420,9 @@ export type LinkAuthenticationResponses = { type: "apple"; } | { - avatar?: string; + avatar?: string | null; id: string; - name?: string; + name?: string | null; type: "github"; username: string; } @@ -453,6 +454,22 @@ export type LinkAuthenticationResponses = { unionId?: string; type: "tiktok"; } + | { + id: string; + type: "epic"; + displayName?: string; + email?: string; + emailVerified?: boolean; + metadata: { + accountId: string; + preferredUsername?: string; + country?: string; + region?: string; + language?: string; + sub?: string; + name?: string; + }; + } | { avatar?: string; id: string; @@ -586,6 +603,7 @@ export type UnlinkAuthenticationData = { | "twitch" | "x" | "tiktok" + | "epic" | "backend" | "wallet" | "custom_auth_endpoint" @@ -672,9 +690,9 @@ export type UnlinkAuthenticationResponses = { type: "apple"; } | { - avatar?: string; + avatar?: string | null; id: string; - name?: string; + name?: string | null; type: "github"; username: string; } @@ -706,6 +724,22 @@ export type UnlinkAuthenticationResponses = { unionId?: string; type: "tiktok"; } + | { + id: string; + type: "epic"; + displayName?: string; + email?: string; + emailVerified?: boolean; + metadata: { + accountId: string; + preferredUsername?: string; + country?: string; + region?: string; + language?: string; + sub?: string; + name?: string; + }; + } | { avatar?: string; id: string; @@ -831,7 +865,8 @@ export type SocialAuthenticationData = { | "github" | "twitch" | "steam" - | "tiktok"; + | "tiktok" + | "epic"; /** * URL to redirect the user to after OAuth completion */ @@ -840,6 +875,14 @@ export type SocialAuthenticationData = { * Client ID (alternative to x-client-id header for standard OAuth flows) */ clientId?: string; + /** + * Ecosystem wallet ID (e.g. `ecosystem.myapp`). Required for ecosystem wallet OAuth so the minted auth token carries the ecosystem. + */ + ecosystemId?: string; + /** + * Ecosystem partner ID associated with the ecosystem wallet OAuth login. + */ + ecosystemPartnerId?: string; }; url: "/v1/auth/social"; }; @@ -925,9 +968,9 @@ export type GetMyWalletResponses = { type: "apple"; } | { - avatar?: string; + avatar?: string | null; id: string; - name?: string; + name?: string | null; type: "github"; username: string; } @@ -959,6 +1002,22 @@ export type GetMyWalletResponses = { unionId?: string; type: "tiktok"; } + | { + id: string; + type: "epic"; + displayName?: string; + email?: string; + emailVerified?: boolean; + metadata: { + accountId: string; + preferredUsername?: string; + country?: string; + region?: string; + language?: string; + sub?: string; + name?: string; + }; + } | { avatar?: string; id: string; @@ -1073,6 +1132,147 @@ export type GetMyWalletResponses = { export type GetMyWalletResponse = GetMyWalletResponses[keyof GetMyWalletResponses]; +export type PostV1WalletsCreateSessionKeyData = { + body?: { + /** + * The chain ID where the session key will be active. + */ + chainId: number; + /** + * The address of the session key to create. + */ + sessionKeyAddress: string; + /** + * The duration in seconds for which the session key is valid. + */ + durationInSeconds: number; + /** + * If true, grants full admin permissions to the session key. Use with caution. + */ + grantFullPermissions?: boolean; + /** + * List of allowed contract calls. + */ + callPolicies?: Array<{ + /** + * The target contract address for the call. + */ + target: string; + /** + * The 4-byte function selector to allow. + */ + selector: string; + /** + * The maximum native token value (in wei) allowed per call. + */ + maxValuePerUse?: string; + /** + * The total native token value limit for this call policy. + */ + valueLimit?: { + /** + * The type of limit to apply. Options: 'Unlimited', 'Lifetime', 'Allowance' + */ + limitType: "Unlimited" | "Lifetime" | "Allowance"; + /** + * The maximum limit value. Ignored if limitType is Unlimited. + */ + limit: string; + /** + * The time period in seconds for Allowance limit type. Ignored if limitType is not Allowance. + */ + period: string; + }; + /** + * List of constraints on function parameters. + */ + constraints?: Array<{ + /** + * The condition to check. Options: 'Unconstrained', 'Equal', 'Greater', 'Less', 'GreaterOrEqual', 'LessOrEqual', 'NotEqual' + */ + condition: + | "Unconstrained" + | "Equal" + | "Greater" + | "Less" + | "GreaterOrEqual" + | "LessOrEqual" + | "NotEqual"; + /** + * The index of the parameter in the function call to check against. + */ + index: string; + /** + * The reference value to compare the parameter against (32 bytes hex). + */ + refValue: string; + /** + * Optional usage limit for this constraint. + */ + limit?: { + /** + * The type of limit to apply. Options: 'Unlimited', 'Lifetime', 'Allowance' + */ + limitType: "Unlimited" | "Lifetime" | "Allowance"; + /** + * The maximum limit value. Ignored if limitType is Unlimited. + */ + limit: string; + /** + * The time period in seconds for Allowance limit type. Ignored if limitType is not Allowance. + */ + period: string; + }; + }>; + }>; + /** + * List of allowed native token transfers. + */ + transferPolicies?: Array<{ + /** + * The recipient address for the transfer. + */ + target: string; + /** + * The maximum native token value (in wei) allowed per transfer. + */ + maxValuePerUse?: string; + /** + * The total native token value limit for this transfer policy. + */ + valueLimit?: { + /** + * The type of limit to apply. Options: 'Unlimited', 'Lifetime', 'Allowance' + */ + limitType: "Unlimited" | "Lifetime" | "Allowance"; + /** + * The maximum limit value. Ignored if limitType is Unlimited. + */ + limit: string; + /** + * The time period in seconds for Allowance limit type. Ignored if limitType is not Allowance. + */ + period: string; + }; + }>; + }; + path?: never; + query?: never; + url: "/v1/wallets/create-session-key"; +}; + +export type PostV1WalletsCreateSessionKeyResponses = { + /** + * Transaction queued + */ + 200: { + transactionId: string; + }; +}; + +export type PostV1WalletsCreateSessionKeyResponse = + PostV1WalletsCreateSessionKeyResponses[keyof PostV1WalletsCreateSessionKeyResponses]; + export type ListUserWalletsData = { body?: never; path?: never; @@ -1120,15 +1320,15 @@ export type ListUserWalletsResponses = { /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Total number of items available */ - totalCount?: number; + totalCount?: number | null; }; /** * Array of user wallets @@ -1180,9 +1380,9 @@ export type ListUserWalletsResponses = { type: "apple"; } | { - avatar?: string; + avatar?: string | null; id: string; - name?: string; + name?: string | null; type: "github"; username: string; } @@ -1214,6 +1414,22 @@ export type ListUserWalletsResponses = { unionId?: string; type: "tiktok"; } + | { + id: string; + type: "epic"; + displayName?: string; + email?: string; + emailVerified?: boolean; + metadata: { + accountId: string; + preferredUsername?: string; + country?: string; + region?: string; + language?: string; + sub?: string; + name?: string; + }; + } | { avatar?: string; id: string; @@ -1424,9 +1640,9 @@ export type CreateUserWalletResponses = { type: "apple"; } | { - avatar?: string; + avatar?: string | null; id: string; - name?: string; + name?: string | null; type: "github"; username: string; } @@ -1458,6 +1674,22 @@ export type CreateUserWalletResponses = { unionId?: string; type: "tiktok"; } + | { + id: string; + type: "epic"; + displayName?: string; + email?: string; + emailVerified?: boolean; + metadata: { + accountId: string; + preferredUsername?: string; + country?: string; + region?: string; + language?: string; + sub?: string; + name?: string; + }; + } | { avatar?: string; id: string; @@ -1610,15 +1842,15 @@ export type ListServerWalletsResponses = { /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Total number of items available */ - totalCount?: number; + totalCount?: number | null; }; /** * Array of server wallets @@ -1670,9 +1902,9 @@ export type ListServerWalletsResponses = { type: "apple"; } | { - avatar?: string; + avatar?: string | null; id: string; - name?: string; + name?: string | null; type: "github"; username: string; } @@ -1704,6 +1936,22 @@ export type ListServerWalletsResponses = { unionId?: string; type: "tiktok"; } + | { + id: string; + type: "epic"; + displayName?: string; + email?: string; + emailVerified?: boolean; + metadata: { + accountId: string; + preferredUsername?: string; + country?: string; + region?: string; + language?: string; + sub?: string; + name?: string; + }; + } | { avatar?: string; id: string; @@ -1901,9 +2149,9 @@ export type CreateServerWalletResponses = { type: "apple"; } | { - avatar?: string; + avatar?: string | null; id: string; - name?: string; + name?: string | null; type: "github"; username: string; } @@ -1935,6 +2183,22 @@ export type CreateServerWalletResponses = { unionId?: string; type: "tiktok"; } + | { + id: string; + type: "epic"; + displayName?: string; + email?: string; + emailVerified?: boolean; + metadata: { + accountId: string; + preferredUsername?: string; + country?: string; + region?: string; + language?: string; + sub?: string; + name?: string; + }; + } | { avatar?: string; id: string; @@ -2142,19 +2406,19 @@ export type GetWalletTransactionsData = { /** * Filter by block timestamp (Unix timestamp) greater than or equal to this value */ - filterBlockTimestampGte?: number; + filterBlockTimestampGte?: number | null; /** * Filter by block timestamp (Unix timestamp) less than or equal to this value */ - filterBlockTimestampLte?: number; + filterBlockTimestampLte?: number | null; /** * Filter by block number greater than or equal to this value */ - filterBlockNumberGte?: number; + filterBlockNumberGte?: number | null; /** * Filter by block number less than or equal to this value */ - filterBlockNumberLte?: number; + filterBlockNumberLte?: number | null; /** * Filter by transaction value (in wei) greater than this value */ @@ -2166,11 +2430,11 @@ export type GetWalletTransactionsData = { /** * Current page number */ - page?: number; + page?: number | null; /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Sort order: 'asc' for ascending, 'desc' for descending */ @@ -2212,15 +2476,15 @@ export type GetWalletTransactionsResponses = { /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Total number of items available */ - totalCount?: number; + totalCount?: number | null; }; /** * Array of wallet transactions. @@ -2431,15 +2695,15 @@ export type GetWalletTokensResponses = { /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Total number of items available */ - totalCount?: number; + totalCount?: number | null; }; /** * Array of wallet tokens. @@ -2667,15 +2931,15 @@ export type GetWalletNftsResponses = { /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Total number of items available */ - totalCount?: number; + totalCount?: number | null; }; }; }; @@ -2911,270 +3175,86 @@ export type SendTokensResponses = { export type SendTokensResponse = SendTokensResponses[keyof SendTokensResponses]; -export type ListContractsData = { - body?: never; - path?: never; - query?: { +export type ReadContractData = { + body?: { /** - * The number of contracts to return (default: 20, max: 100). + * Array of contract method calls to execute. Each call specifies a contract address, method signature, and optional parameters. */ - limit?: number; + 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. For functions returning arrays of structs, use positional types only in the return declaration (e.g., `returns ((uint256, address, bool)[])` instead of `returns ((uint256 id, address owner, bool active)[] items)`). + */ + 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 page number for pagination (default: 1). + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). */ - page?: number; + chainId: number; }; - url: "/v1/contracts"; + path?: never; + query?: never; + url: "/v1/contracts/read"; }; -export type ListContractsErrors = { +export type ReadContractErrors = { /** - * Invalid request parameters + * 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-secret-key` header for backend authentication. + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ 401: unknown; /** - * Rate limit exceeded - */ - 429: unknown; - /** - * Internal server error + * Internal server error. This may occur due to engine connectivity issues, RPC node unavailability, or unexpected server errors. */ 500: unknown; }; -export type ListContractsResponses = { +export type ReadContractResponses = { /** - * Successfully retrieved list of contracts + * Contract read operations completed successfully. Returns an array of results corresponding to each input call, including both successful and failed operations. */ 200: { - result: { + /** + * Array of results corresponding to each contract read call. Results are returned in the same order as the input calls. + */ + result: Array<{ /** - * Array of contracts imported by the client. + * The result of the contract read operation. The type and format depend on the method's return value as defined in the contract ABI. */ - 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; - }; - }; + data?: unknown; + /** + * Error message if the contract read operation failed. + */ + error?: string; + /** + * Indicates whether the contract read operation was successful. + */ + success: boolean; + }>; }; }; -export type ListContractsResponse = - ListContractsResponses[keyof ListContractsResponses]; +export type ReadContractResponse = + ReadContractResponses[keyof ReadContractResponses]; -export type DeployContractData = { - /** - * Contract deployment specification for raw bytecode deployment. - */ +export type WriteContractData = { 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. If omitted, the project wallet will be used if available. - */ - 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. + * Array of contract method calls to execute. Each call specifies a contract address, method signature, and optional parameters. */ calls: Array<{ /** @@ -3182,7 +3262,7 @@ export type WriteContractData = { */ 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. + * 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. For functions returning arrays of structs, use positional types only in the return declaration (e.g., `returns ((uint256, address, bool)[])` instead of `returns ((uint256 id, address owner, bool active)[] items)`). */ method: string; /** @@ -3202,6 +3282,10 @@ export type WriteContractData = { * The wallet address or ENS name that will send the transaction. If omitted, the project wallet will be used if available. */ from?: string; + /** + * An optional unique key to prevent duplicate transactions. If a request with the same idempotency key has already been submitted, the existing transaction will be returned instead of creating a new one. + */ + idempotencyKey?: string; }; path?: never; query?: never; @@ -3442,19 +3526,19 @@ export type GetContractTransactionsData = { /** * Filter by block timestamp (Unix timestamp) greater than or equal to this value */ - filterBlockTimestampGte?: number; + filterBlockTimestampGte?: number | null; /** * Filter by block timestamp (Unix timestamp) less than or equal to this value */ - filterBlockTimestampLte?: number; + filterBlockTimestampLte?: number | null; /** * Filter by block number greater than or equal to this value */ - filterBlockNumberGte?: number; + filterBlockNumberGte?: number | null; /** * Filter by block number less than or equal to this value */ - filterBlockNumberLte?: number; + filterBlockNumberLte?: number | null; /** * Filter by transaction value (in wei) greater than this value */ @@ -3466,11 +3550,11 @@ export type GetContractTransactionsData = { /** * Current page number */ - page?: number; + page?: number | null; /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Sort order: 'asc' for ascending, 'desc' for descending */ @@ -3624,15 +3708,15 @@ export type GetContractTransactionsResponses = { /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Total number of items available */ - totalCount?: number; + totalCount?: number | null; }; }; }; @@ -3677,27 +3761,27 @@ export type GetContractEventsData = { /** * Filter by block timestamp (Unix timestamp) greater than or equal to this value */ - filterBlockTimestampGte?: number; + filterBlockTimestampGte?: number | null; /** * Filter by block timestamp (Unix timestamp) less than or equal to this value */ - filterBlockTimestampLte?: number; + filterBlockTimestampLte?: number | null; /** * Filter by block number greater than or equal to this value */ - filterBlockNumberGte?: number; + filterBlockNumberGte?: number | null; /** * Filter by block number less than or equal to this value */ - filterBlockNumberLte?: number; + filterBlockNumberLte?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Sort order: 'asc' for ascending, 'desc' for descending */ @@ -3803,15 +3887,15 @@ export type GetContractEventsResponses = { /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Total number of items available */ - totalCount?: number; + totalCount?: number | null; }; }; }; @@ -3820,6 +3904,87 @@ export type GetContractEventsResponses = { export type GetContractEventsResponse = GetContractEventsResponses[keyof GetContractEventsResponses]; +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. If omitted, the project wallet will be used if available. + */ + 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 GetContractMetadataData = { body?: never; path: { @@ -4055,7 +4220,7 @@ export type GetTransactionByIdResponses = { /** * ISO timestamp when transaction was cancelled, if applicable */ - cancelledAt: string; + cancelledAt: string | null; /** * Blockchain network identifier as string */ @@ -4067,11 +4232,11 @@ export type GetTransactionByIdResponses = { /** * ISO timestamp when transaction was confirmed on-chain */ - confirmedAt: string; + confirmedAt: string | null; /** * Block number where transaction was confirmed */ - confirmedAtBlockNumber: string; + confirmedAtBlockNumber: string | null; /** * ISO timestamp when transaction was created */ @@ -4083,7 +4248,7 @@ export type GetTransactionByIdResponses = { /** * Error message if transaction failed */ - errorMessage: string; + errorMessage: string | null; /** * Parameters used for transaction execution */ @@ -4095,7 +4260,7 @@ export type GetTransactionByIdResponses = { /** * Sender wallet address */ - from: string; + from: string | null; /** * Unique transaction identifier */ @@ -4103,7 +4268,7 @@ export type GetTransactionByIdResponses = { /** * On-chain transaction hash once confirmed */ - transactionHash: string; + transactionHash: string | null; /** * Original transaction parameters and data */ @@ -4168,15 +4333,15 @@ export type ListTransactionsResponses = { /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Total number of items available */ - totalCount?: number; + totalCount?: number | null; }; transactions: Array<{ /** @@ -4186,7 +4351,7 @@ export type ListTransactionsResponses = { /** * ISO timestamp when transaction was cancelled, if applicable */ - cancelledAt: string; + cancelledAt: string | null; /** * Blockchain network identifier as string */ @@ -4198,11 +4363,11 @@ export type ListTransactionsResponses = { /** * ISO timestamp when transaction was confirmed on-chain */ - confirmedAt: string; + confirmedAt: string | null; /** * Block number where transaction was confirmed */ - confirmedAtBlockNumber: string; + confirmedAtBlockNumber: string | null; /** * ISO timestamp when transaction was created */ @@ -4214,7 +4379,7 @@ export type ListTransactionsResponses = { /** * Error message if transaction failed */ - errorMessage: string; + errorMessage: string | null; /** * Parameters used for transaction execution */ @@ -4226,7 +4391,7 @@ export type ListTransactionsResponses = { /** * Sender wallet address */ - from: string; + from: string | null; /** * Unique transaction identifier */ @@ -4234,7 +4399,7 @@ export type ListTransactionsResponses = { /** * On-chain transaction hash once confirmed */ - transactionHash: string; + transactionHash: string | null; /** * Original transaction parameters and data */ @@ -4495,222 +4660,437 @@ export type SendTransactionsResponses = { export type SendTransactionsResponse = SendTransactionsResponses[keyof SendTransactionsResponses]; -export type CreatePaymentData = { +export type VerifyX402PaymentData = { /** - * 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. + * Request body for x402 facilitator 'verify' */ body?: { - /** - * The name of the product - */ - name: string; - /** - * The description of the product - */ - description: string; - /** - * The URL of the product image - */ - imageUrl?: string; - /** - * The token to purchase - */ - token: { + paymentPayload: { + x402Version?: 1 | 2; + scheme?: "exact" | "upto"; /** - * The token address to purchase (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) - */ - address: string; - /** - * The blockchain network where the token is located + * CAIP-2 blockchain identifier (e.g., 'eip155:1' for Ethereum, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' for Solana mainnet). Also accepts numeric EVM chain IDs (e.g., 1, 137) or aliases ('solana:mainnet', 'solana:devnet') for backward compatibility. */ - chainId: number; + network: string | number; + payload: + | { + signature: string; + authorization: { + from: string; + to: string; + value: string; + validAfter: string; + validBefore: string; + nonce: string; + }; + } + | { + transaction: string; + }; + }; + paymentRequirements: { + scheme?: "exact" | "upto"; /** - * The amount of the token to purchase in wei. + * CAIP-2 blockchain identifier (e.g., 'eip155:1' for Ethereum, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' for Solana mainnet). Also accepts numeric EVM chain IDs (e.g., 1, 137) or aliases ('solana:mainnet', 'solana:devnet') for backward compatibility. */ - amount: string; + network: string | number; + maxAmountRequired: string; + resource: string; + description: string; + mimeType: string; + outputSchema?: { + [key: string]: unknown; + }; + payTo: string; + maxTimeoutSeconds: number; + asset: string; + extra?: { + [key: string]: unknown; + }; }; - /** - * 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/payments"; + url: "/v1/payments/x402/verify"; }; -export type CreatePaymentErrors = { +export type VerifyX402PaymentErrors = { /** - * Invalid request parameters. + * 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. + * Authentication required. For backend usage, include `x-secret-key` header. */ 401: unknown; /** - * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. + * Internal server error */ 500: unknown; }; -export type CreatePaymentResponses = { +export type VerifyX402PaymentResponses = { /** - * Create Payment Response - * Successful payment creation response containing the payment ID and link to purchase the product + * Response returned by x402 facilitator 'verify' */ 200: { - result: { - /** - * The payment ID - */ - id: string; - /** - * The link to purchase the product - */ - link: string; - }; - }; -}; - -export type CreatePaymentResponse = - CreatePaymentResponses[keyof CreatePaymentResponses]; - -export type GetPaymentHistoryData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: "/v1/payments/{id}"; -}; - -export type GetPaymentHistoryErrors = { - /** - * Bad request - */ - 400: { - error: string; - }; - /** - * Payment link not found - */ - 404: { - error: string; + isValid: boolean; + invalidReason?: + | "insufficient_funds" + | "invalid_exact_evm_payload_authorization_valid_after" + | "invalid_exact_evm_payload_authorization_valid_before" + | "invalid_exact_evm_payload_authorization_value" + | "invalid_exact_evm_payload_signature" + | "invalid_exact_evm_payload_recipient_mismatch" + | "invalid_exact_svm_payload_transaction" + | "invalid_exact_svm_payload_transaction_amount_mismatch" + | "invalid_exact_svm_payload_transaction_create_ata_instruction" + | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" + | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" + | "invalid_exact_svm_payload_transaction_instructions" + | "invalid_exact_svm_payload_transaction_instructions_length" + | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" + | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" + | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" + | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" + | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" + | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" + | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" + | "invalid_exact_svm_payload_transaction_sender_ata_not_found" + | "invalid_exact_svm_payload_transaction_simulation_failed" + | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" + | "invalid_network" + | "invalid_payload" + | "invalid_payment_requirements" + | "invalid_scheme" + | "invalid_payment" + | "payment_expired" + | "unsupported_scheme" + | "invalid_x402_version" + | "invalid_transaction_state" + | "settle_exact_svm_block_height_exceeded" + | "settle_exact_svm_transaction_confirmation_timed_out" + | "unexpected_settle_error" + | "unexpected_verify_error"; + payer?: string; + fundWalletLink?: string; + errorMessage?: string; + /** + * Payer's token balance in base units + */ + balance?: string; + /** + * Current ERC20 allowance from payer to spender (only for 'upto' scheme) + */ + allowance?: string; }; }; -export type GetPaymentHistoryError = - GetPaymentHistoryErrors[keyof GetPaymentHistoryErrors]; +export type VerifyX402PaymentResponse = + VerifyX402PaymentResponses[keyof VerifyX402PaymentResponses]; -export type GetPaymentHistoryResponses = { +export type SettleX402PaymentData = { /** - * Payment history retrieved successfully + * Request body for x402 facilitator 'settle' */ - 200: { + body?: { /** - * List of payments for the client + * Exact x402 payment payload to settle */ - 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; + paymentPayload: + | { + x402Version?: 1 | 2; + scheme?: "exact" | "upto"; + /** + * CAIP-2 blockchain identifier (e.g., 'eip155:1' for Ethereum, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' for Solana mainnet). Also accepts numeric EVM chain IDs (e.g., 1, 137) or aliases ('solana:mainnet', 'solana:devnet') for backward compatibility. + */ + network: string | number; + payload: { + /** + * The signature of the payment + */ + signature: string; + authorization: { + /** + * The from address of the payment + */ + from: string; + /** + * The to address of the payment + */ + to: string; + /** + * The value of the payment + */ + value: string; + /** + * The valid after timestamp of the payment + */ + validAfter: string; + /** + * The valid before timestamp of the payment + */ + validBefore: string; + /** + * The nonce of the payment + */ + nonce: string; + }; + }; + } + | { + x402Version?: 1 | 2; + scheme?: "exact" | "upto"; + /** + * CAIP-2 blockchain identifier (e.g., 'eip155:1' for Ethereum, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' for Solana mainnet). Also accepts numeric EVM chain IDs (e.g., 1, 137) or aliases ('solana:mainnet', 'solana:devnet') for backward compatibility. + */ + network: string | number; + payload: { + /** + * Base64-encoded Solana transaction + */ + transaction: string; + }; + }; + paymentRequirements: { + scheme?: "exact" | "upto"; /** - * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + * CAIP-2 blockchain identifier (e.g., 'eip155:1' for Ethereum, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' for Solana mainnet). Also accepts numeric EVM chain IDs (e.g., 1, 137) or aliases ('solana:mainnet', 'solana:devnet') for backward compatibility. */ - 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; + network: string | number; + maxAmountRequired: string; + resource: string; + description: string; + mimeType: string; + outputSchema?: { + [key: string]: unknown; }; - 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; + payTo: string; + maxTimeoutSeconds: number; + asset: string; + extra?: { + [key: string]: unknown; }; - createdAt: string; - }>; - meta: { - /** - * Total number of payments - */ - totalCount: number; + x402Version?: 1 | 2; }; - }; -}; - -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 wallet address or ENS name that will purchase the product. If omitted, the project wallet will be used if available. + * The event to wait for to determina a transaction confirmation. 'simulated' will only simulate the transaction (fastest), 'submitted' will wait till the transaction is submitted, and 'confirmed' will wait for the transaction to be fully confirmed on chain (slowest). Defaults to 'confirmed'. */ - from?: string; - }; - path: { - id: string; + waitUntil?: "simulated" | "submitted" | "confirmed"; }; + path?: never; query?: never; - url: "/v1/payments/{id}"; + url: "/v1/payments/x402/settle"; }; -export type PaymentsPurchaseErrors = { +export type SettleX402PaymentErrors = { /** - * Invalid request parameters. + * 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. + * Authentication required. For backend usage, include `x-secret-key` header. */ 401: unknown; /** - * Payment Required Response - * Payment required response when user has insufficient funds. Contains a quote for completing the purchase. + * Internal server error + */ + 500: unknown; +}; + +export type SettleX402PaymentResponses = { + /** + * Response returned by x402 facilitator 'settle' + */ + 200: { + success: boolean; + errorReason?: + | "insufficient_funds" + | "invalid_exact_evm_payload_authorization_valid_after" + | "invalid_exact_evm_payload_authorization_valid_before" + | "invalid_exact_evm_payload_authorization_value" + | "invalid_exact_evm_payload_signature" + | "invalid_exact_evm_payload_recipient_mismatch" + | "invalid_exact_svm_payload_transaction" + | "invalid_exact_svm_payload_transaction_amount_mismatch" + | "invalid_exact_svm_payload_transaction_create_ata_instruction" + | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" + | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" + | "invalid_exact_svm_payload_transaction_instructions" + | "invalid_exact_svm_payload_transaction_instructions_length" + | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" + | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" + | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" + | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" + | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" + | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" + | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" + | "invalid_exact_svm_payload_transaction_sender_ata_not_found" + | "invalid_exact_svm_payload_transaction_simulation_failed" + | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" + | "invalid_network" + | "invalid_payload" + | "invalid_payment_requirements" + | "invalid_scheme" + | "invalid_payment" + | "payment_expired" + | "unsupported_scheme" + | "invalid_x402_version" + | "invalid_transaction_state" + | "settle_exact_svm_block_height_exceeded" + | "settle_exact_svm_transaction_confirmation_timed_out" + | "unexpected_settle_error" + | "unexpected_verify_error"; + payer?: string; + transaction: string; + network: + | "base-sepolia" + | "base" + | "avalanche-fuji" + | "avalanche" + | "iotex" + | "solana-devnet" + | "solana" + | "sei" + | "sei-testnet" + | "polygon" + | "polygon-amoy" + | "peaq"; + errorMessage?: string; + fundWalletLink?: string; + }; +}; + +export type SettleX402PaymentResponse = + SettleX402PaymentResponses[keyof SettleX402PaymentResponses]; + +export type SupportedX402PaymentsData = { + body?: never; + path?: never; + query?: { + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + tokenAddress?: string; + /** + * Chain ID in CAIP-2 format (e.g., 'eip155:1' for Ethereum, 'solana:mainnet' for Solana). Also accepts legacy numeric IDs for EVM chains. + */ + chainId?: string | number; + }; + url: "/v1/payments/x402/supported"; +}; + +export type SupportedX402PaymentsErrors = { + /** + * Authentication required. For backend usage, include `x-secret-key` header. + */ + 401: unknown; + /** + * Internal server error + */ + 500: unknown; +}; + +export type SupportedX402PaymentsResponses = { + /** + * Supported payment kinds for this facilitator + */ + 200: { + kinds: Array<{ + x402Version?: 1 | 2; + scheme?: "exact" | "upto"; + /** + * CAIP-2 blockchain identifier (e.g., 'eip155:1' for Ethereum, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' for Solana mainnet). Also accepts numeric EVM chain IDs (e.g., 1, 137) or aliases ('solana:mainnet', 'solana:devnet') for backward compatibility. + */ + network: string | number; + extra?: { + defaultAsset?: { + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + address: string; + decimals: number; + eip712: { + name: string; + version: string; + primaryType: "TransferWithAuthorization" | "Permit"; + }; + }; + supportedAssets?: Array<{ + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + address: string; + decimals: number; + eip712: { + name: string; + version: string; + primaryType: "TransferWithAuthorization" | "Permit"; + }; + }>; + }; + }>; + }; +}; + +export type SupportedX402PaymentsResponse = + SupportedX402PaymentsResponses[keyof SupportedX402PaymentsResponses]; + +export type FetchWithPaymentData = { + /** + * Body + * Optional body to send to the target url if method is POST, PUT, PATCH, or DELETE. Should be a valid javascript object. + */ + body?: { + [key: string]: unknown; + }; + path?: never; + query: { + /** + * From + * The authenticated wallet address (server or user wallet) + */ + from?: string; + /** + * URL + * The url to fetch + */ + url: string; + /** + * Method + * The method to use, defaults to GET + */ + method?: "POST" | "PUT" | "DELETE" | "PATCH" | "GET"; + /** + * Max Value + * The maximum value to fetch in base units of the asset (e.g. 1000000 for 1 USDC) + */ + maxValue?: string; + /** + * Asset + * The asset (token address) to use for the payment. If not provided, the asset from the url's payment requirements will be used. + */ + asset?: string; + /** + * Chain ID to use for the payment. Supports CAIP-2 strings (e.g., 'eip155:1', 'solana:mainnet') or legacy numeric EVM IDs. + */ + chainId?: string | number; + }; + url: "/v1/payments/x402/fetch"; +}; + +export type FetchWithPaymentErrors = { + /** + * Invalid request parameters + */ + 400: unknown; + /** + * Authentication required. For frontend usage, include `x-client-id` and `Authorization: Bearer ` headers. For backend usage, include `x-secret-key` header. + */ + 401: unknown; + /** + * Payment Required Response + * Payment required response when user has insufficient funds. Contains a quote for completing the purchase. */ 402: { result: { @@ -4881,80 +5261,245 @@ export type PaymentsPurchaseErrors = { }; }; /** - * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. + * Internal server error */ 500: unknown; }; -export type PaymentsPurchaseError = - PaymentsPurchaseErrors[keyof PaymentsPurchaseErrors]; +export type FetchWithPaymentError = + FetchWithPaymentErrors[keyof FetchWithPaymentErrors]; -export type PaymentsPurchaseResponses = { +export type FetchWithPaymentResponses = { /** - * Product purchased successfully. Returns the transaction used for the purchase. + * Returns the final result from the API call */ - 200: { - result: { - /** - * Transaction ID that was executed for your product purchase - */ - transactionId: string; - }; + 200: unknown; +}; + +export type ListPayableServicesData = { + body?: never; + path?: never; + query?: { + limit?: number | null; + offset?: number | null; + query?: string; + sortBy?: + | "createdAt" + | "totalRequests" + | "totalVolume" + | "price" + | "uniqueBuyers"; + sortOrder?: "asc" | "desc"; }; + url: "/v1/payments/x402/discovery/resources"; }; -export type PaymentsPurchaseResponse = - PaymentsPurchaseResponses[keyof PaymentsPurchaseResponses]; +export type ListPayableServicesErrors = { + /** + * Authentication required. For backend usage, include `x-secret-key` header. + */ + 401: unknown; + /** + * Internal server error + */ + 500: unknown; +}; -export type VerifyX402PaymentData = { +export type ListPayableServicesResponses = { /** - * Request body for x402 facilitator 'verify' + * List of discovered x402 resources */ - body?: { - paymentPayload: { + 200: { + x402Version: number; + items: Array<{ + resource: string; + type: "http"; x402Version: number; - scheme: "exact"; - network: string; - payload: - | { - signature: string; - authorization: { - from: string; - to: string; - value: string; - validAfter: string; - validBefore: string; - nonce: string; - }; - } - | { - transaction: string; - }; - }; - paymentRequirements: { - scheme: "exact"; - network: string; - maxAmountRequired: string; - resource: string; - description: string; - mimeType: string; - outputSchema?: { + accepts: Array<{ + scheme?: "exact" | "upto"; + /** + * CAIP-2 blockchain identifier (e.g., 'eip155:1' for Ethereum, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' for Solana mainnet). Also accepts numeric EVM chain IDs (e.g., 1, 137) or aliases ('solana:mainnet', 'solana:devnet') for backward compatibility. + */ + network: string | number; + maxAmountRequired: string; + resource: string; + description: string; + mimeType: string; + outputSchema?: { + [key: string]: unknown; + }; + payTo: string; + maxTimeoutSeconds: number; + asset: string; + extra?: { + [key: string]: unknown; + }; + }>; + lastUpdated: string; + metadata?: { [key: string]: unknown; }; - payTo: string; - maxTimeoutSeconds: number; - asset: string; - extra?: { + }>; + pagination: { + limit: number; + offset: number; + total: number; + }; + }; +}; + +export type ListPayableServicesResponse = + ListPayableServicesResponses[keyof ListPayableServicesResponses]; + +export type GetX402AcceptsData = { + body?: { + /** + * The URL of the resource being protected by the payment + */ + resourceUrl: string; + /** + * The HTTP method used to access the resource + */ + method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH"; + /** + * The blockchain network where the payment should be processed + */ + network: string | number; + /** + * The price for accessing the resource - either a USD amount (e.g., '$0.10') or a specific token amount + */ + price: + | (string | number) + | { + amount: string; + asset: { + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + address: string; + decimals?: number; + eip712?: { + name: string; + version: string; + primaryType: "TransferWithAuthorization" | "Permit"; + }; + }; + } + | { + amount: string; + asset: { + /** + * A valid Solana address (base58 string). + */ + address: string; + /** + * Number of decimals for the SPL token + */ + decimals: number; + /** + * Optional token program. Defaults to the SPL Token program if omitted. + */ + tokenProgram?: + | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + | "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"; + }; + }; + /** + * Optional minimum price for 'upto' scheme. When specified, verify will accept payments where allowance >= minPrice. Must use same format as price. + */ + minPrice?: + | (string | number) + | { + amount: string; + asset: { + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + address: string; + decimals?: number; + eip712?: { + name: string; + version: string; + primaryType: "TransferWithAuthorization" | "Permit"; + }; + }; + } + | { + amount: string; + asset: { + /** + * A valid Solana address (base58 string). + */ + address: string; + /** + * Number of decimals for the SPL token + */ + decimals: number; + /** + * Optional token program. Defaults to the SPL Token program if omitted. + */ + tokenProgram?: + | "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + | "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"; + }; + }; + scheme?: "exact" | "upto"; + /** + * Optional configuration for the payment middleware route + */ + routeConfig?: { + description?: string; + mimeType?: string; + maxTimeoutSeconds?: number; + inputSchema?: { + queryParams?: { + [key: string]: string; + }; + bodyType?: + | "json" + | "form-data" + | "multipart-form-data" + | "text" + | "binary"; + bodyFields?: { + [key: string]: unknown; + }; + headerFields?: { + [key: string]: unknown; + }; + }; + outputSchema?: { [key: string]: unknown; }; + discoverable?: boolean; + customPaywallHtml?: string; + resource?: string; + }; + /** + * Your server wallet address, defaults to the project server wallet address + */ + serverWalletAddress?: string; + /** + * Optional recipient address to receive the payment if different from your facilitator server wallet address + */ + recipientAddress?: string; + /** + * Optional extra data to be passed to in the payment requirements. + */ + extraMetadata?: { + [key: string]: unknown; }; + /** + * x402 protocol version. Version 2 returns requirements in PAYMENT-REQUIRED header instead of response body. + */ + x402Version?: 1 | 2; }; path?: never; query?: never; - url: "/v1/payments/x402/verify"; + url: "/v1/payments/x402/accepts"; }; -export type VerifyX402PaymentErrors = { +export type GetX402AcceptsErrors = { /** * Invalid request parameters */ @@ -4964,90 +5509,54 @@ export type VerifyX402PaymentErrors = { */ 401: unknown; /** - * Internal server error + * Payment required – returns x402 payment requirements */ - 500: unknown; -}; - -export type VerifyX402PaymentResponses = { + 402: { + x402Version: number; + error?: string; + accepts: Array<{ + scheme?: "exact" | "upto"; + /** + * CAIP-2 blockchain identifier (e.g., 'eip155:1' for Ethereum, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' for Solana mainnet). Also accepts numeric EVM chain IDs (e.g., 1, 137) or aliases ('solana:mainnet', 'solana:devnet') for backward compatibility. + */ + network: string | number; + maxAmountRequired: string; + resource: string; + description: string; + mimeType: string; + outputSchema?: { + [key: string]: unknown; + }; + payTo: string; + maxTimeoutSeconds: number; + asset: string; + extra?: { + [key: string]: unknown; + }; + }>; + }; /** - * Response returned by x402 facilitator 'verify' + * Internal server error */ - 200: { - isValid: boolean; - invalidReason?: - | "insufficient_funds" - | "invalid_exact_evm_payload_authorization_valid_after" - | "invalid_exact_evm_payload_authorization_valid_before" - | "invalid_exact_evm_payload_authorization_value" - | "invalid_exact_evm_payload_signature" - | "invalid_exact_evm_payload_recipient_mismatch" - | "invalid_exact_svm_payload_transaction" - | "invalid_exact_svm_payload_transaction_amount_mismatch" - | "invalid_exact_svm_payload_transaction_create_ata_instruction" - | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" - | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" - | "invalid_exact_svm_payload_transaction_instructions" - | "invalid_exact_svm_payload_transaction_instructions_length" - | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" - | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" - | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" - | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" - | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" - | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" - | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" - | "invalid_exact_svm_payload_transaction_sender_ata_not_found" - | "invalid_exact_svm_payload_transaction_simulation_failed" - | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" - | "invalid_network" - | "invalid_payload" - | "invalid_payment_requirements" - | "invalid_scheme" - | "invalid_payment" - | "payment_expired" - | "unsupported_scheme" - | "invalid_x402_version" - | "invalid_transaction_state" - | "settle_exact_svm_block_height_exceeded" - | "settle_exact_svm_transaction_confirmation_timed_out" - | "unexpected_settle_error" - | "unexpected_verify_error"; - payer?: string; - errorMessage?: string; - }; + 500: unknown; }; -export type VerifyX402PaymentResponse = - VerifyX402PaymentResponses[keyof VerifyX402PaymentResponses]; +export type GetX402AcceptsError = + GetX402AcceptsErrors[keyof GetX402AcceptsErrors]; -export type SettleX402PaymentData = { +export type GetX402AcceptsResponses = { /** - * Request body for x402 facilitator 'settle' + * Returns x402 payment requirements */ - body?: { - paymentPayload: { - x402Version: number; - scheme: "exact"; - network: string; - payload: - | { - signature: string; - authorization: { - from: string; - to: string; - value: string; - validAfter: string; - validBefore: string; - nonce: string; - }; - } - | { - transaction: string; - }; - }; - paymentRequirements: { - scheme: "exact"; - network: string; + 200: { + x402Version: number; + error?: string; + accepts: Array<{ + scheme?: "exact" | "upto"; + /** + * CAIP-2 blockchain identifier (e.g., 'eip155:1' for Ethereum, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' for Solana mainnet). Also accepts numeric EVM chain IDs (e.g., 1, 137) or aliases ('solana:mainnet', 'solana:devnet') for backward compatibility. + */ + network: string | number; maxAmountRequired: string; resource: string; description: string; @@ -5061,514 +5570,48 @@ export type SettleX402PaymentData = { extra?: { [key: string]: unknown; }; - }; + }>; + }; +}; + +export type GetX402AcceptsResponse = + GetX402AcceptsResponses[keyof GetX402AcceptsResponses]; + +export type ListTokensData = { + body?: never; + path?: never; + query?: { /** - * The event to wait for to determina a transaction confirmation. 'simulated' will only simulate the transaction (fastest), 'submitted' will wait till the transaction is submitted, and 'confirmed' will wait for the transaction to be fully confirmed on chain (slowest). Defaults to 'confirmed'. + * Number of tokens to return per page (1-100). */ - waitUntil?: "simulated" | "submitted" | "confirmed"; + 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; }; - path?: never; - query?: never; - url: "/v1/payments/x402/settle"; + url: "/v1/tokens"; }; -export type SettleX402PaymentErrors = { +export type ListTokensErrors = { /** - * Invalid request parameters - */ - 400: unknown; - /** - * Authentication required. For backend usage, include `x-secret-key` header. - */ - 401: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type SettleX402PaymentResponses = { - /** - * Response returned by x402 facilitator 'settle' - */ - 200: { - success: boolean; - errorReason?: - | "insufficient_funds" - | "invalid_exact_evm_payload_authorization_valid_after" - | "invalid_exact_evm_payload_authorization_valid_before" - | "invalid_exact_evm_payload_authorization_value" - | "invalid_exact_evm_payload_signature" - | "invalid_exact_evm_payload_recipient_mismatch" - | "invalid_exact_svm_payload_transaction" - | "invalid_exact_svm_payload_transaction_amount_mismatch" - | "invalid_exact_svm_payload_transaction_create_ata_instruction" - | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee" - | "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset" - | "invalid_exact_svm_payload_transaction_instructions" - | "invalid_exact_svm_payload_transaction_instructions_length" - | "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction" - | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction" - | "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high" - | "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked" - | "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked" - | "invalid_exact_svm_payload_transaction_not_a_transfer_instruction" - | "invalid_exact_svm_payload_transaction_receiver_ata_not_found" - | "invalid_exact_svm_payload_transaction_sender_ata_not_found" - | "invalid_exact_svm_payload_transaction_simulation_failed" - | "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata" - | "invalid_network" - | "invalid_payload" - | "invalid_payment_requirements" - | "invalid_scheme" - | "invalid_payment" - | "payment_expired" - | "unsupported_scheme" - | "invalid_x402_version" - | "invalid_transaction_state" - | "settle_exact_svm_block_height_exceeded" - | "settle_exact_svm_transaction_confirmation_timed_out" - | "unexpected_settle_error" - | "unexpected_verify_error"; - payer?: string; - transaction: string; - network: - | "base-sepolia" - | "base" - | "avalanche-fuji" - | "avalanche" - | "iotex" - | "solana-devnet" - | "solana" - | "sei" - | "sei-testnet" - | "polygon" - | "polygon-amoy" - | "peaq"; - errorMessage?: string; - }; -}; - -export type SettleX402PaymentResponse = - SettleX402PaymentResponses[keyof SettleX402PaymentResponses]; - -export type SupportedX402PaymentsData = { - body?: never; - path?: never; - query?: { - /** - * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). - */ - tokenAddress?: string; - /** - * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). - */ - chainId?: number; - }; - url: "/v1/payments/x402/supported"; -}; - -export type SupportedX402PaymentsErrors = { - /** - * Authentication required. For backend usage, include `x-secret-key` header. - */ - 401: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type SupportedX402PaymentsResponses = { - /** - * Supported payment kinds for this facilitator - */ - 200: { - kinds: Array<{ - x402Version: 1; - scheme: "exact"; - network: string; - extra?: { - defaultAsset?: { - /** - * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). - */ - address: string; - decimals: number; - eip712: { - name: string; - version: string; - primaryType: "TransferWithAuthorization" | "Permit"; - }; - }; - supportedAssets?: Array<{ - /** - * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). - */ - address: string; - decimals: number; - eip712: { - name: string; - version: string; - primaryType: "TransferWithAuthorization" | "Permit"; - }; - }>; - }; - }>; - }; -}; - -export type SupportedX402PaymentsResponse = - SupportedX402PaymentsResponses[keyof SupportedX402PaymentsResponses]; - -export type FetchWithPaymentData = { - /** - * Body - * Optional body to send to the target url if method is POST, PUT, PATCH, or DELETE. Should be a valid javascript object. - */ - body?: { - [key: string]: unknown; - }; - path?: never; - query: { - /** - * From - * The authenticated wallet address (server or user wallet) - */ - from?: string; - /** - * URL - * The url to fetch - */ - url: string; - /** - * Method - * The method to use, defaults to GET - */ - method?: "POST" | "PUT" | "DELETE" | "PATCH" | "GET"; - /** - * Max Value - * The maximum value to fetch in base units of the asset (e.g. 1000000 for 1 USDC) - */ - maxValue?: string; - /** - * Asset - * The asset (token address) to use for the payment. If not provided, the asset from the url's payment requirements will be used. - */ - asset?: string; - /** - * Chain ID - * The chain ID to use for the payment. If not provided, the chain ID from the url's payment requirements will be used. - */ - chainId?: number; - }; - url: "/v1/payments/x402/fetch"; -}; - -export type FetchWithPaymentErrors = { - /** - * Invalid request parameters - */ - 400: unknown; - /** - * Authentication required. For frontend usage, include `x-client-id` and `Authorization: Bearer ` headers. For backend usage, include `x-secret-key` header. - */ - 401: unknown; - /** - * Payment Required Response - * Payment required response when user has insufficient funds. Contains a quote for completing the purchase. - */ - 402: { - result: { - /** - * Message to display to the user - */ - message: string; - /** - * Link to purchase the product - */ - link: string; - /** - * Payment ID - */ - id?: string; - /** - * Bridge quote for completing the payment - */ - quote?: { - /** - * Block number when quote was generated - */ - blockNumber?: string; - /** - * Destination amount in wei - */ - destinationAmount: string; - /** - * Estimated execution time in milliseconds - */ - estimatedExecutionTimeMs?: number; - /** - * Quote intent details - */ - intent: { - /** - * The amount in wei - */ - amount: string; - /** - * Destination chain ID - */ - destinationChainId: number; - /** - * Destination token address - */ - destinationTokenAddress: string; - /** - * Origin chain ID - */ - originChainId: number; - /** - * Origin token address - */ - originTokenAddress: string; - /** - * Receiver address - */ - receiver: string; - /** - * Sender address - */ - sender: string; - }; - /** - * Origin amount in wei - */ - originAmount: string; - /** - * Array of steps to complete the bridge operation - */ - steps: Array<{ - /** - * Origin token information - */ - originToken: { - /** - * 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; - }; - }; - /** - * Destination token information - */ - destinationToken: { - /** - * 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; - }; - }; - /** - * Array of transactions for this step - */ - transactions: Array<{ - /** - * Blockchain network identifier - */ - chainId: number; - /** - * Transaction recipient address - */ - to: string; - /** - * Transaction data payload - */ - data: string; - /** - * Type of action this transaction performs - */ - action: "approval" | "transfer" | "buy" | "sell" | "fee"; - /** - * Transaction sender address - */ - from?: string; - /** - * Spender address for approval transactions - */ - spender?: string; - /** - * Transaction value in wei - */ - value?: string; - }>; - /** - * Origin amount in wei - */ - originAmount: string; - /** - * Destination amount in wei - */ - destinationAmount: string; - /** - * Estimated execution time in milliseconds - */ - estimatedExecutionTimeMs?: number; - }>; - /** - * Quote timestamp - */ - timestamp: number; - }; - }; - }; - /** - * Internal server error - */ - 500: unknown; -}; - -export type FetchWithPaymentError = - FetchWithPaymentErrors[keyof FetchWithPaymentErrors]; - -export type FetchWithPaymentResponses = { - /** - * Returns the final result from the API call - */ - 200: unknown; -}; - -export type ListPayableServicesData = { - body?: never; - path?: never; - query?: { - limit?: number; - offset?: number; - query?: string; - sortBy?: - | "createdAt" - | "totalRequests" - | "totalVolume" - | "price" - | "uniqueBuyers"; - sortOrder?: "asc" | "desc"; - }; - url: "/v1/payments/x402/discovery/resources"; -}; - -export type ListPayableServicesErrors = { - /** - * Authentication required. For backend usage, include `x-secret-key` header. - */ - 401: unknown; - /** - * Internal server error - */ - 500: unknown; -}; - -export type ListPayableServicesResponses = { - /** - * List of discovered x402 resources - */ - 200: { - x402Version: number; - items: Array<{ - resource: string; - type: "http"; - x402Version: number; - accepts: Array<{ - scheme: "exact"; - network: string; - maxAmountRequired: string; - resource: string; - description: string; - mimeType: string; - outputSchema?: { - [key: string]: unknown; - }; - payTo: string; - maxTimeoutSeconds: number; - asset: string; - extra?: { - [key: string]: unknown; - }; - }>; - lastUpdated: string; - metadata?: { - [key: string]: unknown; - }; - }>; - pagination: { - limit: number; - offset: number; - total: number; - }; - }; -}; - -export type ListPayableServicesResponse = - ListPayableServicesResponses[keyof ListPayableServicesResponses]; - -export type ListTokensData = { - body?: never; - path?: never; - 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 ListTokensErrors = { - /** - * Invalid request parameters. + * Invalid request parameters. */ 400: unknown; /** @@ -5594,15 +5637,15 @@ export type ListTokensResponses = { /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Total number of items available */ - totalCount?: number; + totalCount?: number | null; }; tokens: Array<{ /** @@ -5755,7 +5798,7 @@ export type GetTokenOwnersData = { /** * Optional token ID for NFT owners. If provided, returns owners of the specific NFT token. */ - tokenId?: string; + tokenId?: string | null; /** * Number of owners to return per page (1-100). */ @@ -5818,15 +5861,15 @@ export type GetTokenOwnersResponses = { /** * Number of items per page */ - limit?: number; + limit?: number | null; /** * Current page number */ - page?: number; + page?: number | null; /** * Total number of items available */ - totalCount?: number; + totalCount?: number | null; }; }; }; @@ -5911,54 +5954,326 @@ export type GetBridgeSupportedRoutesData = { */ page?: number; /** - * Filter routes by the origin chain ID. + * Filter routes by the origin chain ID. + */ + originChainId?: number; + /** + * Filter routes by the destination chain ID. + */ + destinationChainId?: number; + /** + * Filter routes by origin token address. + */ + originTokenAddress?: string; + /** + * Filter routes by destination token address. + */ + destinationTokenAddress?: string; + /** + * Maximum number of bridge steps allowed in the route. + */ + maxSteps?: number; + }; + url: "/v1/bridge/routes"; +}; + +export type GetBridgeSupportedRoutesErrors = { + /** + * Invalid request parameters. + */ + 400: unknown; + /** + * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` header. + */ + 401: unknown; + /** + * Internal server error occurred while fetching bridge routes. + */ + 500: unknown; +}; + +export type GetBridgeSupportedRoutesResponses = { + /** + * Successfully retrieved supported bridge routes. + */ + 200: { + result: { + /** + * Supported bridge routes that match the provided filters. + */ + routes: Array<{ + originToken: { + /** + * Chain identifier for the token + */ + chainId: number; + /** + * Token contract address + */ + address: string; + /** + * Token symbol + */ + symbol: string; + /** + * Token name + */ + name: string; + /** + * Number of decimals the token uses + */ + decimals: number; + /** + * Optional icon URL for the token + */ + iconUri?: string; + /** + * 24h market capitalization in USD when available + */ + marketCapUsd?: number; + /** + * 24h trading volume in USD when available + */ + volume24hUsd?: number; + /** + * Token price quotes keyed by fiat currency code + */ + prices?: { + [key: string]: number; + }; + }; + destinationToken: { + /** + * Chain identifier for the token + */ + chainId: number; + /** + * Token contract address + */ + address: string; + /** + * Token symbol + */ + symbol: string; + /** + * Token name + */ + name: string; + /** + * Number of decimals the token uses + */ + decimals: number; + /** + * Optional icon URL for the token + */ + iconUri?: string; + /** + * 24h market capitalization in USD when available + */ + marketCapUsd?: number; + /** + * 24h trading volume in USD when available + */ + volume24hUsd?: number; + /** + * Token price quotes keyed by fiat currency code + */ + prices?: { + [key: string]: number; + }; + }; + }>; + /** + * Pagination details for the returned routes. + */ + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number | null; + /** + * Current page number + */ + page?: number | null; + /** + * Total number of items available + */ + totalCount?: number | null; + }; + }; + }; +}; + +export type GetBridgeSupportedRoutesResponse = + GetBridgeSupportedRoutesResponses[keyof GetBridgeSupportedRoutesResponses]; + +export type ConvertFiatToCryptoData = { + body?: never; + path?: never; + query: { + /** + * The fiat currency symbol + */ + from: + | "USD" + | "EUR" + | "GBP" + | "JPY" + | "KRW" + | "CNY" + | "INR" + | "NOK" + | "SEK" + | "CHF" + | "AUD" + | "CAD" + | "NZD" + | "MXN" + | "BRL" + | "CLP" + | "CZK" + | "DKK" + | "HKD" + | "HUF" + | "IDR" + | "ILS" + | "ISK"; + /** + * The amount of fiat currency to convert + */ + fromAmount: string; + /** + * The blockchain network identifier + */ + chainId: number; + /** + * The token address on the specified chain to convert to + */ + to: string; + }; + url: "/v1/bridge/convert"; +}; + +export type ConvertFiatToCryptoErrors = { + /** + * Bad request. Invalid parameters such as invalid amounts, malformed token address, or invalid currency code. + */ + 400: unknown; + /** + * Authentication required. Include `x-client-id` header for frontend usage or `x-secret-key` for backend usage. + */ + 401: unknown; + /** + * Token not found, price data unavailable for the specified token on the given chain, or price data not available for the requested currency. + */ + 404: unknown; + /** + * Too many requests. Rate limit exceeded. + */ + 429: unknown; + /** + * Internal server error. This may occur due to network connectivity issues or external service failures. + */ + 500: unknown; +}; + +export type ConvertFiatToCryptoResponses = { + /** + * Conversion completed successfully. Returns the amount of crypto tokens equivalent to the specified fiat amount. + */ + 200: { + /** + * The conversion result - amount of crypto tokens for the fiat amount + */ + result: number; + }; +}; + +export type ConvertFiatToCryptoResponse = + ConvertFiatToCryptoResponses[keyof ConvertFiatToCryptoResponses]; + +export type BridgeQuoteData = { + body?: never; + path?: never; + query: { + /** + * Whether `amount` is the exact input amount (sell) or the exact output amount (buy). + */ + exact?: "input" | "output"; + /** + * Chain ID of the input token. */ - originChainId?: number; + originChainId: number; /** - * Filter routes by the destination chain ID. + * Input token address (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for the native token). */ - destinationChainId?: number; + originTokenAddress: string; /** - * Filter routes by origin token address. + * Chain ID of the output token. */ - originTokenAddress?: string; + destinationChainId: number; /** - * Filter routes by destination token address. + * Output token address (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for the native token). */ - destinationTokenAddress?: string; + destinationTokenAddress: string; /** - * Maximum number of bridge steps allowed in the route. + * Amount in wei. The input amount when exact='input', the output amount when exact='output'. */ - maxSteps?: number; + amount: string; }; - url: "/v1/bridge/routes"; + url: "/v1/bridge/quote"; }; -export type GetBridgeSupportedRoutesErrors = { +export type BridgeQuoteErrors = { /** * Invalid request parameters. */ 400: unknown; /** - * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` header. + * Authentication required. Include `x-secret-key` header for backend usage or `x-client-id` for frontend usage. */ 401: unknown; /** - * Internal server error occurred while fetching bridge routes. + * No route available for the requested token pair. + */ + 404: unknown; + /** + * Internal server error. */ 500: unknown; }; -export type GetBridgeSupportedRoutesResponses = { +export type BridgeQuoteResponses = { /** - * Successfully retrieved supported bridge routes. + * Quote for the requested swap or bridge. */ 200: { result: { /** - * Supported bridge routes that match the provided filters. + * Total input amount in wei */ - routes: Array<{ + originAmount: string; + /** + * Total output amount in wei + */ + destinationAmount: string; + /** + * Block number the quote was computed at + */ + blockNumber?: string; + /** + * Unix timestamp in milliseconds when the quote was computed + */ + timestamp: number; + /** + * Estimated end-to-end execution time in milliseconds + */ + estimatedExecutionTimeMs?: number; + steps: Array<{ originToken: { /** * Chain identifier for the token @@ -5998,6 +6313,10 @@ export type GetBridgeSupportedRoutesResponses = { prices?: { [key: string]: number; }; + /** + * Token price in USD when available + */ + priceUsd?: number; }; destinationToken: { /** @@ -6021,199 +6340,546 @@ export type GetBridgeSupportedRoutesResponses = { */ decimals: number; /** - * Optional icon URL for the token + * Optional icon URL for the token + */ + iconUri?: string; + /** + * 24h market capitalization in USD when available + */ + marketCapUsd?: number; + /** + * 24h trading volume in USD when available + */ + volume24hUsd?: number; + /** + * Token price quotes keyed by fiat currency code + */ + prices?: { + [key: string]: number; + }; + /** + * Token price in USD when available + */ + priceUsd?: number; + }; + /** + * Input amount for this step in wei + */ + originAmount: string; + /** + * Output amount for this step in wei + */ + destinationAmount: string; + /** + * Estimated execution time for this step in milliseconds + */ + estimatedExecutionTimeMs?: number; + }>; + /** + * The intent this quote was computed for + */ + intent: { + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + originChainId: number; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + originTokenAddress: string; + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + destinationChainId: number; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + destinationTokenAddress: string; + amount: string; + maxSteps?: number; + }; + }; + }; +}; + +export type BridgeQuoteResponse = + BridgeQuoteResponses[keyof BridgeQuoteResponses]; + +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. If omitted, the project wallet will be used if available. + */ + from?: string; + /** + * The wallet address that will receive the swapped tokens. Defaults to the sender address if not specified. + */ + receiver?: string; + /** + * The slippage tolerance in basis points. Will be automatically calculated by default. + */ + slippageToleranceBps?: number | null; + }; + 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 Response + * Payment required response when user has insufficient funds. Contains a quote for completing the purchase. + */ + 402: { + result: { + /** + * Message to display to the user + */ + message: string; + /** + * Link to purchase the product + */ + link: string; + /** + * Payment ID + */ + id?: string; + /** + * Bridge quote for completing the payment + */ + quote?: { + /** + * Block number when quote was generated + */ + blockNumber?: string; + /** + * Destination amount in wei + */ + destinationAmount: string; + /** + * Estimated execution time in milliseconds + */ + estimatedExecutionTimeMs?: number; + /** + * Quote intent details + */ + intent: { + /** + * The amount in wei + */ + amount: string; + /** + * Destination chain ID + */ + destinationChainId: number; + /** + * Destination token address + */ + destinationTokenAddress: string; + /** + * Origin chain ID + */ + originChainId: number; + /** + * Origin token address + */ + originTokenAddress: string; + /** + * Receiver address + */ + receiver: string; + /** + * Sender address + */ + sender: string; + }; + /** + * Origin amount in wei + */ + originAmount: string; + /** + * Array of steps to complete the bridge operation + */ + steps: Array<{ + /** + * Origin token information + */ + originToken: { + /** + * 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; + }; + }; + /** + * Destination token information + */ + destinationToken: { + /** + * 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; + }; + }; + /** + * Array of transactions for this step */ - iconUri?: string; + transactions: Array<{ + /** + * Blockchain network identifier + */ + chainId: number; + /** + * Transaction recipient address + */ + to: string; + /** + * Transaction data payload + */ + data: string; + /** + * Type of action this transaction performs + */ + action: "approval" | "transfer" | "buy" | "sell" | "fee"; + /** + * Transaction sender address + */ + from?: string; + /** + * Spender address for approval transactions + */ + spender?: string; + /** + * Transaction value in wei + */ + value?: string; + }>; /** - * 24h market capitalization in USD when available + * Origin amount in wei */ - marketCapUsd?: number; + originAmount: string; /** - * 24h trading volume in USD when available + * Destination amount in wei */ - volume24hUsd?: number; + destinationAmount: string; /** - * Token price quotes keyed by fiat currency code + * Estimated execution time in milliseconds */ - prices?: { - [key: string]: number; - }; - }; - }>; - /** - * Pagination details for the returned routes. - */ - pagination: { - /** - * Whether there are more items available - */ - hasMore?: boolean; - /** - * Number of items per page - */ - limit?: number; - /** - * Current page number - */ - page?: number; + estimatedExecutionTimeMs?: number; + }>; /** - * Total number of items available + * Quote timestamp */ - totalCount?: number; + timestamp: number; }; }; }; + /** + * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. + */ + 500: unknown; }; -export type GetBridgeSupportedRoutesResponse = - GetBridgeSupportedRoutesResponses[keyof GetBridgeSupportedRoutesResponses]; +export type BridgeSwapError = BridgeSwapErrors[keyof BridgeSwapErrors]; -export type ConvertFiatToCryptoData = { - body?: never; - path?: never; - query: { +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 BridgeCreatePaymentData = { + /** + * 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 fiat currency symbol + * The name of the product */ - from: - | "USD" - | "EUR" - | "GBP" - | "JPY" - | "KRW" - | "CNY" - | "INR" - | "NOK" - | "SEK" - | "CHF" - | "AUD" - | "CAD" - | "NZD" - | "MXN" - | "BRL" - | "CLP" - | "CZK" - | "DKK" - | "HKD" - | "HUF" - | "IDR" - | "ILS" - | "ISK"; + name: string; /** - * The amount of fiat currency to convert + * The description of the product */ - fromAmount: string; + description: string; /** - * The blockchain network identifier + * The URL of the product image */ - chainId: number; + imageUrl?: string; /** - * The token address on the specified chain to convert to + * The token to purchase */ - to: 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; }; - url: "/v1/bridge/convert"; + path?: never; + query?: never; + url: "/v1/bridge/payments"; }; -export type ConvertFiatToCryptoErrors = { +export type BridgeCreatePaymentErrors = { /** - * Bad request. Invalid parameters such as invalid amounts, malformed token address, or invalid currency code. + * Invalid request parameters. */ 400: unknown; /** - * Authentication required. Include `x-client-id` header for frontend usage or `x-secret-key` for backend usage. + * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. */ 401: unknown; /** - * Token not found, price data unavailable for the specified token on the given chain, or price data not available for the requested currency. - */ - 404: unknown; - /** - * Too many requests. Rate limit exceeded. - */ - 429: unknown; - /** - * Internal server error. This may occur due to network connectivity issues or external service failures. + * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. */ 500: unknown; }; -export type ConvertFiatToCryptoResponses = { +export type BridgeCreatePaymentResponses = { /** - * Conversion completed successfully. Returns the amount of crypto tokens equivalent to the specified fiat amount. + * Create Payment Response + * Successful payment creation response containing the payment ID and link to purchase the product */ 200: { - /** - * The conversion result - amount of crypto tokens for the fiat amount - */ - result: number; + result: { + /** + * The payment ID + */ + id: string; + /** + * The link to purchase the product + */ + link: string; + }; }; }; -export type ConvertFiatToCryptoResponse = - ConvertFiatToCryptoResponses[keyof ConvertFiatToCryptoResponses]; +export type BridgeCreatePaymentResponse = + BridgeCreatePaymentResponses[keyof BridgeCreatePaymentResponses]; -export type BridgeSwapData = { +export type BridgeGetPaymentHistoryData = { + body?: never; + path: { + id: string; + }; + query?: never; + url: "/v1/bridge/payments/{id}"; +}; + +export type BridgeGetPaymentHistoryErrors = { /** - * 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. + * Bad request */ - 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: { + 400: { + error: string; + }; + /** + * Payment link not found + */ + 404: { + error: string; + }; +}; + +export type BridgeGetPaymentHistoryError = + BridgeGetPaymentHistoryErrors[keyof BridgeGetPaymentHistoryErrors]; + +export type BridgeGetPaymentHistoryResponses = { + /** + * Payment history retrieved successfully + */ + 200: { + /** + * List of payments for the client + */ + data: Array<{ + id: string; + blockNumber?: string; + transactionId?: string; + onrampId?: string; + clientId: string; /** - * The output token address to swap (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). */ - address: string; + sender?: string; /** - * The blockchain network where the token is located + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). */ - chainId: number; + receiver: string; /** - * The amount of the output token to receive in wei. + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). */ - amount?: string; + 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: { /** - * The minimum amount of the output token to receive in wei. + * Total number of payments */ - minAmount?: string; + totalCount: number; }; + }; +}; + +export type BridgeGetPaymentHistoryResponse = + BridgeGetPaymentHistoryResponses[keyof BridgeGetPaymentHistoryResponses]; + +export type BridgePaymentsPurchaseData = { + /** + * Purchase Product Request + * Request to purchase a product. The system will automatically use your wallet balance to purchase the specified product. + */ + body?: { /** - * The wallet address or ENS name that will execute the swap. If omitted, the project wallet will be used if available. + * The wallet address or ENS name that will purchase the product. If omitted, the project wallet will be used if available. */ from?: string; - /** - * The slippage tolerance in basis points. Will be automatically calculated by default. - */ - slippageToleranceBps?: number; }; - path?: never; + path: { + id: string; + }; query?: never; - url: "/v1/bridge/swap"; + url: "/v1/bridge/payments/{id}"; }; -export type BridgeSwapErrors = { +export type BridgePaymentsPurchaseErrors = { /** * Invalid request parameters. */ @@ -6400,24 +7066,25 @@ export type BridgeSwapErrors = { 500: unknown; }; -export type BridgeSwapError = BridgeSwapErrors[keyof BridgeSwapErrors]; +export type BridgePaymentsPurchaseError = + BridgePaymentsPurchaseErrors[keyof BridgePaymentsPurchaseErrors]; -export type BridgeSwapResponses = { +export type BridgePaymentsPurchaseResponses = { /** - * Swap Token Response - * Successful token swap response containing executed transaction ID + * Product purchased successfully. Returns the transaction used for the purchase. */ 200: { result: { /** - * Payment transaction ID that was executed + * Transaction ID that was executed for your product purchase */ transactionId: string; }; }; }; -export type BridgeSwapResponse = BridgeSwapResponses[keyof BridgeSwapResponses]; +export type BridgePaymentsPurchaseResponse = + BridgePaymentsPurchaseResponses[keyof BridgePaymentsPurchaseResponses]; export type ListSolanaWalletsData = { body?: never; @@ -6463,7 +7130,7 @@ export type ListSolanaWalletsResponses = { /** * Optional label associated with the wallet. */ - label?: string; + label?: string | null; /** * ISO 8601 timestamp indicating when the wallet was created. */ @@ -6539,7 +7206,7 @@ export type CreateSolanaWalletResponses = { /** * Optional label associated with the wallet. */ - label?: string; + label?: string | null; /** * ISO 8601 timestamp indicating when the wallet was created. */ @@ -6565,7 +7232,7 @@ export type CreateSolanaWalletResponses = { /** * Optional label associated with the wallet. */ - label?: string; + label?: string | null; /** * ISO 8601 timestamp indicating when the wallet was created. */ @@ -6593,108 +7260,278 @@ export type GetSolanaWalletBalanceData = { /** * Solana network to query. Choose either solana:mainnet or solana:devnet. */ - chainId: "solana:mainnet" | "solana:devnet"; + chainId: string | number; + /** + * SPL token mint address. Omit to retrieve native SOL balance. + */ + tokenAddress?: string; + }; + url: "/v1/solana/wallets/{address}/balance"; +}; + +export type GetSolanaWalletBalanceErrors = { + /** + * Invalid request parameters. This occurs when the wallet address or token mint is invalid, or the request mixes a token mint with multiple networks. + */ + 400: unknown; + /** + * Authentication required. Include `x-client-id` or `x-secret-key` headers. + */ + 401: unknown; + /** + * Internal server error. This may occur due to RPC connectivity issues or unexpected failures. + */ + 500: unknown; +}; + +export type GetSolanaWalletBalanceResponses = { + /** + * Wallet balance retrieved successfully for the requested Solana network. + */ + 200: { + /** + * Balance data for the requested Solana network. + */ + result: { + /** + * Requested Solana network. + */ + chainId: string | number; + /** + * Number of decimals used by the token. + */ + decimals: number; + /** + * Human-readable balance formatted using token decimals. + */ + displayValue: string; + /** + * Raw balance value expressed in base units (lamports). + */ + value: string; + }; + }; +}; + +export type GetSolanaWalletBalanceResponse = + GetSolanaWalletBalanceResponses[keyof GetSolanaWalletBalanceResponses]; + +export type SignSolanaMessageData = { + /** + * Request payload for signing an arbitrary Solana message. + */ + body?: { + /** + * The Solana wallet address used for signing. + */ + from: string; + /** + * Message to sign. Can be plain text or hexadecimal format (starting with 0x). The format is automatically detected. + */ + message: string; + }; + path?: never; + query?: never; + url: "/v1/solana/sign-message"; +}; + +export type SignSolanaMessageErrors = { + /** + * Authentication required. Include x-secret-key or Authorization headers. + */ + 401: unknown; + /** + * Internal server error occurred while signing the message. + */ + 500: unknown; +}; + +export type SignSolanaMessageResponses = { + /** + * Message signed successfully. Returns the base58 signature. + */ + 200: { + result: { + /** + * Base58 encoded signature returned from the signer. + */ + signature: string; + }; + }; +}; + +export type SignSolanaMessageResponse = + SignSolanaMessageResponses[keyof SignSolanaMessageResponses]; + +export type SignSolanaTransactionData = { + /** + * Request payload for signing a Solana transaction. Provide a serialized transaction or a set of instructions to be assembled server-side. + */ + body?: { + /** + * The Solana wallet address that will sign the transaction. + */ + from: string; + /** + * Solana network the transaction targets. Use solana:mainnet or solana:devnet. + */ + chainId: string | number; + /** + * Base64 encoded Solana transaction to sign. + */ + transaction?: string; + /** + * Instructions that will be assembled into a transaction before signing. + */ + instructions?: Array<{ + /** + * Program address to invoke for this instruction. + */ + programId: string; + /** + * Ordered list of accounts consumed by the instruction. + */ + accounts: Array<{ + /** + * Public key for the account. + */ + address: string; + /** + * Whether this account must sign the transaction. + */ + isSigner: boolean; + /** + * Whether this account can be modified by the instruction. + */ + isWritable: boolean; + }>; + /** + * Instruction data encoded using the provided encoding. + */ + data: string; + /** + * Encoding used for the instruction data payload. + */ + encoding?: "hex" | "base64"; + }>; + /** + * Priority fee configuration applied via the compute budget program. + */ + priorityFee?: + | { + type: "auto"; + } + | { + type: "manual"; + /** + * Explicit micro-lamports per compute unit for priority fees. + */ + microLamportsPerUnit: number | null; + } + | { + type: "percentile"; + /** + * Percentile to pull from recent priority fee estimates (0-100). + */ + percentile: number | null; + } + | null; /** - * SPL token mint address. Omit to retrieve native SOL balance. + * Override the compute unit limit for the transaction via the compute budget program. */ - tokenAddress?: string; + computeUnitLimit?: number | null; }; - url: "/v1/solana/wallets/{address}/balance"; + path?: never; + query?: never; + url: "/v1/solana/sign-transaction"; }; -export type GetSolanaWalletBalanceErrors = { - /** - * Invalid request parameters. This occurs when the wallet address or token mint is invalid, or the request mixes a token mint with multiple networks. - */ - 400: unknown; +export type SignSolanaTransactionErrors = { /** - * Authentication required. Include `x-client-id` or `x-secret-key` headers. + * Authentication required. Include x-secret-key or Authorization headers. */ 401: unknown; /** - * Internal server error. This may occur due to RPC connectivity issues or unexpected failures. + * Internal server error occurred while signing the transaction. */ 500: unknown; }; -export type GetSolanaWalletBalanceResponses = { +export type SignSolanaTransactionResponses = { /** - * Wallet balance retrieved successfully for the requested Solana network. + * Transaction signed successfully. Returns the signature and the fully signed transaction payload. */ 200: { - /** - * Balance data for the requested Solana network. - */ result: { /** - * Requested Solana network. - */ - chainId: "solana:mainnet" | "solana:devnet"; - /** - * Number of decimals used by the token. - */ - decimals: number; - /** - * Human-readable balance formatted using token decimals. + * Base58 encoded signature for the provided transaction. */ - displayValue: string; + signature: string; /** - * Raw balance value expressed in base units (lamports). + * Base64 encoded signed transaction that can be broadcast to the Solana network. */ - value: string; + signedTransaction: string; }; }; }; -export type GetSolanaWalletBalanceResponse = - GetSolanaWalletBalanceResponses[keyof GetSolanaWalletBalanceResponses]; +export type SignSolanaTransactionResponse = + SignSolanaTransactionResponses[keyof SignSolanaTransactionResponses]; -export type SignSolanaMessageData = { +export type BroadcastSolanaTransactionData = { /** - * Request payload for signing an arbitrary Solana message. + * Request payload for broadcasting a signed Solana transaction. Use the signedTransaction output from /v1/solana/sign-transaction. */ body?: { /** - * The Solana wallet address used for signing. + * Solana network the signed transaction targets. Use solana:mainnet or solana:devnet. */ - from: string; + chainId: string | number; /** - * Message to sign. Can be plain text or hexadecimal format (starting with 0x). The format is automatically detected. + * Base64 encoded signed transaction to broadcast to the Solana network. */ - message: string; + signedTransaction: string; }; path?: never; query?: never; - url: "/v1/solana/sign-message"; + url: "/v1/solana/broadcast-transaction"; }; -export type SignSolanaMessageErrors = { +export type BroadcastSolanaTransactionErrors = { + /** + * Transaction failed on-chain. Response includes detailed error information with the transaction signature, error type, and instruction index (if applicable). Common errors include InsufficientFunds, InstructionError (program execution failure), InvalidAccountData, etc. + */ + 400: unknown; /** * Authentication required. Include x-secret-key or Authorization headers. */ 401: unknown; /** - * Internal server error occurred while signing the message. + * Internal server error occurred while broadcasting or polling the transaction. */ 500: unknown; + /** + * Transaction was not confirmed within the 30 second timeout period. The transaction may still be pending or dropped. + */ + 504: unknown; }; -export type SignSolanaMessageResponses = { +export type BroadcastSolanaTransactionResponses = { /** - * Message signed successfully. Returns the base58 signature. + * Transaction broadcast and confirmed successfully. Returns the transaction signature (equivalent to EVM transaction hash). */ 200: { result: { /** - * Base58 encoded signature returned from the signer. + * Transaction signature returned by the Solana network. */ signature: string; }; }; }; -export type SignSolanaMessageResponse = - SignSolanaMessageResponses[keyof SignSolanaMessageResponses]; +export type BroadcastSolanaTransactionResponse = + BroadcastSolanaTransactionResponses[keyof BroadcastSolanaTransactionResponses]; export type SendSolanaTokensData = { /** @@ -6714,9 +7551,9 @@ export type SendSolanaTokensData = { */ amount: string; /** - * Solana network identifier. Use solana:devnet for testing and solana:mainnet for production. + * Solana network identifier in CAIP-2 format. Use "solana:mainnet" or "solana:devnet" for convenience, or full CAIP-2 format. */ - chainId: "solana:mainnet" | "solana:devnet"; + chainId: string | number; /** * Optional SPL token mint address. When omitted a native SOL transfer is performed. */ @@ -6776,13 +7613,13 @@ export type SendSolanaTransactionData = { */ from: string; /** - * Solana network identifier. Use solana:devnet for testing and solana:mainnet for production. + * Solana network identifier in CAIP-2 format. Use "solana:mainnet" or "solana:devnet" for convenience, or full CAIP-2 format. */ - chainId: "solana:mainnet" | "solana:devnet"; + chainId: string | number; /** * Set of instructions executed sequentially in a single transaction. */ - transactions: Array<{ + instructions: Array<{ /** * Program address to invoke for this instruction. */ @@ -6813,6 +7650,31 @@ export type SendSolanaTransactionData = { */ encoding?: "hex" | "base64"; }>; + /** + * Priority fee configuration applied via the compute budget program. + */ + priorityFee?: + | { + type: "auto"; + } + | { + type: "manual"; + /** + * Explicit micro-lamports per compute unit for priority fees. + */ + microLamportsPerUnit: number | null; + } + | { + type: "percentile"; + /** + * Percentile to pull from recent priority fee estimates (0-100). + */ + percentile: number | null; + }; + /** + * Override the compute unit limit via the compute budget program. + */ + computeUnitLimit?: number | null; }; path?: never; query?: never; @@ -6858,6 +7720,183 @@ export type SendSolanaTransactionResponses = { export type SendSolanaTransactionResponse = SendSolanaTransactionResponses[keyof SendSolanaTransactionResponses]; +export type GetSwapQuoteData = { + body?: never; + path?: never; + query: { + /** + * Solana wallet address that will execute the swap. + */ + address: string; + /** + * Input token mint address (the token being sold). + */ + tokenIn: string; + /** + * Output token mint address (the token being purchased). + */ + tokenOut: string; + /** + * Amount of input token to swap, expressed in the smallest unit (e.g., lamports for SOL). + */ + amount: string; + chainId: string | number; + }; + url: "/v1/solana/swap"; +}; + +export type GetSwapQuoteErrors = { + /** + * Invalid request parameters or quote API error. Check the error message for details. + */ + 400: unknown; + /** + * Authentication required. Include x-secret-key or Authorization headers. + */ + 401: unknown; + /** + * Internal server error occurred while fetching the quote. + */ + 500: unknown; +}; + +export type GetSwapQuoteResponses = { + /** + * Response containing the swap quote details. + */ + 200: { + result: { + /** + * Input token mint address. + */ + inputMint: string; + /** + * Output token mint address. + */ + outputMint: string; + /** + * Amount of input token to swap. + */ + inputAmount: string; + /** + * Expected amount of output token to receive. + */ + outputAmount: string; + /** + * USD value of the input amount. + */ + inputUsdValue?: number; + /** + * USD value of the output amount. + */ + outputUsdValue?: number; + /** + * Slippage tolerance in basis points (1 bps = 0.01%). + */ + slippageBps: number; + /** + * Quote request ID for executing the swap. + */ + requestId: string; + }; + }; +}; + +export type GetSwapQuoteResponse = + GetSwapQuoteResponses[keyof GetSwapQuoteResponses]; + +export type SwapSolanaTokensData = { + /** + * Request payload for executing a token swap on Solana. The endpoint handles swap routing, transaction signing, execution, and confirmation polling. + */ + body?: { + /** + * Solana wallet address that will execute the swap. + */ + address: string; + /** + * Input token mint address (the token being sold). + */ + tokenIn: string; + /** + * Output token mint address (the token being purchased). + */ + tokenOut: string; + /** + * Amount of input token to swap, expressed in the smallest unit (e.g., lamports for SOL). + */ + amount: string; + chainId: string | number; + }; + path?: never; + query?: never; + url: "/v1/solana/swap"; +}; + +export type SwapSolanaTokensErrors = { + /** + * Invalid request parameters, swap API error, or transaction failed on-chain. Check the error message for details. + */ + 400: unknown; + /** + * Authentication required. Include x-secret-key or Authorization headers. + */ + 401: unknown; + /** + * Internal server error occurred during swap execution or confirmation. + */ + 500: unknown; + /** + * Transaction was not confirmed within the 30 second timeout period. The swap may still be pending or dropped. + */ + 504: unknown; +}; + +export type SwapSolanaTokensResponses = { + /** + * Response containing the confirmed swap transaction signature and swap details. + */ + 200: { + result: { + /** + * Transaction signature for the confirmed swap on the Solana network. + */ + signature: string; + /** + * Input token mint address. + */ + inputMint: string; + /** + * Output token mint address. + */ + outputMint: string; + /** + * Amount of input token swapped. + */ + inputAmount: string; + /** + * Amount of output token received. + */ + outputAmount: string; + /** + * USD value of the input amount. + */ + inputUsdValue?: number; + /** + * USD value of the output amount. + */ + outputUsdValue?: number; + /** + * Request ID for this swap. + */ + requestId: string; + }; + }; +}; + +export type SwapSolanaTokensResponse = + SwapSolanaTokensResponses[keyof SwapSolanaTokensResponses]; + export type GetSolanaTransactionData = { body?: never; path: { @@ -6899,9 +7938,9 @@ export type GetSolanaTransactionResponses = { */ id: string; /** - * Solana network identifier. Use solana:devnet for testing and solana:mainnet for production. + * Solana network identifier in CAIP-2 format. Use "solana:mainnet" or "solana:devnet" for convenience, or full CAIP-2 format. */ - chainId: "solana:mainnet" | "solana:devnet"; + chainId: string | number; /** * Signer address used on submission. */ @@ -6909,7 +7948,7 @@ export type GetSolanaTransactionResponses = { /** * Signature recorded on-chain once available. */ - signature?: string; + signature?: string | null; /** * Current status of the transaction in the processing pipeline. */ @@ -6917,15 +7956,15 @@ export type GetSolanaTransactionResponses = { /** * Timestamp when the transaction reached the reported status. */ - confirmedAt?: string; + confirmedAt?: string | null; /** * Slot where the transaction was confirmed, if available. */ - confirmedAtSlot?: string; + confirmedAtSlot?: string | null; /** * Unix timestamp of the processed block. */ - blockTime?: number; + blockTime?: number | null; /** * ISO 8601 timestamp when the transaction was queued. */ @@ -6933,7 +7972,7 @@ export type GetSolanaTransactionResponses = { /** * Error message if the transaction failed. */ - errorMessage?: string; + errorMessage?: string | null; /** * Resolved execution parameters used for the transaction. */ @@ -6951,7 +7990,7 @@ export type GetSolanaTransactionResponses = { */ clientId: string; enrichedData?: unknown; - cancelledAt?: string; + cancelledAt?: string | null; }; }; }; @@ -6959,6 +7998,89 @@ export type GetSolanaTransactionResponses = { export type GetSolanaTransactionResponse = GetSolanaTransactionResponses[keyof GetSolanaTransactionResponses]; +export type DeploySolanaTokenData = { + /** + * Request payload for deploying a new SPL token or Token-2022 token on Solana. + */ + body?: { + /** + * Solana wallet address that will pay for the deployment and serve as the mint authority. + */ + from: string; + /** + * Solana network for deployment. Use solana:mainnet or solana:devnet. + */ + chainId: string | number; + /** + * Token name (max 32 characters). Stored in on-chain metadata. + */ + name: string; + /** + * Token symbol (max 10 characters). Stored in on-chain metadata. + */ + symbol: string; + /** + * Number of decimal places for the token. Standard is 9 for SOL-like tokens, 6 for USDC-like. + */ + decimals?: number; + /** + * Initial token supply to mint, expressed in the smallest unit (base units). For example, for a token with 9 decimals, '1000000000' would be 1 token. + */ + initialSupply?: string; + /** + * Address authorized to mint new tokens. Defaults to the 'from' address if not specified. + */ + mintAuthority?: string; + /** + * Address authorized to freeze token accounts. Omit to disable freeze functionality. + */ + freezeAuthority?: string; + /** + * Token program to use for deployment. Use 'spl-token' for standard SPL tokens or 'token-2022' for Token Extensions program. + */ + tokenProgram?: "spl-token" | "token-2022"; + }; + path?: never; + query?: never; + url: "/v1/solana/deploy"; +}; + +export type DeploySolanaTokenErrors = { + /** + * Invalid request parameters. + */ + 400: unknown; + /** + * Authentication required. Include x-secret-key or Authorization headers. + */ + 401: unknown; + /** + * Internal server error occurred while processing the deployment. + */ + 500: unknown; +}; + +export type DeploySolanaTokenResponses = { + /** + * Response containing the transaction ID and deployed token mint address. + */ + 200: { + result: { + /** + * Idempotency key assigned to the queued deployment transaction. + */ + transactionId: string; + /** + * The address of the newly deployed token mint. + */ + mintAddress: string; + }; + }; +}; + +export type DeploySolanaTokenResponse = + DeploySolanaTokenResponses[keyof DeploySolanaTokenResponses]; + export type ChatData = { /** * Chat Request @@ -6975,8 +8097,8 @@ export type ChatData = { | Array< | { type: "image"; - image_url?: string; - b64?: string; + image_url?: string | null; + b64?: string | null; } | { type: "text"; @@ -6994,21 +8116,21 @@ export type ChatData = { */ context?: { /** - * Optional wallet address that will execute transactions + * Optional wallet address to answer questions about */ - from?: string; + from?: string | null; /** * Optional chain IDs for context */ - chain_ids?: Array; + chain_ids?: Array | null; /** - * Optional session ID for conversation continuity. If not provided, a new session will be created + * Optional network filter for context */ - session_id?: string; + networks?: "all" | "mainnet" | "testnet"; /** - * Whether to automatically execute transactions. If not provided, the default is false + * Optional session ID for conversation continuity. If not provided, a new session will be created */ - auto_execute_transactions?: boolean; + session_id?: string | null; }; /** * Enable server streaming of the AI response @@ -7038,7 +8160,7 @@ export type ChatResponses = { type: "sign_transaction"; data: { chain_id: number; - function?: string; + function?: string | null; to: string; value: string; data: string; @@ -7052,12 +8174,12 @@ export type ChatResponses = { data: { transaction: { chain_id: number; - function?: string; + function?: string | null; to: string; value: string; data: string; }; - action: string; + action: string | null; intent: { origin_chain_id: number; origin_token_address: string; @@ -7074,7 +8196,7 @@ export type ChatResponses = { amount: string; symbol: string; decimals: number; - price: number; + price: number | null; }; to_token: { address: string; @@ -7082,7 +8204,7 @@ export type ChatResponses = { amount: string; symbol: string; decimals: number; - price: number; + price: number | null; }; }; } @@ -7103,41 +8225,6 @@ export type ChatResponses = { export type ChatResponse = ChatResponses[keyof ChatResponses]; -export type McpServerData = { - body?: unknown; - path?: never; - query?: { - /** - * Comma-separated list of tools to request. Maps to the operationId of the OpenAPI endpoint. Example: ?tools=getWalletBalance,fetchWithPayment. If not provided, all tools will be returned. - */ - tools?: string; - }; - 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" | (string & {}); };