radFi
  • Overview
  • Economics
  • User Guides
    • Trading Wallet
  • Trading
  • Automated Market Making
  • User Flows
    • Swap Tab
    • Pool Tab
      • Positions
      • Pools
    • Portfolio Tab
  • Walk-Through Video
  • Technical Architecture
    • Automated Market Maker
    • radFi OP_12
    • Bitcoin Data Availability
    • Trading Wallet
  • Validator
  • Smart Contract
  • radFi Actions Flowchart
  • DEV
    • API Endpoints
      • Create Trading Wallet
      • Swap
      • AMM
        • Init Liquidity
        • Supply Liquidity
        • Increase Liquidity
        • Withdraw Liquidity
        • Collect Fees
  • Terms and Conditions
  • Privacy Policy
Powered by GitBook
On this page
  • Build PSBT
  • Sign and Broadcast Transaction
  1. DEV
  2. API Endpoints

Swap

Build PSBT

Endpoint: /api/transactions Method: POST

Request Body

{
  "type": "swap",
  "params": {
    "userAddress": "string",
    "tokens": ["string"],
    "amountInt": "string",
    "amountOut": "string",
    "feeRates": ["number"],
    "isExactIn": "boolean"
  }
}

Response

{
  "code": 1,
  "message": "common.success",
  "data": {
    "base64Psbt": "string",
    "fee": {
      "feeRate": "number",
      "totalFee": "number"
    }
  }
}

Sign and Broadcast Transaction

Endpoint: /api/transactions/sign Method: POST

Request Body

{
  "type": "swap",
  "params": {
    "userAddress": "string",
    "signedBase64Tx": "string"
  }
}

Response

{
  "code": 1,
  "message": "common.success",
  "data": {
    "txId": "string"
  }
}
PreviousCreate Trading WalletNextAMM

Last updated 3 months ago