Skip to content

Types

Glossary of Types in APIs.

APIError

type APIError = {
  code: string; // The Error code
  error: string; // The Error long message
  message: string; // The Error short message
};

BuildPayTransactionParams

type BuildPayTransactionParams = {
  address: Address; // The address of the wallet paying
  chainId: number; // The Chain ID of the payment Network (only Base is supported)
  chargeId: string; // The ID of the Commerce Charge to be paid
};

BuildPayTransactionResponse

type BuildPayTransactionResponse = PayTransaction | APIError;

BuildSwapTransaction

type BuildSwapTransaction = {
  approveTransaction?: Transaction; // ERC20 approve transaction which allows token holders to authorize spending
  fee: Fee; // The fee for the swap
  quote: SwapQuote; // The quote for the swap
  transaction: Transaction; // The object developers should pass into Wagmi's signTransaction
  warning?: QuoteWarning; // The warning associated with the swap
};

BuildSwapTransactionParams

type BuildSwapTransactionParams = GetSwapQuoteParams & {
  fromAddress: Address; // The address of the user
};

BuildSwapTransactionResponse

type BuildSwapTransactionResponse = BuildSwapTransaction | APIError;

GetSwapQuoteParams

type GetSwapQuoteParams = {
  amount: string; // The amount to be swapped
  amountReference?: string; // The reference amount for the swap
  from: Token; // The source token for the swap
  isAmountInDecimals?: boolean; // Whether the amount is in decimals
  maxSlippage?: string; // The slippage of the swap
  to: Token; // The destination token for the swap
  useAggregator: boolean; // Whether to use a DEX aggregator
};

GetSwapQuoteResponse

type GetSwapQuoteResponse = SwapQuote | APIError;

GetTokensOptions

type GetTokensOptions = {
  limit?: string; // The maximum number of tokens to return (default: 50)
  page?: string; // The page number to return (default: 1)
  search?: string; // A string to search for in the token name, symbol or address
};

GetTokensResponse

type GetTokensResponse = Token[] | APIError;