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
}
'import requests
url = "https://tars.loopscale.com/v1/markets/creditbook/repay"
payload = {
"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
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
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
})
};
fetch('https://tars.loopscale.com/v1/markets/creditbook/repay', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://tars.loopscale.com/v1/markets/creditbook/repay",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://tars.loopscale.com/v1/markets/creditbook/repay"
payload := strings.NewReader("{\n \"loan\": \"<string>\",\n \"collateralWithdrawalParams\": [\n {\n \"amount\": 123,\n \"collateralMint\": \"<string>\"\n }\n ],\n \"repayParams\": [\n {\n \"amount\": 123,\n \"ledgerIndex\": 123,\n \"repayAll\": true\n }\n ],\n \"cpiIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"cpiLuts\": [\n \"<string>\"\n ],\n \"cpiSigners\": [\n \"<string>\"\n ],\n \"setupIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"setupLuts\": [\n \"<string>\"\n ],\n \"setupSigners\": [\n \"<string>\"\n ],\n \"unifySetup\": true,\n \"closeIfPossible\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://tars.loopscale.com/v1/markets/creditbook/repay")
.header("Content-Type", "application/json")
.body("{\n \"loan\": \"<string>\",\n \"collateralWithdrawalParams\": [\n {\n \"amount\": 123,\n \"collateralMint\": \"<string>\"\n }\n ],\n \"repayParams\": [\n {\n \"amount\": 123,\n \"ledgerIndex\": 123,\n \"repayAll\": true\n }\n ],\n \"cpiIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"cpiLuts\": [\n \"<string>\"\n ],\n \"cpiSigners\": [\n \"<string>\"\n ],\n \"setupIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"setupLuts\": [\n \"<string>\"\n ],\n \"setupSigners\": [\n \"<string>\"\n ],\n \"unifySetup\": true,\n \"closeIfPossible\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tars.loopscale.com/v1/markets/creditbook/repay")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"loan\": \"<string>\",\n \"collateralWithdrawalParams\": [\n {\n \"amount\": 123,\n \"collateralMint\": \"<string>\"\n }\n ],\n \"repayParams\": [\n {\n \"amount\": 123,\n \"ledgerIndex\": 123,\n \"repayAll\": true\n }\n ],\n \"cpiIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"cpiLuts\": [\n \"<string>\"\n ],\n \"cpiSigners\": [\n \"<string>\"\n ],\n \"setupIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"setupLuts\": [\n \"<string>\"\n ],\n \"setupSigners\": [\n \"<string>\"\n ],\n \"unifySetup\": true,\n \"closeIfPossible\": true\n}"
response = http.request(request)
puts response.read_body{
"transactions": [
{
"message": "<string>",
"signatures": [
{
"publicKey": "<string>",
"signature": "<string>"
}
]
}
],
"expectedLoanInfo": {
"loan": {
"address": "<string>"
}
}
}"Something went wrong: You have an error in your SQL syntax.""Failed to deserialize the JSON body into the target type: missing field `mints` at line 1 column 1."Repay loan
Partially or fully repay an active loan. Allows for the withdrawal of collateral for optional use in CPIs before repayment.
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
}
'import requests
url = "https://tars.loopscale.com/v1/markets/creditbook/repay"
payload = {
"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
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
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
})
};
fetch('https://tars.loopscale.com/v1/markets/creditbook/repay', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://tars.loopscale.com/v1/markets/creditbook/repay",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://tars.loopscale.com/v1/markets/creditbook/repay"
payload := strings.NewReader("{\n \"loan\": \"<string>\",\n \"collateralWithdrawalParams\": [\n {\n \"amount\": 123,\n \"collateralMint\": \"<string>\"\n }\n ],\n \"repayParams\": [\n {\n \"amount\": 123,\n \"ledgerIndex\": 123,\n \"repayAll\": true\n }\n ],\n \"cpiIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"cpiLuts\": [\n \"<string>\"\n ],\n \"cpiSigners\": [\n \"<string>\"\n ],\n \"setupIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"setupLuts\": [\n \"<string>\"\n ],\n \"setupSigners\": [\n \"<string>\"\n ],\n \"unifySetup\": true,\n \"closeIfPossible\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://tars.loopscale.com/v1/markets/creditbook/repay")
.header("Content-Type", "application/json")
.body("{\n \"loan\": \"<string>\",\n \"collateralWithdrawalParams\": [\n {\n \"amount\": 123,\n \"collateralMint\": \"<string>\"\n }\n ],\n \"repayParams\": [\n {\n \"amount\": 123,\n \"ledgerIndex\": 123,\n \"repayAll\": true\n }\n ],\n \"cpiIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"cpiLuts\": [\n \"<string>\"\n ],\n \"cpiSigners\": [\n \"<string>\"\n ],\n \"setupIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"setupLuts\": [\n \"<string>\"\n ],\n \"setupSigners\": [\n \"<string>\"\n ],\n \"unifySetup\": true,\n \"closeIfPossible\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tars.loopscale.com/v1/markets/creditbook/repay")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"loan\": \"<string>\",\n \"collateralWithdrawalParams\": [\n {\n \"amount\": 123,\n \"collateralMint\": \"<string>\"\n }\n ],\n \"repayParams\": [\n {\n \"amount\": 123,\n \"ledgerIndex\": 123,\n \"repayAll\": true\n }\n ],\n \"cpiIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"cpiLuts\": [\n \"<string>\"\n ],\n \"cpiSigners\": [\n \"<string>\"\n ],\n \"setupIxs\": [\n {\n \"programId\": \"<string>\",\n \"accounts\": [\n {\n \"pubkey\": \"<string>\",\n \"isSigner\": true,\n \"isWritable\": true\n }\n ],\n \"data\": \"<string>\"\n }\n ],\n \"setupLuts\": [\n \"<string>\"\n ],\n \"setupSigners\": [\n \"<string>\"\n ],\n \"unifySetup\": true,\n \"closeIfPossible\": true\n}"
response = http.request(request)
puts response.read_body{
"transactions": [
{
"message": "<string>",
"signatures": [
{
"publicKey": "<string>",
"signature": "<string>"
}
]
}
],
"expectedLoanInfo": {
"loan": {
"address": "<string>"
}
}
}"Something went wrong: You have an error in your SQL syntax.""Failed to deserialize the JSON body into the target type: missing field `mints` at line 1 column 1."Body
Loan address to repay
List of collateral assets to withdraw before repayment
Show child attributes
Show child attributes
List of principal repayment instructions
Show child attributes
Show child attributes
Optional CPI instructions to run between withdrawal and repayment
Show child attributes
Show child attributes
Optional list of address lookup tables
Optional list of signer keypairs
Optional instructions to execute first
Show child attributes
Show child attributes
Optional Address Lookup Tables
Optional signer keys, not including the user's own
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)
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.