Saturn Documentation
Launch App
  • Saturn
  • Traders
    • Trading in Saturn
    • How to Swap
    • How Saturn Protects Your Trades from MEV Risks
  • Liquidity Providers
    • Open a position in a Liquidity Pool
    • Managing your Portfolio on Saturn
  • Token Creators
    • How to Create a Pool on Saturn
  • Builders
    • Saturn API
      • Pool API
        • Initialize pool
        • Add Shards
        • Open position
        • Increase Liquidity
        • Remove Liquidity
        • Swap
        • Swap Quotes
        • Boost Transaction
        • Wallet
      • Indexer API
        • Collections
        • Pools
        • Prices
        • Positions
        • Transactions
        • Charts
        • Stats
    • Liquidity Pool SDK
  • Saturn V1
    • Overview
    • How-To-Links
      • Setting up Trading Account
        • Withdrawing from Trading account
      • Swap
      • Orderbook
        • Your Profile
          • Trade History
        • How to place a sell order
        • How to place a buy order
        • Positions
      • Collect
      • Charts
      • Tutorial videos
        • Setting up a Trading Account (v3) and preparing for Rings Airdrops
        • Trading on Saturn
    • FAQs
      • What are Satoshi's, Rare SATs, and Rings?
        • More on Rare SATs
      • What is a UTXO
      • What is a PSBT
      • Why are there batch sizes?
      • Compatible Wallets
      • Why is my Available balance different than my Total balance?
Powered by GitBook
On this page
  1. Builders
  2. Saturn API
  3. Pool API

Remove Liquidity

PreviousIncrease LiquidityNextSwap

Last updated 1 month ago

  • POSTDecrease Liquidity PSBT
  • POSTDecrease Liquidity Message
  • POSTDecrease Liquidity

Decrease Liquidity PSBT

post

Generates a PSBT for decreasing liquidity from a position. This PSBT is optional and it will be used to pay for the decrease transaction fees if the funds to withdraw are not enough to cover the fees.

Authorizations
Body
feeRateinteger · min: 1Required

The fee rate for the transaction (in sats per byte).

runePubkeystring · min: 64 · max: 66Required

The public key of the rune address of the user initiating the request.

Pattern: ^[0-9a-fA-F]+$
paymentPubkeystring · min: 64 · max: 66Optional

The public key of the bitcoin address of the user initiating the request. If the user doesn't have a bitcoin address, the runePubkey will be used

Pattern: ^[0-9a-fA-F]+$
runeAddressstringRequired

The rune address of the user. It must be a taproot address. (P2TR). If no bitcoin address is provided, the rune address will be used for bitcoin too.

paymentAddressstringOptional

The bitcoin address of the user.

Responses
201
An object containing the PSBT (in base64 format), the fee, and the list of UTXOs to sign.
application/json
400
Pool error
application/json
401
Unauthorized
application/json
403
User not found
application/json
500
Internal Server Error
application/json
post
POST /v0/pool/decrease-liquidity/psbt HTTP/1.1
Host: api-dev.saturnbtc.io
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 101

{
  "feeRate": 1,
  "runePubkey": "text",
  "paymentPubkey": "text",
  "runeAddress": "text",
  "paymentAddress": "text"
}
{
  "psbt": "text",
  "fee": 1,
  "utxosToSign": [
    {
      "address": "text",
      "signingIndexes": [
        1
      ],
      "sigHash": 1,
      "utxo": "text"
    }
  ]
}

Decrease Liquidity Message

post

Generates a message hash for decreasing liquidity from a position, which the user should sign.

Authorizations
Body
poolIdstring · min: 64 · max: 66Required

The pubkey of the pool.

Pattern: ^[0-9a-fA-F]+$
positionPubKeystring · min: 64 · max: 66Required

The pubkey of the position.

Pattern: ^[0-9a-fA-F]+$
liquidityAmountstringRequired

The amount of liquidity to withdraw.

feeRateinteger · min: 1Required

The fee rate for the transaction (in sats per byte).

minToken0stringRequired

The minimum amount of the first token to withdraw.

Pattern: ^[1-9][0-9]*$
minToken1stringRequired

The minimum amount of the second token to withdraw.

