Advanced Usage
Using Hooks Independently
useQuote - Generate Payment Quotes
import { useQuote } from '@ordanetwork/sdk/react';
function QuoteExample() {
const { quote, isLoading, error, requestQuote } = useQuote();
const getQuote = async () => {
const result = await requestQuote({
fromChainId: '1', // Ethereum
toChainId: '137', // Polygon
fromTokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
toTokenAddress: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', // USDT
amount: '100', // 100 USDC
fromAddress: '0x...', // User wallet
});
console.log('Quote:', result);
};
return (
<div>
<button onClick={getQuote} disabled={isLoading}>
{isLoading ? 'Loading...' : 'Get Quote'}
</button>
{quote && (
<div>
<p>You will receive: {quote.toAmount} {quote.toToken.symbol}</p>
<p>Fee: {quote.fee}</p>
</div>
)}
</div>
);
}useTransaction - Monitor Transaction Status
useTokenPrices - Fetch USD Prices
useBalances - Fetch Wallet Balances
Accessing the SDK Instance
Using UI Components Separately
OrdaProvider Configuration
AppKit Configuration
Last updated