π€οΈFetch Quote
The Shogun SDK enables anyone to broadcast intents and receive optimal execution routes from a host of different liquidity venues. The SDK allows you to compose the intent lifecycle how you see fit. You can choose to handle the entire lifecycle through the SDK via direct execution or you just request quotes and handle execution yourself.
Requesting the Optimal Execution Route
You can request the best route for a particular intent by calling the fetchQuote
method using the client you intialized.
//Request optimal from WETH on Ethereum Mainnet to Sol on Solana
const quoteParams = {
srcChain: 1, // Ethereum mainnet
destChain: 8453, // Base chain
srcToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
destToken: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', // WBTC
amount: '1000000000000000000', // 1 ETH (in wei)
senderAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
affiliateWallet: '0x123...', // Your affiliate wallet
affiliateFee: '1', // 1% affiliate fee
slippage: 0.5, // 0.5% slippage tolerance
destinationAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
dynamicSlippage: true // Enable dynamic slippage for Solana
};
const quote = await client.fetchQuote(quoteParams);
Available parameters
The following parameters enable you to customize your quote request:
srcChain
Chain of the chain the user is providing from funds from.
Number (required)
destChain
Chain of the chain the user is wants to have their funds received on.
Number (required)
srcToken
Contract address of the token the user is providing for the trade.
String (required)
destToken
Contract address of the token the user is requesting to receive for the trade.
String (required)
amount
Amount of srcToken
the user is providing for the trade.
String (required)
senderAddress
Wallet address initiating the transaction.
String (required)
affiliateWallet
The wallet address that will receive the affiliate fee. Use your own wallet address to earn a portion of the transaction.
String (optional)
affiliateFee
The percentage (as a string) of the transaction to be routed to the affiliate wallet. For example, "1" represents a 1% fee.
String (optional)
slippage
The maximum price slippage youβre willing to tolerate for the swap. A 0.5 value allows for a 0.5% change in price before the transaction reverts.
Number (required)
destinationAddress
The wallet address where the assets will be sent. Often the same as senderAddress, but can differ.
String (required)
dynamicSlippage
When set to true, slippage tolerance is automatically adjusted based on current market conditions. Especially useful for networks like Solana, where price volatility can vary.
Bool (optional)
Now that you're able to find the optimal execution route, you can fully execute the transactions:
πExecuting TransactionsLast updated