Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Transaction Formats by txType

Reference examples of the transaction payload SwapKit returns for each txType.

Every /v3/quote and /v3/swap route that includes a transaction returns two related fields:

  • tx — the transaction payload to sign and broadcast.

  • txType — a tag identifying the payload's format, so you know how to decode and sign it.

The shape of tx depends on txType. Some chains return a JSON object (EVM, Cosmos, Tron, TON); others return an already-serialized string (Bitcoin PSBT, Solana, Ripple, NEAR, Sui, Cardano, Stellar, Zcash). This page catalogs the exact format for each txType with a real example response.

For how these payloads are signed and how to verify the signature, see Transaction Payload Signing. Object tx types are canonicalized with RFC 8785 (JCS) before hashing; string tx types are hashed verbatim.

How to reproduce an example

To fill in a section below, run one real swap on that chain and paste the response:

  1. Call /v3/quote with a sellAsset on the target chain and a funded sourceAddress, then pick a route.

  2. Request the transaction using that route's nextActions entry — it gives you the method, url, and payload to send, so you don't build the /swap call yourself.

  3. From the response, copy the route's txType, tx, and — if signing is enabled — meta.signedTx / meta.signature / meta.signedTxString into the matching section.

See the /v3/quote and /v3/swap docs for the full request/response contract.


Object tx types

These return tx as a JSON object. The signed pre-image is the RFC 8785 (JCS) canonical JSON of the object — see Transaction Payload Signing.

EVM

  • txType: EVM

  • tx shape: object ({ from, to, data, value, gas, gasPrice, ... })

  • Chains: Ethereum, BSC, Avalanche, Arbitrum, Base, Polygon

  • Example sell asset: ETH.ETH

Example response (tx + meta)

Notes: meta.signedTxString has the keys in alphabetical order (data, from, gas, gasPrice, to, value) — not the order they appear in tx. That's the RFC 8785 canonical form.

Legacy by default, EIP-1559 by arrangement. The payload above is legacy (type-0): one gasPrice, no fee-market fields. A key can be opted in per chain, and its payloads then carry maxFeePerGas and maxPriorityFeePerGas instead of gasPrice — never alongside it, since a transaction carrying both is invalid. The two fields join the canonical form in alphabetical order, so a signer that rebuilds signedTxString from the object it received stays correct; one that hardcodes the legacy key set does not. Opting in is a setting on your key, not a request parameter — without it, nothing changes.

COSMOS

  • txType: COSMOS

  • tx shape: object (Cosmos SDK transaction)

  • Chains: Cosmos Hub (GAIA), and other Cosmos SDK chains

  • Example sell asset: GAIA.ATOM

Example response (tx + meta)

Notes: tx is a JSON object, canonicalized with RFC 8785 (JCS) before hashing — keys sorted recursively (nested objects too). Reproduce with a JCS canonicalizer, or just hash meta.signedTxString

TRON

  • txType: TRON

  • tx shape: object (Tron transaction; may be an EVM-style object for TRC-20/contract calls)

  • Chains: Tron

  • Example sell asset: TRON.TRX

Example response (tx + meta)

Notes: tx is a JSON object (native Tron format: visible, txID, raw_data, raw_data_hex), canonicalized with RFC 8785 (JCS) — keys sorted recursively (top-level → raw_data, raw_data_hex, txID, visible; inside raw_data → contract, data, expiration, ref_block_bytes, ref_block_hash, timestamp; etc.).

TON

  • txType: TON

  • tx shape: object ({ sendMode, messages[] })

  • Chains: TON

  • Example sell asset: TON.GRAM

Example response (tx + meta)

Notes: tx is a JSON object, canonicalized with RFC 8785 (JCS) — keys sorted recursively, which is why meta.signedTxString reads messages before sendMode, and address before amount inside each message. sendMode is a SendMode bitmask applied to the whole transfer, not per message: 3 normally, 130 (carry all remaining balance) on sweeps, so the wallet sends balance − fees instead of the literal amount. Pass it through as given. amount is a base-unit string (nanotons); payload (base64 BOC of the body cell) and stateInit are optional and absent on a plain transfer like this one.


String tx types

These return tx as an already-serialized string. The string is the exact signable bytes and is hashed verbatim (no canonicalization) — see Transaction Payload Signing.

PSBT

  • txType: PSBT

  • tx shape: string (base64-encoded PSBT)

  • Chains: Bitcoin, Litecoin, Dogecoin, Bitcoin Cash, Dash

  • Example sell asset: BTC.BTC

Example response (tx + meta)

Notes: For a PSBT (string) tx, meta.signedTxString is identical to tx — string txs are hashed verbatim, not canonicalized.

SOLANA

  • txType: SERIALIZED_BASE64

  • tx shape: string (base64-serialized Solana transaction)

  • Chains: Solana

  • Example sell asset: SOL.SOL

Example response (tx + meta)

Notes: tx is a base64-serialized Solana transaction — a string, hashed verbatim (signedTxString === tx)

RIPPLE

  • txType: RIPPLE

  • tx shape: string

  • Chains: XRP Ledger

  • Example sell asset: XRP.XRP

Example response (tx + meta)

Notes: tx is a JSON string (an XRPL Payment serialized with JSON.stringify). Even though it contains JSON, RIPPLE is a string txType — hashed verbatim. Do not JSON.parse + re-stringify it and do not canonicalize it: the keys are in XRPL order (Account, Amount, Destination,...), and any re-serialization changes the bytes and breaks verification. Hash the raw string exactly as received (meta.signedTxString, which equals tx).

NEAR

  • txType: NEAR

  • tx shape: string

  • Chains: NEAR

  • Example sell asset: NEAR.NEAR

Example response (tx + meta)

Notes: tx is a serialized NEAR transaction (a string, hashed verbatim: signedTxString === tx). String type → no canonicalization; binding check is sha256(signedTxString).

SUI

  • txType: SUI

  • tx shape: string

  • Chains: Sui

  • Example sell asset: SUI.SUI

Example response (tx + meta)

Notes: tx is base64 Sui transaction bytes (txBytes.toBase64()) — a string, hashed verbatim (signedTxString === tx). No canonicalization.

CARDANO

  • txType: CBOR

  • tx shape: string (CBOR-encoded transaction)

  • Chains: Cardano

  • Example sell asset: ADA.ADA

Example response (tx + meta)

Notes: tx is an unsigned Cardano transaction as a CBOR hex string — hashed verbatim (signedTxString === tx). No canonicalization.

STELLAR

  • txType: STELLAR

  • tx shape: string (base64 XDR)

  • Chains: Stellar

  • Example sell asset: XLM.XLM

Example response (tx + meta)

Notes: tx is a base64 XDR-encoded Stellar transaction envelope (a string, hashed verbatim: signedTxString === tx). String type → no canonicalization; binding check is sha256(signedTxString).

Zcash (unsigned)

  • txType: zcash-unsigned

  • tx shape: string

  • Chains: Zcash

  • Example sell asset: ZEC.ZEC

Example response (tx + meta)

Notes: tx is a base64 PCZT (Partially Created Zcash Transaction) — a string, hashed verbatim. It is served when your API key selects PCZT; PSBT is the Zcash default, and both build from a transparent source. A shielded (u1…) source returns no tx at all — see Zcash shielded & unified addresses.

Since the NU7 upgrade only PCZT_V5 is served, and it carries the swap memo as a zero-value OP_RETURN output the signer must accept.

Last updated