Skip to main content
POST
/
markets
/
creditbook
/
swap_collateral
Swap collateral
curl --request POST \
  --url https://tars.loopscale.com/v1/markets/creditbook/swap_collateral \
  --header 'Content-Type: application/json' \
  --data '{
  "loan": "<string>",
  "withdrawCollateral": [
    {
      "amount": 123,
      "collateralMint": "<string>"
    }
  ],
  "depositCollateral": [
    {
      "collateralAmount": 123,
      "collateralAssetData": {
        "Spl": {
          "mint": "<string>"
        }
      }
    }
  ],
  "cpiIxs": [
    {
      "programId": "<string>",
      "accounts": [
        {
          "pubkey": "<string>",
          "isSigner": true,
          "isWritable": true
        }
      ],
      "data": "<string>"
    }
  ],
  "cpiLuts": [
    "<string>"
  ],
  "cpiSigners": [
    "<string>"
  ]
}'
{
  "message": "<string>",
  "signatures": [
    {
      "publicKey": "<string>",
      "signature": "<string>"
    }
  ]
}

Body

application/json
loan
string
required

Loan address to modify

withdrawCollateral
object[]
required

Amount and mint of the collateral to withdraw

depositCollateral
object[]
required

Collateral to deposit after intermediate steps

cpiIxs
object[]
required

Instructions to run between withdrawal and re-deposit

cpiLuts
string[]
required

Optional Address Lookup Tables for the transaction

cpiSigners
string[]
required

Optional keypairs required to initialize accounts

Response

Single versioned transaction message and signatures

message
string
required

Base64-encoded versioned transaction message

signatures
object[]
required
I