Loan Approvals
Get Loan Approvals
Read whether a market runs approve-only loans
GET
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
loan-approvals
Get Loan Approvals
curl --request GET \
--url https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals \
--header 'x-api-key: <api-key>'import requests
url = "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals', 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://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"mode": {
"supported": true,
"available": true,
"enabled": true,
"requested": false,
"approvals": "0x5d2e8c1a7f4b3960e2d1c8a7b6f5e4d3c2b1a098",
"canonical": true,
"upgradeRequired": false,
"approverRole": "0x46f54e51673dd785402ec1df75a85f2b1da1abc02695cc95d95578f830f58153",
"maxValidHours": 696,
"viewer": {
"isBank": true,
"isAdmin": true,
"approverWallets": [
"0x7712db30a7b4ffd9c445793089118b60e56d752a"
]
}
},
"marketId": "cmwfk2h7x0003jw9w4q8b2n1c"
},
"error": null
}
{
"success": true,
"data": {
"mode": {
"supported": true,
"available": true,
"enabled": false,
"requested": true,
"approvals": null,
"canonical": null,
"upgradeRequired": false,
"approverRole": "0x46f54e51673dd785402ec1df75a85f2b1da1abc02695cc95d95578f830f58153",
"maxValidHours": 696,
"viewer": {
"isBank": true,
"isAdmin": true,
"approverWallets": [
"0x7712db30a7b4ffd9c445793089118b60e56d752a"
]
}
},
"marketId": "cmwfk2h7x0003jw9w4q8b2n1c"
},
"error": null
}
Returns the market’s approve-only loans mode: whether the switch exists on this market and network, whether it is on, and what your instance may do.
Path Parameters
Response Fields
Show child attributes
Show child attributes
false means the market runs an implementation from before this feature. Its admin has to upgrade it through the seven-day notice first.true means the market’s creator asked for approve-only loans at deployment and the lender of record has not switched them on yet.false means the market names an approvals contract that the Trusset approvals factory did not build. Loan requests, approvals and revokes are not available for such a contract. Open Loan and Borrow More still read it when they can.The
LOAN_APPROVER_ROLE identifier: keccak256 of LOAN_APPROVER_ROLE. Grant it with the market’s own grantRole.{
"success": true,
"data": {
"mode": {
"supported": true,
"available": true,
"enabled": true,
"requested": false,
"approvals": "0x5d2e8c1a7f4b3960e2d1c8a7b6f5e4d3c2b1a098",
"canonical": true,
"upgradeRequired": false,
"approverRole": "0x46f54e51673dd785402ec1df75a85f2b1da1abc02695cc95d95578f830f58153",
"maxValidHours": 696,
"viewer": {
"isBank": true,
"isAdmin": true,
"approverWallets": [
"0x7712db30a7b4ffd9c445793089118b60e56d752a"
]
}
},
"marketId": "cmwfk2h7x0003jw9w4q8b2n1c"
},
"error": null
}
{
"success": true,
"data": {
"mode": {
"supported": true,
"available": true,
"enabled": false,
"requested": true,
"approvals": null,
"canonical": null,
"upgradeRequired": false,
"approverRole": "0x46f54e51673dd785402ec1df75a85f2b1da1abc02695cc95d95578f830f58153",
"maxValidHours": 696,
"viewer": {
"isBank": true,
"isAdmin": true,
"approverWallets": [
"0x7712db30a7b4ffd9c445793089118b60e56d752a"
]
}
},
"marketId": "cmwfk2h7x0003jw9w4q8b2n1c"
},
"error": null
}
⌘I
Get Loan Approvals
curl --request GET \
--url https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals \
--header 'x-api-key: <api-key>'import requests
url = "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals', 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://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/loan-approvals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"mode": {
"supported": true,
"available": true,
"enabled": true,
"requested": false,
"approvals": "0x5d2e8c1a7f4b3960e2d1c8a7b6f5e4d3c2b1a098",
"canonical": true,
"upgradeRequired": false,
"approverRole": "0x46f54e51673dd785402ec1df75a85f2b1da1abc02695cc95d95578f830f58153",
"maxValidHours": 696,
"viewer": {
"isBank": true,
"isAdmin": true,
"approverWallets": [
"0x7712db30a7b4ffd9c445793089118b60e56d752a"
]
}
},
"marketId": "cmwfk2h7x0003jw9w4q8b2n1c"
},
"error": null
}
{
"success": true,
"data": {
"mode": {
"supported": true,
"available": true,
"enabled": false,
"requested": true,
"approvals": null,
"canonical": null,
"upgradeRequired": false,
"approverRole": "0x46f54e51673dd785402ec1df75a85f2b1da1abc02695cc95d95578f830f58153",
"maxValidHours": 696,
"viewer": {
"isBank": true,
"isAdmin": true,
"approverWallets": [
"0x7712db30a7b4ffd9c445793089118b60e56d752a"
]
}
},
"marketId": "cmwfk2h7x0003jw9w4q8b2n1c"
},
"error": null
}
