Import
Usage
Return Type: UseQueryResult<SwapPricesWithCurrencyInfo[]>
The hook returns all properties from React Query’s UseQueryResult with swap prices data. Here’s the detailed structure:
Properties
data
SwapPricesWithCurrencyInfo[] | undefined
Array of swap price objects containing:
price (SwapPrice)
currencyAddress: Address of the currencycurrencyBalance: Balance of the currencyprice: The swap pricemaxPrice: The maximum price for the swaptransactionValue: The value of the transaction
info (ContractInfo)
chainId: Chain ID where the token existsaddress: Token contract addresssource: Source of the token informationname: Token nametype: Token typesymbol: Token symboldecimals: Token decimalslogoURI: Token logo URLdeployed: Whether the token is deployedbytecodeHash: Hash of the token’s bytecodeextensions: Additional token metadataupdatedAt: Last update timestampnotFound: Whether token was not foundqueuedAt: When token was queued for updatestatus: Token resource status
balance (Balance)
balance: User’s balance of the currency in base units
isLoading
boolean
Loading state for the data fetch.
isError
boolean
Error state indicating if the query failed.
error
Error | null
Any error that occurred during data fetching.
Parameters
The hook accepts two parameters:args: UseGetSwapPricesArgs
| Parameter | Type | Description |
|---|---|---|
userAddress | string | The address of the user’s wallet |
buyCurrencyAddress | string | The address of the currency to buy |
buyAmount | string | The amount of currency to buy (in base units) |
chainId | number | The chain ID where the swap will occur |
withContractInfo | boolean | (Optional) Whether to fetch additional contract info for each currency |
options: HooksOptions
| Parameter | Type | Description |
|---|---|---|
disabled | boolean | (Optional) Disable the query from automatically running |
retry | boolean | (Optional) Whether to retry failed queries |