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); others return an already-serialized string (Bitcoin PSBT, Solana, Ripple, NEAR, Sui, Cardano, 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.

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_datacontract, data, expiration, ref_block_bytes, ref_block_hash, timestamp; etc.).


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 — the shielded path; transparent ZEC returns PSBT). A string, hashed verbatim.

Last updated