Pact Swap

Introduction to the API

Pact Swap API Reference


REST API Overview

The Pact Swap REST API provides a comprehensive set of endpoints for interacting with the decentralized exchange built on the Coinweb protocol. The API is organized into several contract modules, each serving specific functionality:

  • SWAP: Core swap functionality for users and liquidity providers
  • ECDSA: Wallet balance and UTXO management for ECDSA-based wallets

All endpoints follow RESTful conventions and return JSON responses. The API uses:

  • GET requests for querying data (order information, swap status, balances, quotes)
  • POST requests for creating UI commands that generate QR code strings for Coinweb L2 transactions

Transaction composition endpoints (both GET and POST) return unsigned transaction data that can be signed and broadcast by your wallet.

Base URL

The API base URL is typically:

https://cwap-api.coinhq.store

Authentication

Most endpoints do not require authentication. However, when composing transactions, you'll need to sign them with your wallet before broadcasting to the blockchain.

Response Format

All endpoints return JSON responses. Error responses follow a standard format with appropriate HTTP status codes.

Transaction Composition

Endpoints that compose transactions (prefixed with compose) return unsigned transaction data. For Bitcoin-like blockchains (BTC, LTC, DOGE), you'll need to provide UTXO information and a public key. For EVM-compatible blockchains, the response includes chain-specific fields like chainId, value, to, and type.


This section provides an overview of the available API endpoints for interacting with the decentralized exchange.

SWAP

This contract module is for communicating with the Pact Swap contract. The API is divided into two main sections:

  • Liquidity Provider API: Endpoints for liquidity providers to manage orders, check swap status, and finalize transactions
  • User API: Endpoints for users to get swap quotes and compose swap transactions

The compose routes can create an unsigned transaction that can be signed by your wallet of choice and broadcasted to the desired network.

Liquidity Provider Endpoints

ECDSA

The ECDSA contract module is for communication with the ECDSA User contract. The helper routes are for fetching balances and UTXOs for a given Coinweb wallet address identified by its public key. You can find out more about the ECDSA User contract here.

Was this documentation helpful? Any suggestions?