Liberty Swap API

The official API for Liberty Swap! πŸš€

Overview

LibertySwap provides an offchain quoting system that generates secure calldata for cross-chain swaps. By using this API, DApps and integration partners can easily fetch the optimal route, calculate fees, and generate the transaction payload needed to interact with the LibertySwap contracts.

Key Concepts:

  • Non-Custodial: LibertySwap never holds user funds. The API simply generates the payload for the user to sign and execute the transaction from their own wallet.

  • Cross-Chain Payload Generation: Automatically encodes the required transaction data for your cross-chain transfer.

  • Privacy By Default: Native support for shielding and unshielding via Railgun, directly integrated into the quoting API.

Base URL: https://api.libertyswap.finance Current API Version: v1

Supported Pairs

LibertySwap supports direct pool-to-pool cross-chain swaps optimized for high liquidity and privacy.

1. Standard Swaps (Public)

Asset
Inbound: Public Networks β†’ PulseChain
Outbound: PulseChain β†’ Public Networks

USDC

Ethereum, Base, BSC, Arbitrum, Polygon β†’ USDC

USDC β†’ Ethereum, Base, BSC, Polygon

ETH / WETH

Ethereum (Native ETH) β†’ WETH

WETH β†’ Ethereum (Native ETH)

USDT / DAI

Ethereum, BSC β†’ USDC

(Inbound Only)

USD1

BSC β†’ USDC

(Inbound Only)

2. Privacy Swaps (Railgun)

Shield and unshield assets to break the linkability of your transfers.

Asset
Shielding (Public β†’ Railgun)
Unshielding (Railgun β†’ Public)

USDC

PulseChain, Ethereum, Base, BSC, Arb, Polygon β†’ USDC (Railgun Eth / BSC)

USDC (Railgun Ethereum / BSC) β†’ PulseChain, Ethereum, Base, BSC, Polygon

USDT / DAI

Ethereum, BSC β†’ USDC (Railgun Ethereum / BSC)

(Inbound Only)

USD1

BSC β†’ USDC (Railgun Ethereum / BSC)

(Inbound Only)

ETH / WETH

Ethereum, PulseChain β†’ WETH (Railgun Ethereum / BSC)

WETH (Railgun Ethereum / BSC) β†’ PulseChain, Ethereum

Fees

The API automatically calculates fees based on the bridge direction and privacy settings: * PulseChain β†’ EVM Chains: 0.5% * EVM Chains β†’ PulseChain: 0.3% * Privacy Swaps (Railgun): 0.5% (Applies to all shielding & unshielding transfers)

Amount Limits

The API enforces strict per-transaction volume limits to ensure liquidity stability. If the requested amount violates these constraints, the API returns an error.

  • Stablecoins (USDC/USDT/DAI/USD1): Min 10 USDC, Max 25,000 USDC equivalent

  • ETH / WETH: Min 0.01 ETH, Max 20 ETH

Chain IDs Reference

Developers must pass numeric srcChain and dstChain IDs representing the networks:

Network
Chain ID

Ethereum

1

PulseChain

369

Base

8453

BSC

56

Polygon

137

Arbitrum

42161

Railgun Ethereum

69696969

Railgun BSC

96969696

API Documentation

Get Quote

GET /v1/quote

Fetches the optimal route, estimated fees, and calldata for the transaction.

General Conventions:

  • Requested amount should be a decimal string representing the smallest unit (wei).

  • Response methodParameters.value and calldata are formatted in hex (0x...).

Example Request:

Query Parameters

Parameter
Type
Required
Description

srcToken

string

Yes

The source token address or symbol (e.g., ETH or USDC).

dstToken

string

Yes

The destination token address or symbol.

amount

string

Yes

Amount in wei/smallest unit as a decimal string (e.g. 1000000 for 1 USDC).

srcChain

string

Yes

Source network chain ID (e.g. 1, 8453).

dstChain

string

Yes

Destination network chain ID.

recipient

string

No

Receiver address. If not provided, it defaults to the zero address.

recipientType

integer

No

Recipient format constraint. 0: Standard EVM, 2: Railgun destination. Defaults to 0.

Response Schema

Field
Type
Description

to

string

The Smart Contract Router Address you must send the transaction to.

srcToken

object

Details about the source token (address, symbol, decimals, chainId).

destToken

object

Details about the destination token.

srcAmount

string

Source amount specified in the request (decimal string).

destAmount

string

Target amount the user will receive after fees have been deducted (decimal string).

fee.percentage

number

Bridge fee percentage (e.g., 0.3 or 0.5).

fee.amount

string

Absolute fee amount in the source token’s smallest unit (decimal string).

methodParameters.calldata

string

The raw encoded byte-payload you must pass into the data field of your Ethereum transaction.

methodParameters.value

string

The amount of native gas token (in hex format) to pass into the value field of your Ethereum transaction. Will be 0x0 for ERC-20 transfers.

Response Example:


Security Best Practices

IMPORTANT: To prevent β€œMan-in-the-Middle” or DNS/Server compromise attacks, we strongly recommend that integration partners implement a Contract Whitelist.

While the API securely computes the most optimal to (Router) address for your swap, you should verify this address against our official list of deployments before asking your end-user to sign any transaction.

Official Router Addresses (Mainnet)

Chain
Asset
Router Address

PulseChain

USDC

0xe7EE706a6708b691a232452c9cb267d186942F09

PulseChain

WETH

0x80C2C603d72ea17A0D85B670D4489eB3012035Cd

Ethereum

USDC

0x06291eeE038e94E8DEC2b3bfB6e030c0b5615506

Ethereum

USDT

0x12352B55e0b4305Dd83A349A5d7845bE9B5a2Eea

Ethereum

DAI

0xAA7a195D69327a894eeb969D3bCb89116FC78A14

Ethereum

ETH

0x60FDAf9198eFCD6fAF27D50E955e1A42905f2eeb

BSC

USDC

0x43f403972080406e3e6602793A5072DBc4389bAb

BSC

USDT

0xc438D51F296fF3e53d061293D2bC4Bb9fb2f7f19

BSC

USD1

0x4E839dA8DCd61df10976B926cbF9Ab7D06BfF072

Base

USDC

0xefB11856C4bE75C276A5C9E286F8032D3E16Ced2

Arbitrum

USDC

0x05216280d45Bb8E8dcb863186E4762090bab7b6F

Polygon

USDC

0xcb2b2a70F29a8b7467fA930A09f9271D1eF0E5A9

API Rate Limiting

To prevent infrastructure abuse and DDoS attacks, the following rate limits are applied per source IP:

  • Limit: 30 requests per minute

  • Error: Exceeding this limit results in a 429 Too Many Requests status.

Last updated