--- title: GetSwapInstructions description: Aggregator routing for a quote whose deposit swaps on the source chain. openapi: "openapi.json GET /v1/quotes/{quote_hash}/instructions" --- ``` rpc GetSwapInstructions(SwapInstructionsRequest) returns (SwapInstructions) ``` Builds a fresh route for a quote that has a source swap leg, one where `order_params.src_token` differs from `order_params.bridge_token_src`. Call it immediately before sending the deposit; routing reflects pool state at build time. ## Request Hash returned by `GetQuote`. ## Response Contract the deposit call goes to: the `HularRouter` on EVM chains, the program id on Solana. Input token. Input amount, base units. Output token of the swap. For a cross-chain quote this is the asset that bridges; for a same-chain quote it is the destination token. Floor the swap output is checked against on chain. The `payload` is a `oneof` matching the source chain's VM. ### EVM: `evm` Aggregator the router will call. Allowlisted on the contract. `0x` hex calldata to pass through. Transaction value to attach. Non-zero only when the source token is the chain's native asset. ### Solana: `svm` Instructions to run before the swap, such as creating token accounts. The aggregator swap instruction. The deposit wraps it in the program's `deposit_swap` instruction, which runs the swap and checks the output against `min_bridge_out`. Instructions to run after the swap. Address lookup tables to attach to the versioned transaction. Each `SvmInstruction` carries `program_id`, `accounts` (`pubkey`, `is_signer`, `is_writable`), and base64 `data`. ## Using it On EVM, map the fields straight onto the router call: ```ts const swap = await hular.getSwapInstructions({ quoteHash }); if (swap.payload.case !== "evm") throw new Error("expected evm instructions"); const evm = swap.payload.value; await wallet.sendTransaction({ to: swap.routerAddress, value: BigInt(evm.value), data: encodeFunctionData({ abi: routerAbi, functionName: "depositWithSwap", args: [ quoteHash, swap.srcToken, BigInt(swap.amountIn), evm.aggregator, evm.swapCalldata, swap.bridgeToken, BigInt(swap.minBridgeOut), ], }), }); ``` On Solana, `buildSvmSwapDeposit` in the SDK assembles the versioned transaction from the payload. Same-chain quotes on EVM use the same instructions with `swapAndForward` instead; see [Same-chain swaps](/integration/same-chain-swaps). ## Errors | Code | Message | When | | --- | --- | --- | | `INVALID_ARGUMENT` | `quote is not a source swap` | The quote's source token is already the bridge token. No instructions exist. | | `INVALID_ARGUMENT` | `invalid quote hash` | Not a 32-byte hex hash. | | `NOT_FOUND` | `quote not found or expired` | No stored quote with that hash. | | `UNAVAILABLE` | `aggregator error` | The aggregator failed or returned no route. | | `UNAVAILABLE` | `source route output below committed minimum` | The live route no longer clears the floor committed in the quote. Re-quote. | The last one means the market moved after the quote was issued. Getting a new quote is the correct response; retrying the instructions will keep failing while the route is worse than what was promised.