Skip to content

Panora swapper #12494

Description

@linear

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)

  • SwapperName.Panora, swappers record, default slippage 0.5%
  • Feature flag VITE_FEATURE_PANORA_SWAP: config validation, .env files, preferences slice, test mocks
  • VITE_PANORA_API_KEY in SwapperConfig, config validation, public-api env
  • CSP entry headers/csps/defi/swappers/Panora.ts
  • Swapper icon
  • getEnabledSwappers entry + 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_ADDRESS is 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions