0xtrails. No provider wrapper is required.
Quotes
useQuote
Returns a real-time quote for a cross-chain transfer or swap. Pass human-readable decimal amounts; the hook converts to raw amounts using token decimals.useTrailsSendTransaction
Creates a button-driven transaction flow that opens the SDK modal. Accepts mostuseQuote parameters.
Tokens and balances
useTokenBalances
Returns token balances for an address, sorted by USD value, with price enrichment.symbol, name, decimals, contractAddress, chainId, balance, balanceFormatted, balanceDisplay, balanceUsd, and priceUsd.
useTokenList
Returns all tokens supported across all chains.useSupportedTokens
Filters the token list by chain.useTokenInfo
Returns ERC-20 metadata for a specific token.useAccountTotalBalanceUsd
Returns the aggregate USD value across all tokens for an address.useHasSufficientBalanceToken
Checks whether an address holds enough of a specific token.useHasSufficientBalanceUsd
Checks whether the total USD balance meets a threshold.Chains
useSupportedChains
Returns all supported chains.getChainInfo
Returns metadata for a specific chain by ID.Intent state
useGetIntent
Fetches the current state of an intent by ID. Use this to display status in a custom UI.useIntentRecover
Recovers funds from a stuck intent. Provides a singlerecover() call plus manual control.
useIntentRecoverWithAddress
For custodial or non-custodial wallet scenarios where you handle signing externally. Returns EIP-712 data viagetDataToSign().
Earn markets
useEarnMarkets
Returns lending and vault markets, filterable by chain, provider, type, and sorted by various criteria.useEarnProviders
Returns all supported earn providers.useEarnBalances
Returns current positions in earn markets for a wallet address.Transaction history
useAccountTransactionHistory
Returns the transaction history for an address.useIntentTransactionHistory
Returns history filtered to intent-related transactions.Error handling
Error detection utilities
| Utility | Returns true when |
|---|---|
getIsUserRejectionError | User rejected the transaction |
getIsBalanceTooLowError | Insufficient token balance |
getIsApiError | API returned an error |
getIsRateLimitedError | Rate limit hit |
getIsNoAvailableQuoteError | No route found |
getIsInsufficientLiquidityError | Insufficient liquidity on the route |
getPrettifiedErrorMessage
Converts any SDK error into a user-facing string.Utilities
| Export | Description |
|---|---|
dynamic() | Placeholder for amounts resolved at execution time, used in to.calldata args or composable actions. See Dynamic values |
self() | Placeholder for the intent wallet address at execution time |
getERC20TransferData({ recipient, amount }) | Encodes an ERC-20 transfer as calldata |
getTrailsClient(config) | Initializes the underlying API client outside React |
SDK_VERSION | Current SDK version string |