Conductor is the contractDocumentation Index
Fetch the complete documentation index at: https://flashnet-build.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
TradingClient calls under the hood. Most integrators should use TradingClient.swap and never see Conductor directly. This page covers the raw calldata encoders for cases where you need to call it without the SDK wrapper.
When you need this
- Wiring a swap into a contract you wrote, where the SDK doesn’t run.
- Building a custom UI that constructs intents manually.
- Tooling that batches multiple swaps into one signed transaction.
Encoders
ExecutionClient.execute (which expects the RLP-hex of the signed tx, not the calldata directly). For encodeSwapBTC, set the transaction’s value to the input amount in wei (sats × WEI_PER_SAT = 10^10). For encodeSwap, set value: 0n.
Variants
TradingClient.swap picks one of ten Conductor methods automatically based on input asset, output asset, withdraw flag, and approval mode:
| Input → Output | Withdraw | Approval mode | Conductor method |
|---|---|---|---|
| token → token | false | n/a | swap |
| BTC → token | false | n/a | swapBTC |
| BTC → token | true | n/a | swapBTCAndWithdraw |
| token → BTC | true | exact | swapAndWithdrawBTC |
| token → token | true | exact | swapAndWithdraw |
| token → BTC | true | permit2 | swapAndWithdrawBTCWithPermit2 |
| token → token | true | permit2 | swapAndWithdrawWithPermit2 |
| BTC → token | true | EIP-2612 (useAvailableBalance) | swapBTCAndWithdrawWithEIP2612 |
| token → BTC | true | EIP-2612 (useAvailableBalance) | swapAndWithdrawBTCWithEIP2612 |
| token → token | true | EIP-2612 (useAvailableBalance) | swapAndWithdrawWithEIP2612 |
PermitTransferFrom); EIP-2612 is per-token (SparkToken implements it). The SDK only exports encodeSwap and encodeSwapBTC directly; the withdraw and permit variants are constructed inside TradingClient.
Custom errors
Conductor’s revert selectors are inCONDUCTOR_REVERT_ERRORS:
TokensNotSorted()— input/output addresses must be passed in canonical sort order.PoolDoesNotExist()— wrong fee tier or pool not yet created.InsufficientBTCValue()—valuedoesn’t matchamountInfor BTC swaps.WBTCNotInPair()— BTC swap targeting a pool that doesn’t include WBTC.