Panora swapper, PR 2 (same chain Aptos swaps), stacks on #12493
Intra Aptos swaps through the Panora aggregator, our first same chain swapper on Aptos.
Docs: https://docs.panora.exchange
API: POST https://api.panora.exchange/swap, x-api-key header (public key from their docs)
PR: #12492 (only the last two commits are new to review, the rest is #12493)
Scope
- Aptos only, APT and Aptos coins, same chain swaps
- Behind
VITE_FEATURE_PANORA_SWAP, off in production
- Out of scope: affiliate fee collection (blocked on DAO treasury, BIZ-35), dedicated API key and partnership (BIZ-36)
Key implementation details
- The Panora API deals in human readable token amounts both ways, NOT base units. Amounts are converted at the boundary with
fromBaseUnit / toBaseUnit, verified against the live API
integratorFeePercentage sent without integratorFeeAddress is still deducted from the user but kept by Panora (verified live in the on chain router args). Never send the percentage alone. Gated behind PANORA_INTEGRATOR_FEE_ADDRESS in PanoraSwapper/utils/constants.ts, unset until the DAO has an Aptos treasury address
- Transactions built as BCS
SimpleTransaction via AptosChainAdapter.buildEntryFunctionApiTransaction, a generic entry function builder added by this PR (buildSendApiTransaction now delegates to it)
- Trade status polled on chain via
checkAptosSwapStatus, same pattern as the Cetus swapper on Sui
- The API key contains
# characters: the value in .env must stay double quoted or dotenv truncates it at the first # and every quote fails with a 401
- Native APT address for the Panora API is
0xa
- The public API is occasionally flaky (one poll fails, the next succeeds), a dedicated key may help (BIZ-36)
Registration checklist (shipped in the PR, per the swapper integration contract)
Validation (definition of done)
Already verified during development: multi pair quotes, one mainnet swap executed end to end with the received amount matching the quote exactly, on chain status polling through to completion. Screenshots in the PR.
Panora swapper, PR 2 (same chain Aptos swaps), stacks on #12493
Intra Aptos swaps through the Panora aggregator, our first same chain swapper on Aptos.
Docs: https://docs.panora.exchange
API:
POST https://api.panora.exchange/swap,x-api-keyheader (public key from their docs)PR: #12492 (only the last two commits are new to review, the rest is #12493)
Scope
VITE_FEATURE_PANORA_SWAP, off in productionKey implementation details
fromBaseUnit/toBaseUnit, verified against the live APIintegratorFeePercentagesent withoutintegratorFeeAddressis still deducted from the user but kept by Panora (verified live in the on chain router args). Never send the percentage alone. Gated behindPANORA_INTEGRATOR_FEE_ADDRESSinPanoraSwapper/utils/constants.ts, unset until the DAO has an Aptos treasury addressSimpleTransactionviaAptosChainAdapter.buildEntryFunctionApiTransaction, a generic entry function builder added by this PR (buildSendApiTransactionnow delegates to it)checkAptosSwapStatus, same pattern as the Cetus swapper on Sui#characters: the value in.envmust stay double quoted or dotenv truncates it at the first#and every quote fails with a 4010xaRegistration checklist (shipped in the PR, per the swapper integration contract)
SwapperName.Panora, swappers record, default slippage 0.5%VITE_FEATURE_PANORA_SWAP: config validation,.envfiles, preferences slice, test mocksVITE_PANORA_API_KEYinSwapperConfig, config validation, public-api envheaders/csps/defi/swappers/Panora.tsgetEnabledSwappersentry +isCrossAccountTradeSupported(false)Validation (definition of done)
PANORA_INTEGRATOR_FEE_ADDRESSis unsetAlready verified during development: multi pair quotes, one mainnet swap executed end to end with the received amount matching the quote exactly, on chain status polling through to completion. Screenshots in the PR.