Repository navigation
Open
Description
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 integratorFeePercentagesent 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 address- Transactions built as BCS
SimpleTransactionviaAptosChainAdapter.buildEntryFunctionApiTransaction, a generic entry function builder added by this PR (buildSendApiTransactionnow 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.envmust 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)
-
SwapperName.Panora, swappers record, default slippage 0.5% - Feature flag
VITE_FEATURE_PANORA_SWAP: config validation,.envfiles, preferences slice, test mocks -
VITE_PANORA_API_KEYinSwapperConfig, config validation, public-api env - CSP entry
headers/csps/defi/swappers/Panora.ts - Swapper icon
-
getEnabledSwappersentry +isCrossAccountTradeSupported(false)
Validation (definition of done)
- Aptos chain integration #12493 merged first (this PR is stacked on it)
- CI workflows approved and green
- Engineering review approved, merged to develop
- On a local build with both flags on: APT to USDC quote shows Panora as protocol with a sane rate
- Reverse direction (USDC to APT) and a non stable pair (APT to amAPT) quote correctly
- One swap executed end to end, status goes from pending to complete (already done once on mainnet from the trade UI during development, redo after merge)
- No ShapeShift fee line appears in the quote while
PANORA_INTEGRATOR_FEE_ADDRESSis unset
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.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity
[-]Panora swapper for Aptos: review and ship (web PR #12492)[/-][+]Panora swapper[/+]