Open position

Open Position PSBT

Generates a PSBT for opening a new liquidity position by sending funds to the pool.

POSThttps://api-dev.saturnbtc.io/v0/pool/open-position/psbt
Authorization
Body

The request body containing the funding details.

token0*The first token's identifier. Must be the name of the token

The first token's identifier. Must be the name of the token.

token1*The second token's identifier. Must be the name of the token

The second token's identifier. Must be the name of the token. Usually 'sat'.

amount0*The amount of the first token to deposit

The amount of the first token to deposit.

amount1*The amount of the second token to deposit

The amount of the second token to deposit.

initializeAccountUtxo*A boolean indicating whether to initialize the account UTXO

A boolean indicating whether to initialize the account UTXO. If you're creating a new position, you should set this to true.

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

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

pubkey*The public key of the user initiating the request

The public key of the user initiating the request.

Pattern: ^[0-9a-fA-F]+$
address*string

The address of the user. If no secondary address is provided, the primary address must be a taproot address. (P2TR)

secondaryAddressstring

The secondary address of the user. Must be a taproot address. (P2TR)

Response

An object containing the PSBT (in base64 format), the fee, the list of UTXOs to sign, and optionally the created account.

Body
accountCreatedAccount (object)
psbt*string

Psbt base64 encoded to sign

fee*number

Raw fees in satoshis of the transaction

utxosToSign*array of UtxoToSign (object)

Inputs to sign

Request
const response = await fetch('https://api-dev.saturnbtc.io/v0/pool/open-position/psbt', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "token0": "text",
      "token1": "text",
      "amount0": "text",
      "amount1": "text",
      "initializeAccountUtxo": false,
      "feeRate": 0,
      "pubkey": "text",
      "address": "text"
    }),
});
const data = await response.json();
Response
{
  "account": {
    "privkey": "text",
    "pubkey": "text",
    "address": "text"
  },
  "psbt": "text",
  "fee": 0,
  "utxosToSign": [
    {
      "address": "text",
      "signingIndexes": [
        0
      ],
      "sigHash": 0,
      "utxo": "text"
    }
  ]
}

Open Position Message

Generates a message hash for opening a new liquidity position, which the user should sign.

POSThttps://api-dev.saturnbtc.io/v0/pool/open-position/message
Authorization
Body

The request body containing the position opening details.

poolId*The pubkey of the pool

The pubkey of the pool.

amount0*The amount of the first token to deposit

The amount of the first token to deposit.

amount1*The amount of the second token to deposit

The amount of the second token to deposit.

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

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

signedPsbt*The signed PSBT in base64 format

The signed PSBT in base64 format.

account*CreatedAccount (object)
pubkey*The public key of the user initiating the request

The public key of the user initiating the request.

Pattern: ^[0-9a-fA-F]+$
address*string

The address of the user. If no secondary address is provided, the primary address must be a taproot address. (P2TR)

secondaryAddressstring

The secondary address of the user. Must be a taproot address. (P2TR)

Response

A hexadecimal string representing the hash of the message to be signed by the user.

Body
string
Request
const response = await fetch('https://api-dev.saturnbtc.io/v0/pool/open-position/message', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "poolId": "text",
      "amount0": "text",
      "amount1": "text",
      "feeRate": 0,
      "signedPsbt": "text",
      "account": {
        "privkey": "text",
        "pubkey": "text",
        "address": "text"
      },
      "pubkey": "text",
      "address": "text"
    }),
});
const data = await response.json();
Response
text

Open Position

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

POSThttps://api-dev.saturnbtc.io/v0/pool/open-position
Authorization
Body

The request body containing the position opening request and signature.

signature*The user's signature of the open position message

The user's signature of the open position message.

poolId*The pubkey of the pool

The pubkey of the pool.

amount0*The amount of the first token to deposit

The amount of the first token to deposit.

amount1*The amount of the second token to deposit

The amount of the second token to deposit.

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

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

signedPsbt*The signed PSBT in base64 format

The signed PSBT in base64 format.

account*CreatedAccount (object)
pubkey*The public key of the user initiating the request

The public key of the user initiating the request.

Pattern: ^[0-9a-fA-F]+$
address*string

The address of the user. If no secondary address is provided, the primary address must be a taproot address. (P2TR)

secondaryAddressstring

The secondary address of the user. Must be a taproot address. (P2TR)

Response

The Arch Network transaction ID of the position opening.

Body
archTxId*Transaction id of the transaction in Arch

Transaction id of the transaction in Arch.

bitcoinTxIds*array of string

Some bitcoin transactions ids that we have broadcasted. The Arch Network will submit a new bitcoin transaction after these ones.

Request
const response = await fetch('https://api-dev.saturnbtc.io/v0/pool/open-position', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "signature": "text",
      "poolId": "text",
      "amount0": "text",
      "amount1": "text",
      "feeRate": 0,
      "signedPsbt": "text",
      "account": {
        "privkey": "text",
        "pubkey": "text",
        "address": "text"
      },
      "pubkey": "text",
      "address": "text"
    }),
});
const data = await response.json();
Response
{
  "archTxId": "text",
  "bitcoinTxIds": [
    "text"
  ]
}

Last updated