Skip to main content
Integrate the MultiversX Aggregator by validating the pair, quoting near user confirmation, signing the returned transaction data, and broadcasting the signed transaction.

Prerequisites

RequirementWhy
Wallet or signing serviceThe Aggregator does not sign transactions.
Amount conversionQuote amounts are smallest unit strings.
Broadcast pathWallet, Gateway, or Relayer broadcast after signing.
Error handlingPair, quote, rate limit, and simulation failures are expected states.

Flow

1

Validate token support

Call /api/v1/pair-config with from and to. Stop if supported=false.
2

Convert the amount

Convert the user-entered human-readable amount with decimalsIn. See Token amounts.
3

Quote without sender for preview

Call /api/v1/quote with amountIn or amountOut. Use the response for display only.
4

Requote with sender at confirmation

Pass sender when the user confirms. This lets the service build a transaction object when nonce and gas simulation succeed.
5

Sign and broadcast

Sign the returned transaction, or build a transaction from txData using the correct token transfer shape, then broadcast.

Implementation Checklist

CheckRequired handling
Pair unsupportedShow error from pair config and stop.
Amount below minimumCompare smallest-unit input with minAmountIn.
Slippage changedRequote; txData encodes slippage-derived minimum output.
Sender changedRequote; nonce and transaction fields are sender-specific.
ESDT input with only txDataWrap txData with ESDTTransfer or MultiESDTNFTTransfer.
HTTP 429Back off and queue requests.
HTTP 503Retry after service warmup or snapshot recovery.
Do not reuse txData across quote requests. It belongs to the quote, amount, slippage, route, and sender context that produced it.

Minimal TypeScript Shape

async function getSwapTransaction(sender: string) {
  const pair = await fetch(
    "https://swap.xoxno.com/api/v1/pair-config?from=WEGLD-bd4d79&to=USDC-c76f1f"
  ).then((res) => res.json());

  if (!pair.supported) throw new Error(pair.error);

  const params = new URLSearchParams({
    from: "WEGLD-bd4d79",
    to: "USDC-c76f1f",
    amountIn: "1000000000000000000",
    slippage: "0.005",
    sender,
  });

  const quote = await fetch(`https://swap.xoxno.com/api/v1/quote?${params}`)
    .then((res) => {
      if (!res.ok) throw new Error(`quote failed: ${res.status}`);
      return res.json();
    });

  if (!quote.transaction && !quote.txData) {
    throw new Error("quote did not include transaction data");
  }

  return quote;
}

Verify Before Signing

  • pair.supported is true.
  • amountIn is an integer string in the input token’s smallest unit.
  • amountOutMin matches the slippage shown in the UI.
  • transaction.sender equals the connected wallet when transaction is present.
  • The quote was requested after the latest user change to token, amount, slippage, or sender.