sponsor: true on execute.
Prerequisites:
- Turnkey has enabled swap fee sponsorship for your parent organization. Early access is invite-only: reach out to your Turnkey contact with your parent organization ID.
- Only the parent organization can turn it on and change the spend limit. Sub-organizations use their parent’s settings.
Set the spend limit
From the parent organization, submitACTIVITY_TYPE_UPSERT_SWAP_FEE_SPONSORSHIP_LIMIT_CONFIG with enabled: true and two USD limits over a rolling time window:
- Organization-wide limit: the cap on sponsored fees across your parent organization and all of its sub-organizations.
- Sub-organization limit: the cap that applies to each of your sub-organizations.
enabled: false turns it off and keeps the saved limits.
Request a sponsored quote
SubmitACTIVITY_TYPE_CREATE_SWAP_QUOTE_V3 with feeSponsorship: true. Everything else is the same as a regular quote.
With the Go SDK, use Client.CreateSwapQuoteV3. The TypeScript SDK’s createSwapQuote sends V2; until it adds V3, submit the activity with client.request, as in Enable Swaps.
A sponsored quote comes back with feeSponsorship: true, and its outputAmount and minOutputAmount are no longer reduced by the provider’s fees. Your client fee, if configured, still applies.
To also swap stablecoins at a fixed rate, set fixedRate too. See Fixed-Rate Swaps.
Execute the quote
Execute the quote withACTIVITY_TYPE_EXECUTE_SWAP_V3 as for any quote. The quote binds the sponsorship, so nothing else changes. To also sponsor gas, set sponsor: true.
Check usage
get_swap_sponsorship_usage returns whether swap fee sponsorship is permitted for your organization, its spend limit, and what is left in the current window. A swap counts against the limit once its final cost is recorded, shortly after it completes. Pending swaps are not reserved, so what is left does not account for swaps still in progress.
Errors
A quote that requests swap fee sponsorship fails, rather than falling back to an unsponsored quote, when:
A quote is also rejected when the spend limit is turned off, or when the swap’s estimated cost would exceed what is left in the window. Check usage or raise the limit.
Next steps
- Fixed-Rate Swaps: swap stablecoins at a fixed rate, usually together with swap fee sponsorship.
- Execute a swap: the signing activity that runs the swap end-to-end.
- Track swap status: same-chain vs. cross-chain polling.