Pattern: ^[1-9][0-9]*$
withdrawAddressToken0stringRequired

The address to withdraw the first token to.

withdrawAddressToken1stringRequired

The address to withdraw the second token to.

signedPsbtstringOptional

The signed PSBT in base64 format.

Pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}={2})$
runePubkeystring · min: 64 · max: 66Required

The public key of the rune address of the user initiating the request.

Pattern: ^[0-9a-fA-F]+$
paymentPubkeystring · min: 64 · max: 66Optional

The public key of the bitcoin address of the user initiating the request. If the user doesn't have a bitcoin address, the runePubkey will be used

Pattern: ^[0-9a-fA-F]+$
runeAddressstringRequired

The rune address of the user. It must be a taproot address. (P2TR). If no bitcoin address is provided, the rune address will be used for bitcoin too.

paymentAddressstringOptional

The bitcoin address of the user.

Responses
201
A hexadecimal string representing the hash of the message to be signed by the user.
application/json
Responsestring
400
Pool error
application/json
401
Unauthorized
application/json
403
User not found
application/json
500
Internal Server Error
application/json
post
POST /v0/pool/decrease-liquidity/message HTTP/1.1
Host: api-dev.saturnbtc.io
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 286

{
  "poolId": "text",
  "positionPubKey": "text",
  "liquidityAmount": "text",
  "feeRate": 1,
  "minToken0": "text",
  "minToken1": "text",
  "withdrawAddressToken0": "text",
  "withdrawAddressToken1": "text",
  "signedPsbt": "text",
  "runePubkey": "text",
  "paymentPubkey": "text",
  "runeAddress": "text",
  "paymentAddress": "text"
}
text

Decrease Liquidity

post

Finalizes the decrease of liquidity from a position by submitting the signed message and executing the transaction on the network.

Authorizations
Body
signaturestringRequired

The user's signature of the decrease liquidity message.

Pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}={2})$
poolIdstring · min: 64 · max: 66Required

The pubkey of the pool.

Pattern: ^[0-9a-fA-F]+$
positionPubKeystring · min: 64 · max: 66Required

The pubkey of the position.

Pattern: ^[0-9a-fA-F]+$
liquidityAmountstringRequired

The amount of liquidity to withdraw.

feeRateinteger · min: 1Required

The fee rate for the transaction (in sats per byte).

minToken0stringRequired

The minimum amount of the first token to withdraw.

Pattern: ^[1-9][0-9]*$
minToken1stringRequired

The minimum amount of the second token to withdraw.

Pattern: ^[1-9][0-9]*$
withdrawAddressToken0stringRequired

The address to withdraw the first token to.

withdrawAddressToken1stringRequired

The address to withdraw the second token to.

signedPsbtstringOptional

The signed PSBT in base64 format.

Pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}={2})$
runePubkeystring · min: 64 · max: 66Required

The public key of the rune address of the user initiating the request.

Pattern: ^[0-9a-fA-F]+$
paymentPubkeystring · min: 64 · max: 66Optional

The public key of the bitcoin address of the user initiating the request. If the user doesn't have a bitcoin address, the runePubkey will be used

Pattern: ^[0-9a-fA-F]+$
runeAddressstringRequired

The rune address of the user. It must be a taproot address. (P2TR). If no bitcoin address is provided, the rune address will be used for bitcoin too.

paymentAddressstringOptional

The bitcoin address of the user.

Responses
201
The Arch Network transaction ID of the liquidity decrease.
application/json
400
Pool error
application/json
401
Unauthorized
application/json
403
User not found
application/json
500
Internal Server Error
application/json
post
POST /v0/pool/decrease-liquidity HTTP/1.1
Host: api-dev.saturnbtc.io
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 305

{
  "signature": "text",
  "poolId": "text",
  "positionPubKey": "text",
  "liquidityAmount": "text",
  "feeRate": 1,
  "minToken0": "text",
  "minToken1": "text",
  "withdrawAddressToken0": "text",
  "withdrawAddressToken1": "text",
  "signedPsbt": "text",
  "runePubkey": "text",
  "paymentPubkey": "text",
  "runeAddress": "text",
  "paymentAddress": "text"
}
{
  "archTxId": "text",
  "bitcoinTxIds": [
    "text"
  ]
}