Skip to main content
POST
/
markets
/
creditbook
/
repay
Repay loan
curl --request POST \
  --url https://tars.loopscale.com/v1/markets/creditbook/repay \
  --header 'Content-Type: application/json' \
  --data '{
  "loan": "<string>",
  "collateralWithdrawalParams": [
    {
      "amount": 123,
      "collateralMint": "<string>"
    }
  ],
  "repayParams": [
    {
      "amount": 123,
      "ledgerIndex": 123,
      "repayAll": true
    }
  ],
  "cpiIxs": [
    {
      "programId": "<string>",
      "accounts": [
        {
          "pubkey": "<string>",
          "isSigner": true,
          "isWritable": true
        }
      ],
      "data": "<string>"
    }
  ],
  "cpiLuts": [
    "<string>"
  ],
  "cpiSigners": [
    "<string>"
  ],
  "setupIxs": [
    {
      "programId": "<string>",
      "accounts": [
        {
          "pubkey": "<string>",
          "isSigner": true,
          "isWritable": true
        }
      ],
      "data": "<string>"
    }
  ],
  "setupLuts": [
    "<string>"
  ],
  "setupSigners": [
    "<string>"
  ],
  "unifySetup": true,
  "closeIfPossible": true
}'
{
  "transactions": [
    {
      "message": "<string>",
      "signatures": [
        {
          "publicKey": "<string>",
          "signature": "<string>"
        }
      ]
    }
  ]
}

Body

application/json
loan
string
required

Loan address to repay

collateralWithdrawalParams
object[]
required

List of collateral assets to withdraw before repayment

repayParams
object[]
required

List of principal repayment instructions

cpiIxs
object[]

Optional CPI instructions to run between withdrawal and repayment

cpiLuts
string[]

Optional list of address lookup tables

cpiSigners
string[]

Optional list of signer keypairs

setupIxs
object[]

Optional instructions to execute first

setupLuts
string[]

Optional Address Lookup Tables

setupSigners
string[]

Optional signer keys, not including the user's own

unifySetup
boolean

If true, this flag will prepend the setupIxs to the repay transaction, if false (default), this endpoint will return two transactions (Setup + Repay Loan w/ CPI)

closeIfPossible
boolean

Defaults to true. If true, this flag will append a loan close instruction if the entire loan is empty, otherwise it will skip closing and need to be handled separately.

Response

Serialized transaction message and signatures

transactions
object[]