diff --git a/.changeset/sharp-bats-pump.md b/.changeset/sharp-bats-pump.md new file mode 100644 index 00000000000..ecca3c8ccb9 --- /dev/null +++ b/.changeset/sharp-bats-pump.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Resolve TokenIcon automatically when available diff --git a/.changeset/shy-pillows-turn.md b/.changeset/shy-pillows-turn.md new file mode 100644 index 00000000000..4b2be106921 --- /dev/null +++ b/.changeset/shy-pillows-turn.md @@ -0,0 +1,5 @@ +--- +"@thirdweb-dev/api": minor +--- + +Update to latest API diff --git a/apps/playground-web/src/components/headless-ui/token-examples.tsx b/apps/playground-web/src/components/headless-ui/token-examples.tsx index f11287ba527..f9bd94f7467 100644 --- a/apps/playground-web/src/components/headless-ui/token-examples.tsx +++ b/apps/playground-web/src/components/headless-ui/token-examples.tsx @@ -48,7 +48,6 @@ function App() { > ) diff --git a/apps/playground-web/src/components/headless-ui/token-previews.tsx b/apps/playground-web/src/components/headless-ui/token-previews.tsx index ccab07976e0..28a9787e4b7 100644 --- a/apps/playground-web/src/components/headless-ui/token-previews.tsx +++ b/apps/playground-web/src/components/headless-ui/token-previews.tsx @@ -31,10 +31,7 @@ export function TokenImageOverridePreview() { chain={ethereum} client={THIRDWEB_CLIENT} > - + ); } diff --git a/packages/api/src/client/sdk.gen.ts b/packages/api/src/client/sdk.gen.ts index ae0575b8502..013925ca486 100644 --- a/packages/api/src/client/sdk.gen.ts +++ b/packages/api/src/client/sdk.gen.ts @@ -15,12 +15,18 @@ import type { CompleteAuthenticationData, CompleteAuthenticationErrors, CompleteAuthenticationResponses, + ConvertFiatToCryptoData, + ConvertFiatToCryptoErrors, + ConvertFiatToCryptoResponses, CreatePaymentData, CreatePaymentErrors, CreatePaymentResponses, CreateServerWalletData, CreateServerWalletErrors, CreateServerWalletResponses, + CreateSolanaWalletData, + CreateSolanaWalletErrors, + CreateSolanaWalletResponses, CreateTokenData, CreateTokenErrors, CreateTokenResponses, @@ -30,6 +36,15 @@ import type { DeployContractData, DeployContractErrors, DeployContractResponses, + FetchWithPaymentData, + FetchWithPaymentErrors, + FetchWithPaymentResponses, + GetBridgeChainsData, + GetBridgeChainsErrors, + GetBridgeChainsResponses, + GetBridgeSupportedRoutesData, + GetBridgeSupportedRoutesErrors, + GetBridgeSupportedRoutesResponses, GetContractEventsData, GetContractEventsErrors, GetContractEventsResponses, @@ -48,6 +63,9 @@ import type { GetPaymentHistoryData, GetPaymentHistoryErrors, GetPaymentHistoryResponses, + GetSolanaTransactionData, + GetSolanaTransactionErrors, + GetSolanaTransactionResponses, GetTokenOwnersData, GetTokenOwnersErrors, GetTokenOwnersResponses, @@ -69,12 +87,21 @@ import type { InitiateAuthenticationData, InitiateAuthenticationErrors, InitiateAuthenticationResponses, + LinkAuthenticationData, + LinkAuthenticationErrors, + LinkAuthenticationResponses, ListContractsData, ListContractsErrors, ListContractsResponses, + ListPayableServicesData, + ListPayableServicesErrors, + ListPayableServicesResponses, ListServerWalletsData, ListServerWalletsErrors, ListServerWalletsResponses, + ListSolanaWalletsData, + ListSolanaWalletsErrors, + ListSolanaWalletsResponses, ListTokensData, ListTokensErrors, ListTokensResponses, @@ -94,20 +121,41 @@ import type { ReadContractData, ReadContractErrors, ReadContractResponses, + SendSolanaTokensData, + SendSolanaTokensErrors, + SendSolanaTokensResponses, + SendSolanaTransactionData, + SendSolanaTransactionErrors, + SendSolanaTransactionResponses, SendTokensData, SendTokensErrors, SendTokensResponses, SendTransactionsData, SendTransactionsErrors, SendTransactionsResponses, + SettleX402PaymentData, + SettleX402PaymentErrors, + SettleX402PaymentResponses, SignMessageData, SignMessageErrors, SignMessageResponses, + SignSolanaMessageData, + SignSolanaMessageErrors, + SignSolanaMessageResponses, SignTypedDataData, SignTypedDataErrors, SignTypedDataResponses, SocialAuthenticationData, SocialAuthenticationErrors, + SupportedX402PaymentsData, + SupportedX402PaymentsErrors, + SupportedX402PaymentsResponses, + UnlinkAuthenticationData, + UnlinkAuthenticationErrors, + UnlinkAuthenticationResponses, + VerifyX402PaymentData, + VerifyX402PaymentErrors, + VerifyX402PaymentResponses, WriteContractData, WriteContractErrors, WriteContractResponses, @@ -137,22 +185,24 @@ export type Options< * **Supported Methods:** * - **SMS** - Send verification code to phone number * - **Email** - Send verification code to email address - * - **OAuth** - ⚠️ **DEPRECATED**: Use `/auth/social` instead for OAuth flows * - **Passkey** - Generate WebAuthn challenge for biometric authentication * - **SIWE** - Generate Sign-In with Ethereum payload * - * **OAuth Migration:** - * The OAuth method in this endpoint is deprecated. Please use the new `/auth/social` endpoint instead: - * - **Old**: `POST /auth/initiate` with `{"method": "oauth", "provider": "google", "redirectUrl": "..."}` - * - **New**: `GET /auth/social?provider=google&redirectUrl=...` - * * **Flow:** * 1. Choose your authentication method * 2. Provide method-specific parameters * 3. Receive challenge data to complete authentication * 4. Use the /complete endpoint to finish the process * - * NOTE: for custom authentication (JWT, auth-payload) and for guest authentication, you can skip this step and use the `/complete` endpoint directly. + * **OAuth:** + * + * The OAuth method uses a dedicated `/auth/social` endpoint instead of this one: + * + * `GET /auth/social?provider=google&redirectUrl=...` + * + * **Custom (JWT, auth-payload) and Guest:** + * + * For custom authentication (JWT, auth-payload) and for guest authentication, you can skip this step and use the `/auth/complete` endpoint directly. * * **Authentication:** Requires `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ @@ -237,6 +287,82 @@ export const completeAuthentication = ( }); }; +/** + * Link Auth + * Link an additional authentication method or external wallet to the currently authenticated user. Provide the authentication token from another completed login (for example, a SIWE wallet or OAuth account) and this endpoint will associate it with the user's existing wallet. + * + * **Usage:** + * 1. Complete an authentication flow using `/auth/complete` to obtain the new authentication token + * 2. Call this endpoint with the token you want to link + * 3. Receive the full list of linked authentication profiles for the wallet + * + * **Authentication:** Requires both client authentication (`x-client-id` or `x-secret-key`) and a wallet access token via `Authorization: Bearer `. + */ +export const linkAuthentication = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + LinkAuthenticationResponses, + LinkAuthenticationErrors, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v1/auth/link", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Unlink Auth + * Disconnect an authentication method or external wallet from the currently authenticated user. Provide the identifiers for the provider you want to remove (for example, an email address or wallet address) and this endpoint will detach it from the user's account. + * + * **Usage:** + * 1. Choose the provider type you want to disconnect (email, phone, siwe, oauth, etc.) + * 2. Supply the provider-specific identifiers in the request body + * 3. Receive the updated list of linked authentication profiles + * + * **Authentication:** Requires both client authentication (`x-client-id` or `x-secret-key`) and a wallet access token via `Authorization: Bearer `. + */ +export const unlinkAuthentication = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + UnlinkAuthenticationResponses, + UnlinkAuthenticationErrors, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v1/auth/unlink", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + /** * Social Auth * Complete OAuth authentication with social providers in a single step. Unlike other auth methods that require separate initiate/complete calls, OAuth is handled entirely through redirects. @@ -507,7 +633,7 @@ export const getWalletTransactions = ( /** * Get Tokens - * Retrieves token balances for a specific wallet address across one or more blockchain networks. This endpoint provides comprehensive token data including ERC-20 tokens with their balances, metadata, and price information. Results can be filtered by chain and paginated to meet specific requirements. + * 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. */ @@ -1058,6 +1184,151 @@ export const paymentsPurchase = ( }); }; +/** + * x402 - Verify payment + * Verify an x402 payment payload against the provided payment requirements. Compatible with any standard x402 middleware. + */ +export const verifyX402Payment = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + VerifyX402PaymentResponses, + VerifyX402PaymentErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/payments/x402/verify", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * x402 - Settle payment + * Settle an x402 payment. Compatible with any standard x402 middleware. + */ +export const settleX402Payment = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + SettleX402PaymentResponses, + SettleX402PaymentErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/payments/x402/settle", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * x402 - Supported payment methods + * List supported x402 payment methods, optionally filtered by token address and chainId. Compatible with any standard x402 middleware. + */ +export const supportedX402Payments = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).get< + SupportedX402PaymentsResponses, + SupportedX402PaymentsErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/payments/x402/supported", + ...options, + }); +}; + +/** + * x402 - 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. + * + * If no 'from' parameter is passed, the default project wallet address will be used. + * + * - Works with any x402 compatible endpoint. + * - Automatically selects a compatible payment method. + * - Signs the appropriate payment payload. + * - Sends the payment to the url. + * - Returns the final result from the url called. + * + * Request body and headers are always passed through to the url called. + * + * **Authentication**: This endpoint requires wallet authentication for the payment. For frontend usage, include `x-client-id` and `Authorization: Bearer ` headers. For backend usage, include `x-secret-key` header. + */ +export const fetchWithPayment = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).post< + FetchWithPaymentResponses, + FetchWithPaymentErrors, + ThrowOnError + >({ + security: [ + { + scheme: "bearer", + type: "http", + }, + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/payments/x402/fetch", + ...options, + headers: { + "Content-Type": "*/*", + ...options.headers, + }, + }); +}; + +/** + * x402 - 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 = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).get< + ListPayableServicesResponses, + ListPayableServicesErrors, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/payments/x402/discovery/resources", + ...options, + }); +}; + /** * List Tokens * Lists or search existing tokens based on the provided filters. Supports querying by chain ID, token address, symbol, and/or name. @@ -1124,7 +1395,13 @@ export const createToken = ( /** * Get Owners - * Retrieves a paginated list of owners for a given ERC-20 token contract on a specific chain. + * Retrieves a paginated list of owners for a given token contract on a specific chain. Supports ERC-20 tokens, ERC-721 NFTs, and ERC-1155 tokens: + * + * - **ERC-20**: No `tokenId` provided - returns token holders with balances + * - **NFT Collection**: No `tokenId` provided - returns all owners of any token in the collection + * - **Specific NFT**: `tokenId` provided - returns owner(s) of that specific token ID + * + * The token standard is automatically detected using ERC165 interface detection when needed. * * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. */ @@ -1147,6 +1424,83 @@ export const getTokenOwners = ( }); }; +/** + * List Supported Chains + * List all blockchain networks available for cross-chain bridging. Each chain includes metadata and native currency details. + * + * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + */ +export const getBridgeChains = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).get< + GetBridgeChainsResponses, + GetBridgeChainsErrors, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/bridge/chains", + ...options, + }); +}; + +/** + * List Supported Routes + * List supported bridge routes with simple pagination and optional chain or token filters. + * + * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + */ +export const getBridgeSupportedRoutes = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).get< + GetBridgeSupportedRoutesResponses, + GetBridgeSupportedRoutesErrors, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/bridge/routes", + ...options, + }); +}; + +/** + * Convert Fiat to Crypto + * Convert fiat currency amount to cryptocurrency token amount. Supports multiple fiat currencies based on available price data for the specific token. Returns the equivalent amount of crypto tokens for the specified fiat amount based on current market prices. If price data is not available for the requested currency, the API will return a 404 error. + * + * **Native Tokens**: To get the price of native tokens (like ETH on Ethereum), use the address `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`. For example, to get the price of ETH on Ethereum Mainnet (chainId: 1), pass `to=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`. + * + * **Authentication**: Pass `x-client-id` header for frontend usage from allowlisted origins or `x-secret-key` for backend usage. + */ +export const convertFiatToCrypto = ( + options: Options, +) => { + return (options.client ?? _heyApiClient).get< + ConvertFiatToCryptoResponses, + ConvertFiatToCryptoErrors, + ThrowOnError + >({ + security: [ + { + name: "x-client-id", + type: "apiKey", + }, + ], + url: "/v1/bridge/convert", + ...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. @@ -1180,6 +1534,172 @@ export const bridgeSwap = ( }); }; +/** + * List Solana Wallets + * List all Solana wallets created for your project. Supports pagination with page and limit parameters. + * + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. The secret key should never be exposed publicly. + */ +export const listSolanaWallets = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).get< + ListSolanaWalletsResponses, + ListSolanaWalletsErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/solana/wallets", + ...options, + }); +}; + +/** + * Create Solana Wallet + * Create a new Solana wallet or return the existing wallet for a given label. Labels must be unique within your project. + * + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. The secret key should never be exposed publicly. + */ +export const createSolanaWallet = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + CreateSolanaWalletResponses, + CreateSolanaWalletErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/solana/wallets", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Sign Solana Message + * Sign an arbitrary message with a Solana wallet. Supports both text and hexadecimal message formats with automatic format detection. + * + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. The secret key should never be exposed publicly. + */ +export const signSolanaMessage = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + SignSolanaMessageResponses, + SignSolanaMessageErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/solana/sign-message", + ...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. + * + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. The secret key should never be exposed publicly. + */ +export const sendSolanaTokens = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + SendSolanaTokensResponses, + SendSolanaTokensErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/solana/send", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Send Solana Transaction + * Submit a Solana transaction composed of one or more instructions. Transactions are queued and processed asynchronously. + * + * **Authentication**: This endpoint requires backend authentication using the x-secret-key header. The secret key should never be exposed publicly. + */ +export const sendSolanaTransaction = ( + options?: Options, +) => { + return (options?.client ?? _heyApiClient).post< + SendSolanaTransactionResponses, + SendSolanaTransactionErrors, + ThrowOnError + >({ + security: [ + { + name: "x-secret-key", + type: "apiKey", + }, + ], + url: "/v1/solana/transactions", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }); +}; + +/** + * Get Solana Transaction + * Retrieve the status and details of a queued Solana transaction using the identifier returned when the transaction was submitted. + * + * **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, + }); +}; + /** * Chat * Thirdweb AI chat completion API (BETA). diff --git a/packages/api/src/client/types.gen.ts b/packages/api/src/client/types.gen.ts index b6112d8deb7..2a68b900335 100644 --- a/packages/api/src/client/types.gen.ts +++ b/packages/api/src/client/types.gen.ts @@ -340,6 +340,473 @@ export type CompleteAuthenticationResponses = { export type CompleteAuthenticationResponse = CompleteAuthenticationResponses[keyof CompleteAuthenticationResponses]; +export type LinkAuthenticationData = { + /** + * Authentication Link Request + * Request body for linking an additional authentication method or external wallet to the currently authenticated user. + */ + body?: { + /** + * Authentication token for the account that should be linked to the currently authenticated wallet. + */ + accountAuthTokenToConnect: string; + }; + path?: never; + query?: never; + url: "/v1/auth/link"; +}; + +export type LinkAuthenticationErrors = { + /** + * Invalid request parameters + */ + 400: unknown; + /** + * Wallet authentication required. Include Authorization: Bearer header. + */ + 401: unknown; + /** + * Rate limit exceeded - Please wait before trying again + */ + 429: unknown; + /** + * Third-party provider did not return any linked accounts after processing the request. + */ + 502: unknown; +}; + +export type LinkAuthenticationResponses = { + /** + * Authentication Link Response + * Response returned after successfully linking an additional authentication provider. The response includes all linked profiles for the user. + */ + 200: { + /** + * AuthenticationProviderDetail + * Authentication provider details with type-based discrimination + */ + linkedAccounts: Array< + | { + email: string; + emailVerified: boolean; + familyName?: string; + givenName?: string; + hd: string; + id: string; + locale: string; + name?: string; + picture: string; + type: "google"; + } + | { + email?: string; + firstName?: string; + id: string; + lastName?: string; + name?: string; + picture?: string; + type: "facebook"; + } + | { + email?: string; + emailVerified: boolean; + id: string; + isPrivateEmail: boolean; + type: "apple"; + } + | { + avatar?: string; + id: string; + name?: string; + type: "github"; + username: string; + } + | { + avatar: string; + email?: string; + emailVerified: boolean; + id: string; + type: "discord"; + username: string; + } + | { + avatar?: string; + id: string; + name: string; + type: "coinbase"; + } + | { + id: string; + name: string; + type: "x"; + username: string; + profileImageUrl?: string; + } + | { + id: string; + displayName: string; + avatarUrl: string; + unionId?: string; + type: "tiktok"; + } + | { + avatar?: string; + id: string; + metadata: { + avatar: { + large?: string; + medium?: string; + small?: string; + }; + personaname?: string; + profileurl?: string; + realname?: string; + }; + type: "steam"; + username?: string; + } + | { + firstName?: string; + id: string; + lastName?: string; + picture?: string; + type: "telegram"; + username?: string; + } + | { + avatar?: string; + description?: string; + email?: string; + id: string; + type: "twitch"; + username: string; + } + | { + avatar?: string; + id: string; + type: "line"; + username?: string; + } + | { + fid: string; + id: string; + type: "farcaster"; + walletAddress?: string; + } + | { + algorithm: string; + credentialId: string; + publicKey: string; + type: "passkey"; + } + | { + email: string; + id: string; + type: "email"; + } + | { + id: string; + pregeneratedIdentifier: string; + type: "pre_generation"; + } + | { + id: string; + phone: string; + type: "phone"; + } + | { + id: string; + type: "siwe"; + walletAddress: string; + } + | { + id: string; + type: "guest"; + } + | { + id: string; + type: "backend"; + } + | { + identifier: string; + type: "server"; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_jwt"; + walletAddress?: string; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_auth_endpoint"; + walletAddress?: string; + } + >; + }; +}; + +export type LinkAuthenticationResponse = + LinkAuthenticationResponses[keyof LinkAuthenticationResponses]; + +export type UnlinkAuthenticationData = { + /** + * Authentication Unlink Request + * Request body for unlinking an authentication provider or wallet from the currently authenticated user. + */ + body?: { + /** + * Authentication provider type to disconnect + */ + type: + | "apple" + | "coinbase" + | "discord" + | "email" + | "facebook" + | "farcaster" + | "github" + | "google" + | "guest" + | "line" + | "passkey" + | "phone" + | "siwe" + | "steam" + | "telegram" + | "twitch" + | "x" + | "tiktok" + | "backend" + | "wallet" + | "custom_auth_endpoint" + | "custom_jwt"; + /** + * Identifiers for the provider profile that should be disconnected + */ + details: { + address?: string; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + walletAddress?: string; + email?: string; + phone?: string; + id?: string; + }; + /** + * If true, allows the account to be deleted when unlinking removes the last authentication method. Defaults to false when omitted. + */ + allowAccountDeletion?: boolean; + }; + path?: never; + query?: never; + url: "/v1/auth/unlink"; +}; + +export type UnlinkAuthenticationErrors = { + /** + * Invalid request parameters + */ + 400: unknown; + /** + * Wallet authentication required. Include Authorization: Bearer header. + */ + 401: unknown; + /** + * Rate limit exceeded - Please wait before trying again + */ + 429: unknown; + /** + * Third-party provider did not return any linked accounts after processing the request. + */ + 502: unknown; +}; + +export type UnlinkAuthenticationResponses = { + /** + * Authentication Link Response + * Response returned after successfully linking an additional authentication provider. The response includes all linked profiles for the user. + */ + 200: { + /** + * AuthenticationProviderDetail + * Authentication provider details with type-based discrimination + */ + linkedAccounts: Array< + | { + email: string; + emailVerified: boolean; + familyName?: string; + givenName?: string; + hd: string; + id: string; + locale: string; + name?: string; + picture: string; + type: "google"; + } + | { + email?: string; + firstName?: string; + id: string; + lastName?: string; + name?: string; + picture?: string; + type: "facebook"; + } + | { + email?: string; + emailVerified: boolean; + id: string; + isPrivateEmail: boolean; + type: "apple"; + } + | { + avatar?: string; + id: string; + name?: string; + type: "github"; + username: string; + } + | { + avatar: string; + email?: string; + emailVerified: boolean; + id: string; + type: "discord"; + username: string; + } + | { + avatar?: string; + id: string; + name: string; + type: "coinbase"; + } + | { + id: string; + name: string; + type: "x"; + username: string; + profileImageUrl?: string; + } + | { + id: string; + displayName: string; + avatarUrl: string; + unionId?: string; + type: "tiktok"; + } + | { + avatar?: string; + id: string; + metadata: { + avatar: { + large?: string; + medium?: string; + small?: string; + }; + personaname?: string; + profileurl?: string; + realname?: string; + }; + type: "steam"; + username?: string; + } + | { + firstName?: string; + id: string; + lastName?: string; + picture?: string; + type: "telegram"; + username?: string; + } + | { + avatar?: string; + description?: string; + email?: string; + id: string; + type: "twitch"; + username: string; + } + | { + avatar?: string; + id: string; + type: "line"; + username?: string; + } + | { + fid: string; + id: string; + type: "farcaster"; + walletAddress?: string; + } + | { + algorithm: string; + credentialId: string; + publicKey: string; + type: "passkey"; + } + | { + email: string; + id: string; + type: "email"; + } + | { + id: string; + pregeneratedIdentifier: string; + type: "pre_generation"; + } + | { + id: string; + phone: string; + type: "phone"; + } + | { + id: string; + type: "siwe"; + walletAddress: string; + } + | { + id: string; + type: "guest"; + } + | { + id: string; + type: "backend"; + } + | { + identifier: string; + type: "server"; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_jwt"; + walletAddress?: string; + } + | { + authProviderId?: string; + email?: string; + id: string; + phone?: string; + type: "custom_auth_endpoint"; + walletAddress?: string; + } + >; + }; +}; + +export type UnlinkAuthenticationResponse = + UnlinkAuthenticationResponses[keyof UnlinkAuthenticationResponses]; + export type SocialAuthenticationData = { body?: never; path?: never; @@ -1581,7 +2048,7 @@ export type GetWalletBalanceErrors = { */ 400: unknown; /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ 401: unknown; /** @@ -1690,7 +2157,7 @@ export type GetWalletTransactionsErrors = { */ 400: unknown; /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ 401: unknown; /** @@ -1871,6 +2338,34 @@ export type GetWalletTokensData = { * The page number for pagination (default: 1, max: 20). */ page?: number; + /** + * Whether to include token metadata (default: true). + */ + metadata?: "true" | "false"; + /** + * Whether to resolve metadata links to fetch additional token information (default: true). + */ + resolveMetadataLinks?: "true" | "false"; + /** + * Whether to include tokens marked as spam (default: false). + */ + includeSpam?: "true" | "false"; + /** + * Whether to include native tokens (e.g., ETH, MATIC) in the results (default: true). + */ + includeNative?: "true" | "false"; + /** + * Field to sort tokens by: 'balance' for token balance, 'token_address' for token address, 'token_price' for token price, 'usd_value' for USD value (default: usd_value). + */ + sortBy?: "balance" | "token_address" | "token_price" | "usd_value"; + /** + * Sort order: 'asc' for ascending, 'desc' for descending (default: desc). + */ + sortOrder?: "asc" | "desc"; + /** + * Whether to include tokens without price data (default: true). + */ + includeWithoutPrice?: "true" | "false"; }; url: "/v1/wallets/{address}/tokens"; }; @@ -1881,7 +2376,7 @@ export type GetWalletTokensErrors = { */ 400: unknown; /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ 401: unknown; /** @@ -1896,7 +2391,7 @@ export type GetWalletTokensErrors = { export type GetWalletTokensResponses = { /** - * Wallet tokens retrieved successfully. Returns token data with metadata including pagination information and chain details. Includes token balances, metadata, and price information when available. + * Wallet tokens retrieved successfully. Returns token data with metadata including pagination information and chain details. Includes token balances, metadata, and price information when available. Results are sorted by the specified criteria (default: USD value descending) and filtered according to the provided parameters. */ 200: { result: { @@ -1976,6 +2471,10 @@ export type GetWalletTokensResponses = { * The total supply of the token */ total_supply?: number; + /** + * The value of the token balance in USD + */ + usd_value?: number; /** * The volume of the token in USD */ @@ -2032,7 +2531,7 @@ export type GetWalletNftsErrors = { */ 400: unknown; /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ 401: unknown; /** @@ -2319,9 +2818,9 @@ export type SendTokensData = { */ body?: { /** - * The wallet address or ENS name that will send the tokens. + * The wallet address or ENS name that will send the tokens. If omitted, the project wallet will be used if available. */ - from: string; + from?: string; /** * The blockchain network identifier where the transfer will be executed. */ @@ -2497,9 +2996,9 @@ export type DeployContractData = { */ chainId: number; /** - * The wallet address or ENS name that will deploy the contract. + * The wallet address or ENS name that will deploy the contract. If omitted, the project wallet will be used if available. */ - from: string; + from?: string; /** * The contract bytecode as a hex string. */ @@ -2607,7 +3106,7 @@ export type ReadContractErrors = { */ 400: unknown; /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ 401: unknown; /** @@ -2672,9 +3171,9 @@ export type WriteContractData = { */ chainId: number; /** - * The wallet address or ENS name that will send the transaction. + * The wallet address or ENS name that will send the transaction. If omitted, the project wallet will be used if available. */ - from: string; + from?: string; }; path?: never; query?: never; @@ -2691,38 +3190,212 @@ export type WriteContractErrors = { */ 401: unknown; /** - * Contract not found. The specified contract address does not exist on the given blockchain network or is not accessible. - */ - 404: unknown; - /** - * Internal server error. This may occur due to blockchain connectivity issues, gas estimation failures, contract execution errors, or unexpected server errors. - */ - 500: unknown; -}; - -export type WriteContractResponses = { - /** - * Contract write operations submitted successfully. Returns transaction IDs for tracking and monitoring. + * Payment Required Response + * Payment required response when user has insufficient funds. Contains a quote for completing the purchase. */ - 200: { + 402: { result: { /** - * Array of unique identifiers for the submitted transactions. Use these to track transaction status. + * Message to display to the user */ - transactionIds: Array; - }; - }; -}; - -export type WriteContractResponse = - WriteContractResponses[keyof WriteContractResponses]; - -export type GetContractTransactionsData = { - body?: never; - path: { - /** - * The blockchain network identifier where the contract is deployed. - */ + 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; + }; + }; + }; + /** + * Contract not found. The specified contract address does not exist on the given blockchain network or is not accessible. + */ + 404: unknown; + /** + * Internal server error. This may occur due to blockchain connectivity issues, gas estimation failures, contract execution errors, or unexpected server errors. + */ + 500: unknown; +}; + +export type WriteContractError = WriteContractErrors[keyof WriteContractErrors]; + +export type WriteContractResponses = { + /** + * Contract write operations submitted successfully. Returns transaction IDs for tracking and monitoring. + */ + 200: { + result: { + /** + * Array of unique identifiers for the submitted transactions. Use these to track transaction status. + */ + transactionIds: Array; + }; + }; +}; + +export type WriteContractResponse = + WriteContractResponses[keyof WriteContractResponses]; + +export type GetContractTransactionsData = { + body?: never; + path: { + /** + * The blockchain network identifier where the contract is deployed. + */ chainId: number; /** * The smart contract address or ENS name. @@ -2784,7 +3457,7 @@ export type GetContractTransactionsErrors = { */ 400: unknown; /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ 401: unknown; /** @@ -3011,7 +3684,7 @@ export type GetContractEventsErrors = { */ 400: unknown; /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ 401: unknown; /** @@ -3328,7 +4001,7 @@ export type GetTransactionByIdErrors = { */ 400: unknown; /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ 401: unknown; /** @@ -3444,7 +4117,7 @@ export type ListTransactionsErrors = { */ 400: unknown; /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. */ 401: unknown; /** @@ -3561,9 +4234,9 @@ export type SendTransactionsData = { */ chainId: number; /** - * The wallet address or ENS name that will send the transaction. + * The wallet address or ENS name that will send the transaction. If omitted, the project wallet will be used if available. */ - from: string; + from?: string; /** * Array of encoded blockchain transactions to execute. All transactions will use the same from address and chainId. */ @@ -3596,12 +4269,187 @@ export type SendTransactionsErrors = { * 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 + */ + 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. This may occur due to blockchain connectivity issues, gas estimation failures, or unexpected server errors. */ 500: unknown; }; +export type SendTransactionsError = + SendTransactionsErrors[keyof SendTransactionsErrors]; + export type SendTransactionsResponses = { /** * Encoded transactions submitted successfully. Returns the transaction IDs for tracking and monitoring. @@ -3677,10 +4525,6 @@ export type CreatePaymentErrors = { * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. */ 401: unknown; - /** - * Payment required. Insufficient wallet balance to complete the purchase. - */ - 402: unknown; /** * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. */ @@ -3816,9 +4660,9 @@ export type PaymentsPurchaseData = { */ body?: { /** - * The wallet address or ENS name that will purchase the product. + * The wallet address or ENS name that will purchase the product. If omitted, the project wallet will be used if available. */ - from: string; + from?: string; }; path: { id: string; @@ -3837,15 +4681,186 @@ export type PaymentsPurchaseErrors = { */ 401: unknown; /** - * Payment required. Insufficient wallet balance to complete the purchase. + * Payment Required Response + * Payment required response when user has insufficient funds. Contains a quote for completing the purchase. */ - 402: unknown; + 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. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. */ 500: unknown; }; +export type PaymentsPurchaseError = + PaymentsPurchaseErrors[keyof PaymentsPurchaseErrors]; + export type PaymentsPurchaseResponses = { /** * Product purchased successfully. Returns the transaction used for the purchase. @@ -3863,39 +4878,1373 @@ export type PaymentsPurchaseResponses = { export type PaymentsPurchaseResponse = PaymentsPurchaseResponses[keyof PaymentsPurchaseResponses]; -export type ListTokensData = { - body?: never; +export type VerifyX402PaymentData = { + /** + * Request body for x402 facilitator 'verify' + */ + body?: { + paymentPayload: { + x402Version: number; + scheme: "exact"; + network: + | "base-sepolia" + | "base" + | "avalanche-fuji" + | "avalanche" + | "iotex" + | "solana-devnet" + | "solana" + | "sei" + | "sei-testnet" + | string; + payload: + | { + signature: string; + authorization: { + from: string; + to: string; + value: string; + validAfter: string; + validBefore: string; + nonce: string; + }; + } + | { + transaction: string; + }; + }; + paymentRequirements: { + scheme: "exact"; + network: + | "base-sepolia" + | "base" + | "avalanche-fuji" + | "avalanche" + | "iotex" + | "solana-devnet" + | "solana" + | "sei" + | "sei-testnet" + | string; + maxAmountRequired: string; + resource: string; + description: string; + mimeType: string; + outputSchema?: { + [key: string]: unknown; + }; + payTo: string; + maxTimeoutSeconds: number; + asset: string; + extra?: { + [key: string]: unknown; + }; + }; + }; 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. + query?: never; + url: "/v1/payments/x402/verify"; +}; + +export type VerifyX402PaymentErrors = { + /** + * Invalid request parameters + */ + 400: unknown; + /** + * Authentication required. For backend usage, include `x-secret-key` header. + */ + 401: unknown; + /** + * Internal server error + */ + 500: unknown; +}; + +export type VerifyX402PaymentResponses = { + /** + * Response returned by x402 facilitator 'verify' + */ + 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_cannot_derive_receiver_ata" + | "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; + }; +}; + +export type VerifyX402PaymentResponse = + VerifyX402PaymentResponses[keyof VerifyX402PaymentResponses]; + +export type SettleX402PaymentData = { + /** + * Request body for x402 facilitator 'settle' + */ + body?: { + paymentPayload: { + x402Version: number; + scheme: "exact"; + network: + | "base-sepolia" + | "base" + | "avalanche-fuji" + | "avalanche" + | "iotex" + | "solana-devnet" + | "solana" + | "sei" + | "sei-testnet" + | string; + payload: + | { + signature: string; + authorization: { + from: string; + to: string; + value: string; + validAfter: string; + validBefore: string; + nonce: string; + }; + } + | { + transaction: string; + }; + }; + paymentRequirements: { + scheme: "exact"; + network: + | "base-sepolia" + | "base" + | "avalanche-fuji" + | "avalanche" + | "iotex" + | "solana-devnet" + | "solana" + | "sei" + | "sei-testnet" + | string; + maxAmountRequired: string; + resource: string; + description: string; + mimeType: string; + outputSchema?: { + [key: string]: unknown; + }; + payTo: string; + maxTimeoutSeconds: number; + asset: string; + extra?: { + [key: string]: unknown; + }; + }; + /** + * 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'. */ - chainId?: number; + waitUntil?: "simulated" | "submitted" | "confirmed"; + }; + path?: never; + query?: never; + url: "/v1/payments/x402/settle"; +}; + +export type SettleX402PaymentErrors = { + /** + * 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_cannot_derive_receiver_ata" + | "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"; + errorMessage?: string; + }; +}; + +export type SettleX402PaymentResponse = + SettleX402PaymentResponses[keyof SettleX402PaymentResponses]; + +export type SupportedX402PaymentsData = { + body?: never; + path?: never; + query?: { /** - * Get a specific token by contract address + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). */ tokenAddress?: string; /** - * Limit tokens to a specific symbol. + * 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: + | "base-sepolia" + | "base" + | "avalanche-fuji" + | "avalanche" + | "iotex" + | "solana-devnet" + | "solana" + | "sei" + | "sei-testnet" + | 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: + | "base-sepolia" + | "base" + | "avalanche-fuji" + | "avalanche" + | "iotex" + | "solana-devnet" + | "solana" + | "sei" + | "sei-testnet" + | 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. + */ + 400: unknown; + /** + * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. + */ + 401: unknown; + /** + * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. + */ + 500: unknown; +}; + +export type ListTokensResponses = { + /** + * Tokens returned successfully. + */ + 200: { + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; + tokens: Array<{ + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + chainId: number; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + address: string; + decimals: number; + symbol: string; + iconUri?: string; + /** + * Token price in different FIAT currencies. + */ + prices: { + [key: string]: number; + }; + }>; + }; +}; + +export type ListTokensResponse = ListTokensResponses[keyof ListTokensResponses]; + +export type CreateTokenData = { + /** + * Request schema for creating a new ERC20 token + */ + body?: { + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + chainId: number; + /** + * Token name + */ + name: string; + /** + * Token symbol + */ + symbol: string; + /** + * Token description + */ + description: string; + /** + * Token image URL + */ + imageUrl: string; + /** + * Wallet address or ENS that will deploy the token. If omitted, the project wallet will be used if available. + */ + from?: string; + /** + * The token owner address, if different from `from`. + */ + owner?: string; + /** + * A salt to deterministically generate the token address. + */ + salt?: string; + /** + * The maximum token supply. + */ + maxSupply?: number; + /** + * Setup this token for a sale. + */ + sale?: { + type?: "pool"; + /** + * The initial token price in wei. This price is in the currency specified by `currency` (or the native token if not specified). + */ + startingPrice: string; + /** + * The number of tokens to allocate to the sale. + */ + amount: number; + /** + * The bps fee on the token pool. + */ + developerFeeBps?: number; + /** + * The address to send the developer fee to. Defaults to the token owner. + */ + developerFeeRecipient?: string; + /** + * The currency to price this token sale in. Defaults to the native token. + */ + currency?: string; + }; + }; + path?: never; + query?: never; + url: "/v1/tokens"; +}; + +export type CreateTokenErrors = { + /** + * Invalid request parameters. + */ + 400: unknown; + /** + * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. + */ + 401: unknown; + /** + * Payment required. Insufficient wallet balance to deploy the contract. + */ + 402: unknown; + /** + * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. + */ + 500: unknown; +}; + +export type CreateTokenResponses = { + /** + * The token is being deployed. Returns the predicted token address. + */ + 202: { + /** + * The in-progress deployment transaction ID. + */ + transactionId: string; + /** + * The address the token was deployed at + */ + address: string; + }; +}; + +export type CreateTokenResponse = + CreateTokenResponses[keyof CreateTokenResponses]; + +export type GetTokenOwnersData = { + body?: never; + path: { + /** + * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + */ + chainId: number; + /** + * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + */ + address: string; + }; + query?: { + /** + * Optional token ID for NFT owners. If provided, returns owners of the specific NFT token. + */ + tokenId?: string; + /** + * Number of owners to return per page (1-100). + */ + limit?: number; + /** + * Page number for pagination, starting from 1. + */ + page?: number; + }; + url: "/v1/tokens/{chainId}/{address}/owners"; +}; + +export type GetTokenOwnersErrors = { + /** + * Invalid request parameters. + */ + 400: unknown; + /** + * Authentication required. The request must include a valid `x-client-id` header for frontend usage or `x-secret-key` for backend usage. + */ + 401: unknown; + /** + * Token not found or no owners available. + */ + 404: unknown; + /** + * Internal server error. + */ + 500: unknown; +}; + +export type GetTokenOwnersResponses = { + /** + * Token owners retrieved successfully. Returns owners with pagination information. For ERC-20 tokens, `amount` represents token balance. For NFTs, `amount` represents quantity owned (usually '1' for ERC-721, can be >1 for ERC-1155). + */ + 200: { + result: { + /** + * Array of token owners with amounts. + */ + owners: Array<{ + /** + * Owner wallet address + */ + address: string; + /** + * Token amount owned as a string + */ + amount: string; + /** + * Token ID for NFTs + */ + tokenId?: string; + }>; + pagination: { + /** + * Whether there are more items available + */ + hasMore?: boolean; + /** + * Number of items per page + */ + limit?: number; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; + }; + }; +}; + +export type GetTokenOwnersResponse = + GetTokenOwnersResponses[keyof GetTokenOwnersResponses]; + +export type GetBridgeChainsData = { + body?: never; + path?: never; + query?: never; + url: "/v1/bridge/chains"; +}; + +export type GetBridgeChainsErrors = { + /** + * 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 chains. + */ + 500: unknown; +}; + +export type GetBridgeChainsResponses = { + /** + * Successfully retrieved supported bridge chains. + */ + 200: { + /** + * Blockchain networks that support cross-chain bridging + */ + result: Array<{ + /** + * The chain ID of the chain + */ + chainId: number; + /** + * The name of the chain + */ + name: string; + /** + * The URL of the chain's icon + */ + icon: string; + /** + * Information about the native currency of the chain + */ + nativeCurrency: { + /** + * The name of the native currency + */ + name: string; + /** + * The symbol of the native currency + */ + symbol: string; + /** + * The number of decimals used by the native currency + */ + decimals: number; + }; + }>; + }; +}; + +export type GetBridgeChainsResponse = + GetBridgeChainsResponses[keyof GetBridgeChainsResponses]; + +export type GetBridgeSupportedRoutesData = { + body?: never; + path?: never; + query?: { + /** + * Maximum number of routes to return (1-100). + */ + limit?: number; + /** + * Page number for pagination, starting at 1. + */ + page?: number; + /** + * 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; + /** + * Current page number + */ + page?: number; + /** + * Total number of items available + */ + totalCount?: number; + }; + }; + }; +}; + +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 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. */ - symbol?: string; + from?: string; /** - * Limit tokens to a specific name. + * The slippage tolerance in basis points. Will be automatically calculated by default. */ - name?: string; + slippageToleranceBps?: number; }; - url: "/v1/tokens"; + path?: never; + query?: never; + url: "/v1/bridge/swap"; }; -export type ListTokensErrors = { +export type BridgeSwapErrors = { /** * Invalid request parameters. */ @@ -3905,348 +6254,673 @@ export type ListTokensErrors = { */ 401: unknown; /** - * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. - */ - 500: unknown; -}; - -export type ListTokensResponses = { - /** - * Tokens returned successfully. + * Payment Required Response + * Payment required response when user has insufficient funds. Contains a quote for completing the purchase. */ - 200: { - pagination: { + 402: { + result: { /** - * Whether there are more items available + * Message to display to the user */ - hasMore?: boolean; + message: string; /** - * Number of items per page + * Link to purchase the product */ - limit?: number; + link: string; /** - * Current page number + * Payment ID */ - page?: number; + id: string; /** - * Total number of items available + * Bridge quote for completing the payment */ - totalCount?: number; + 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; + }; }; - tokens: Array<{ + }; + /** + * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. + */ + 500: unknown; +}; + +export type BridgeSwapError = BridgeSwapErrors[keyof BridgeSwapErrors]; + +export type BridgeSwapResponses = { + /** + * Swap Token Response + * Successful token swap response containing executed transaction ID + */ + 200: { + result: { /** - * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + * Payment transaction ID that was executed */ - chainId: number; + transactionId: string; + }; + }; +}; + +export type BridgeSwapResponse = BridgeSwapResponses[keyof BridgeSwapResponses]; + +export type ListSolanaWalletsData = { + body?: never; + path?: never; + query?: { + /** + * Page number for paginated results. Starts at 1. + */ + page?: number; + /** + * Maximum number of wallets to return per page. + */ + limit?: number; + }; + url: "/v1/solana/wallets"; +}; + +export type ListSolanaWalletsErrors = { + /** + * Authentication required. Include x-secret-key or Authorization headers. + */ + 401: unknown; + /** + * Internal server error occurred while listing wallets. + */ + 500: unknown; +}; + +export type ListSolanaWalletsResponses = { + /** + * Successfully retrieved Solana wallets with pagination metadata. + */ + 200: { + result: { /** - * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + * Array of Solana wallets created for your project. */ - address: string; - decimals: number; - symbol: string; - iconUri?: string; + wallets: Array<{ + /** + * Base58 encoded Solana address. + */ + address: string; + /** + * Optional label associated with the wallet. + */ + label?: string; + /** + * ISO 8601 timestamp indicating when the wallet was created. + */ + createdAt: string; + /** + * ISO 8601 timestamp indicating when the wallet was last updated. + */ + updatedAt: string; + }>; /** - * Token price in different FIAT currencies. + * Pagination details for the wallet list. */ - prices: { - [key: string]: number; + pagination: { + /** + * Total number of wallets available. + */ + totalCount: number; + /** + * Current page number. + */ + page: number; + /** + * Number of wallets returned per page. + */ + limit: number; }; - }>; + }; }; }; -export type ListTokensResponse = ListTokensResponses[keyof ListTokensResponses]; +export type ListSolanaWalletsResponse = + ListSolanaWalletsResponses[keyof ListSolanaWalletsResponses]; -export type CreateTokenData = { +export type CreateSolanaWalletData = { /** - * Request schema for creating a new ERC20 token + * Request payload for creating or fetching a Solana wallet by label. */ body?: { /** - * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). - */ - chainId: number; - /** - * Token name - */ - name: string; - /** - * Token symbol - */ - symbol: string; - /** - * Token description - */ - description: string; - /** - * Token image URL - */ - imageUrl: string; - /** - * Wallet address or ENS that will deploy the token. - */ - from: string; - /** - * The token owner address, if different from `from`. - */ - owner?: string; - /** - * A salt to deterministically generate the token address. - */ - salt?: string; - /** - * The maximum token supply. + * Unique label to identify the wallet. Used for retrieval and management. */ - maxSupply?: number; + label: string; + }; + path?: never; + query?: never; + url: "/v1/solana/wallets"; +}; + +export type CreateSolanaWalletErrors = { + /** + * Authentication required. Include x-secret-key or Authorization headers. + */ + 401: unknown; + /** + * Internal server error occurred while creating wallet. + */ + 500: unknown; +}; + +export type CreateSolanaWalletResponses = { + /** + * Solana wallet retrieved for the provided label. + */ + 200: { /** - * Setup this token for a sale. + * Details for a Solana wallet in your project. */ - sale?: { - type?: "pool"; + result: { /** - * The initial token price in wei. This price is in the currency specified by `currency` (or the native token if not specified). + * Base58 encoded Solana address. */ - startingPrice: string; + address: string; /** - * The number of tokens to allocate to the sale. + * Optional label associated with the wallet. */ - amount: number; + label?: string; /** - * The bps fee on the token pool. + * ISO 8601 timestamp indicating when the wallet was created. */ - developerFeeBps?: number; + createdAt: string; /** - * The address to send the developer fee to. Defaults to the token owner. + * ISO 8601 timestamp indicating when the wallet was last updated. */ - developerFeeRecipient?: string; + updatedAt: string; + }; + }; + /** + * Solana wallet created for the provided label. + */ + 201: { + /** + * Details for a Solana wallet in your project. + */ + result: { + /** + * Base58 encoded Solana address. + */ + address: string; + /** + * Optional label associated with the wallet. + */ + label?: string; + /** + * ISO 8601 timestamp indicating when the wallet was created. + */ + createdAt: string; /** - * The currency to price this token sale in. Defaults to the native token. + * ISO 8601 timestamp indicating when the wallet was last updated. */ - currency?: string; + updatedAt: string; }; }; - path?: never; - query?: never; - url: "/v1/tokens"; }; -export type CreateTokenErrors = { +export type CreateSolanaWalletResponse = + CreateSolanaWalletResponses[keyof CreateSolanaWalletResponses]; + +export type SignSolanaMessageData = { /** - * Invalid request parameters. + * Request payload for signing an arbitrary Solana message. */ - 400: unknown; + 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. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. + * Authentication required. Include x-secret-key or Authorization headers. */ 401: unknown; /** - * Payment required. Insufficient wallet balance to deploy the contract. - */ - 402: unknown; - /** - * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. + * Internal server error occurred while signing the message. */ 500: unknown; }; -export type CreateTokenResponses = { +export type SignSolanaMessageResponses = { /** - * The token is being deployed. Returns the predicted token address. + * Message signed successfully. Returns the base58 signature. */ - 202: { - /** - * The in-progress deployment transaction ID. - */ - transactionId: string; - /** - * The address the token was deployed at - */ - address: string; + 200: { + result: { + /** + * Base58 encoded signature returned from the signer. + */ + signature: string; + }; }; }; -export type CreateTokenResponse = - CreateTokenResponses[keyof CreateTokenResponses]; +export type SignSolanaMessageResponse = + SignSolanaMessageResponses[keyof SignSolanaMessageResponses]; -export type GetTokenOwnersData = { - body?: never; - path: { +export type SendSolanaTokensData = { + /** + * Request payload for transferring SOL or SPL tokens on Solana. + */ + body?: { /** - * The blockchain network identifier. Common values include: 1 (Ethereum), 8453 (Base), 137 (Polygon), 56 (BSC), 43114 (Avalanche), 42161 (Arbitrum), 10 (Optimism). + * Solana wallet address that will sign and submit the transfer. */ - chainId: number; + from: string; /** - * A valid Ethereum address (0x-prefixed hex string) or ENS name (e.g., vitalik.eth). + * Destination Solana address. */ - address: string; - }; - query?: { + to: string; /** - * Number of owners to return per page (1-100). + * Amount to transfer expressed in base units (lamports for SOL or token decimals). */ - limit?: number; + amount: string; /** - * Page number for pagination, starting from 1. + * Solana network identifier. Use solana:devnet for testing and solana:mainnet for production. */ - page?: number; + chainId: "solana:mainnet" | "solana:devnet"; + /** + * Optional SPL token mint address. When omitted a native SOL transfer is performed. + */ + tokenAddress?: string; }; - url: "/v1/tokens/{chainId}/{address}/owners"; + path?: never; + query?: never; + url: "/v1/solana/send"; }; -export type GetTokenOwnersErrors = { - /** - * Invalid request parameters. - */ - 400: unknown; +export type SendSolanaTokensErrors = { /** - * Authentication required. The request must include a valid `x-client-id` header for frontend usage or x-secret-key for backend usage. + * Authentication required. Include x-secret-key or Authorization headers. */ 401: unknown; /** - * Token not found or no owners available. - */ - 404: unknown; - /** - * Internal server error. + * Internal server error occurred while processing the transfer. */ 500: unknown; }; -export type GetTokenOwnersResponses = { +export type SendSolanaTokensResponses = { /** - * Token owners retrieved successfully. Returns owners with pagination information. + * Transfer queued successfully. Returns the transaction identifier for status polling. */ 200: { result: { /** - * Array of token owners with amounts. + * Idempotency key assigned to the queued transaction. */ - owners: Array<{ - /** - * Owner wallet address - */ - address: string; - /** - * Token amount owned as a string - */ - amount: string; - }>; - pagination: { - /** - * Whether there are more items available - */ - hasMore?: boolean; - /** - * Number of items per page - */ - limit?: number; - /** - * Current page number - */ - page?: number; - /** - * Total number of items available - */ - totalCount?: number; - }; + transactionId: string; + }; + }; + /** + * Transfer accepted for asynchronous processing. Returns the transaction identifier for status polling. + */ + 202: { + result: { + /** + * Idempotency key assigned to the queued transaction. + */ + transactionId: string; }; }; }; -export type GetTokenOwnersResponse = - GetTokenOwnersResponses[keyof GetTokenOwnersResponses]; +export type SendSolanaTokensResponse = + SendSolanaTokensResponses[keyof SendSolanaTokensResponses]; -export type BridgeSwapData = { +export type SendSolanaTransactionData = { /** - * 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. + * Submit a Solana transaction made up of one or more instructions. */ body?: { /** - * Whether to swap the exact input or output amount + * Solana wallet address that will sign and submit the transaction. */ - 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; + from: string; + /** + * Solana network identifier. Use solana:devnet for testing and solana:mainnet for production. + */ + chainId: "solana:mainnet" | "solana:devnet"; + /** + * Set of instructions executed sequentially in a single transaction. + */ + transactions: Array<{ /** - * The amount of the input token to swap in wei. + * Program address to invoke for this instruction. */ - amount?: string; + programId: string; /** - * The maximum amount of the input token to swap in wei. + * Ordered list of accounts consumed by the instruction. */ - maxAmount?: string; - }; - tokenOut: { + 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; + }>; /** - * The output token address to swap (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native token) + * Instruction data encoded using the provided encoding. */ - address: string; + data: string; /** - * The blockchain network where the token is located + * Encoding used for the instruction data payload. */ - chainId: number; + encoding?: "hex" | "base64"; + }>; + }; + path?: never; + query?: never; + url: "/v1/solana/transactions"; +}; + +export type SendSolanaTransactionErrors = { + /** + * Authentication required. Include x-secret-key or Authorization headers. + */ + 401: unknown; + /** + * Internal server error occurred while processing the transaction. + */ + 500: unknown; +}; + +export type SendSolanaTransactionResponses = { + /** + * Transaction queued successfully. Returns the transaction identifier for status polling. + */ + 200: { + result: { /** - * The amount of the output token to receive in wei. + * Idempotency key assigned to the queued transaction. */ - amount?: string; + transactionId: string; + }; + }; + /** + * Transaction accepted for asynchronous processing. Returns the transaction identifier for status polling. + */ + 202: { + result: { /** - * The minimum amount of the output token to receive in wei. + * Idempotency key assigned to the queued transaction. */ - minAmount?: string; + transactionId: string; }; + }; +}; + +export type SendSolanaTransactionResponse = + SendSolanaTransactionResponses[keyof SendSolanaTransactionResponses]; + +export type GetSolanaTransactionData = { + body?: never; + path: { /** - * The wallet address or ENS name that will execute the swap. + * Identifier returned when the transaction was queued. */ - from: string; + transactionId: string; }; - path?: never; query?: never; - url: "/v1/bridge/swap"; + url: "/v1/solana/transactions/:transactionId"; }; -export type BridgeSwapErrors = { - /** - * Invalid request parameters. - */ - 400: unknown; +export type GetSolanaTransactionErrors = { /** - * Authentication required. For backend usage, include `x-secret-key` header. For frontend usage, include `x-client-id` + `Authorization: Bearer ` headers. + * Authentication required. Include x-secret-key or Authorization headers. */ 401: unknown; /** - * Payment required. Insufficient wallet balance to complete the purchase. + * Transaction not found. The identifier may be invalid or expired. */ - 402: unknown; + 404: unknown; /** - * Internal server error. This may occur due to network connectivity issues, wallet creation failures, or transaction execution failures. + * Internal server error occurred while fetching transaction status. */ 500: unknown; }; -export type BridgeSwapResponses = { +export type GetSolanaTransactionResponses = { /** - * Swap Token Response - * Successful token swap response containing executed transaction ID + * Transaction status retrieved successfully. */ 200: { + /** + * Transaction metadata and status information. + */ result: { /** - * Payment transaction ID that was executed + * Unique identifier for the transaction. */ - transactionId: string; + id: string; + /** + * Solana network identifier. Use solana:devnet for testing and solana:mainnet for production. + */ + chainId: "solana:mainnet" | "solana:devnet"; + /** + * Signer address used on submission. + */ + from: string; + /** + * Signature recorded on-chain once available. + */ + signature?: string; + /** + * Current status of the transaction in the processing pipeline. + */ + status?: "QUEUED" | "SUBMITTED" | "CONFIRMED" | "FAILED"; + /** + * Timestamp when the transaction reached the reported status. + */ + confirmedAt?: string; + /** + * Slot where the transaction was confirmed, if available. + */ + confirmedAtSlot?: string; + /** + * Unix timestamp of the processed block. + */ + blockTime?: number; + /** + * ISO 8601 timestamp when the transaction was queued. + */ + createdAt: string; + /** + * Error message if the transaction failed. + */ + errorMessage?: string; + /** + * Resolved execution parameters used for the transaction. + */ + executionParams?: unknown; + /** + * Raw execution result payload, if present. + */ + executionResult?: unknown; + /** + * Original instruction payload submitted. + */ + transactionParams?: unknown; + /** + * Project client identifier. + */ + clientId: string; + enrichedData?: unknown; + cancelledAt?: string; }; }; }; -export type BridgeSwapResponse = BridgeSwapResponses[keyof BridgeSwapResponses]; +export type GetSolanaTransactionResponse = + GetSolanaTransactionResponses[keyof GetSolanaTransactionResponses]; export type ChatData = { /** @@ -4395,7 +7069,12 @@ export type ChatResponse = ChatResponses[keyof ChatResponses]; export type McpServerData = { body?: unknown; path?: never; - query?: 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"; }; diff --git a/packages/thirdweb/src/react/web/ui/prebuilt/Token/icon.tsx b/packages/thirdweb/src/react/web/ui/prebuilt/Token/icon.tsx index 82ad22fb890..50f7218d2d2 100644 --- a/packages/thirdweb/src/react/web/ui/prebuilt/Token/icon.tsx +++ b/packages/thirdweb/src/react/web/ui/prebuilt/Token/icon.tsx @@ -6,6 +6,7 @@ import { getChainMetadata } from "../../../../../chains/utils.js"; import { NATIVE_TOKEN_ADDRESS } from "../../../../../constants/addresses.js"; import { getContract } from "../../../../../contract/contract.js"; import { getContractMetadata } from "../../../../../extensions/common/read/getContractMetadata.js"; +import { getToken } from "../../../../../pay/convert/get-token.js"; import { getFunctionId } from "../../../../../utils/function-id.js"; import { resolveScheme } from "../../../../../utils/ipfs.js"; import { useTokenContext } from "./provider.js"; @@ -135,6 +136,14 @@ export function TokenIcon({ return resolveScheme({ client, uri: possibleUrl }); } + const bridgeToken = await getToken(client, address, chain.id).catch( + () => null, + ); + + if (bridgeToken?.iconUri) { + return bridgeToken.iconUri; + } + // Try to get the icon from the contractURI const contractMetadata = await getContractMetadata({ contract: getContract({