Rates and Loan Terms
Set Allow Extension
Switch the maturity extension flow on or off for a market
POST
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
allow-extension
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/allow-extension" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "allowed": true }'
const url = `https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/allow-extension`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const build = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ allowed: true }) });
const { data: calldata } = await build.json();
const tx = await adminWallet.sendTransaction({
to: calldata.to,
data: calldata.data,
value: calldata.value,
chainId: calldata.chainId
});
await tx.wait();
await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x..."
},
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"functionName": "setAllowExtension",
"requiredRole": "DEFAULT_ADMIN_ROLE",
"requiredSigner": null,
"heldByThisInstance": false,
"signerAddress": null,
"note": "No wallet registered on this instance holds DEFAULT_ADMIN_ROLE on this market, so a transaction signed here reverts NotAuthorized. The wallet the lender of record placed that role with must sign it.",
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/markets/clx_secmarket_001/allow-extension",
"field": "txHash"
},
"chainId": 11155111,
"value": "0"
}
}
{
"success": true,
"data": {
"txHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"functionName": "setAllowExtension",
"signedBy": "0x7712db30a7b4ffd9c445793089118b60e56d752a",
"blockNumber": 6789012,
"offering": {
"maxLoanDuration": "15552000",
"termGracePeriod": "259200",
"terminalDueDate": null,
"termPenalty": "200",
"marketDueFloor": null,
"allowExtension": true,
"rateMode": "CURVE",
"rateFloor": "0",
"rateCap": "0",
"maxFixedRate": null,
"reserveRatio": "0",
"operatorShare": "800"
},
"updatedColumns": ["allowExtension"]
}
}
Builds the
Confirming with
setAllowExtension transaction, the master switch over maturity extensions. Requires DEFAULT_ADMIN_ROLE on the market, held by the admin the lender of record named at adoption. The market’s creator never holds that role, so extensions exist on a market only when its lender of record chooses to offer them.
An extension moves a maturity the borrower signed, and it needs no signature from the borrower. Switch the flow on only where the lender of record’s terms of use provide for extensions.
With the switch off, no extension can be proposed, confirmed or applied, while an open proposal can still be cancelled. Switching it off withdraws nothing: open proposals stay on the market, and a confirmed batch can be applied again once the switch is back on. See Propose Extension for the flow itself.
Path Parameters
string
required
Body Parameters
boolean
required
true to switch extensions on, false to switch them off.string
Hash of the transaction you broadcast for this operation. Send it to confirm the transaction and record the result. Omit it to receive the calldata. When
txHash is present, every other field is ignored.Confirm the Change
Send the mined hash back to this path as{ "txHash": "0x..." }. The API checks that the transaction called setAllowExtension on the market. It then reads the offering back from the chain and updates the market record. Confirm Extension Transaction also accepts this transaction.
Response Fields
The calldata response carries the transaction twice.transaction holds to and data. The same to and data also sit directly on data, and that is where the chainId and value binding lands, so sign from those four fields.
object
Show child attributes
Show child attributes
string
SIGN_TRANSACTION. Returned when txHash is omitted.object
{ to, data } for the setAllowExtension call on the market. Returned when txHash is omitted.string
The market address. Returned when
txHash is omitted.string
The encoded
setAllowExtension call. Returned when txHash is omitted.string
Always
"0". Returned when txHash is omitted.integer
The chain your instance resolves to. Returned when
txHash is omitted.string
setAllowExtension, or the verified function when confirming.string
DEFAULT_ADMIN_ROLE. Returned when txHash is omitted.string
Plain-language summary of the change. Returned when
txHash is omitted.string
Always
null here: the signer is whoever holds DEFAULT_ADMIN_ROLE, not one fixed address. Returned when txHash is omitted.boolean
true when a verified wallet of your instance holds DEFAULT_ADMIN_ROLE, false when none does, null when the check could not be completed. The build is never refused on it. Returned when txHash is omitted.string
The wallet of your instance that holds
DEFAULT_ADMIN_ROLE, or null. Returned when txHash is omitted.string
What to do when your instance cannot sign: the wallet the lender of record placed the role with must sign, because the market reverts the call from any other wallet.
null when your instance can sign. Returned when txHash is omitted.object
{ endpoint, field }: the call that confirms this transaction, and the body field that carries the hash. Returned when txHash is omitted.string
Transaction hash. Returned when confirming.
string
The wallet that sent the transaction. Returned when confirming.
integer
Block the transaction was mined in. Returned when confirming.
object
The market’s rate and term offering, read back from the chain after the transaction, with
allowExtension among its fields. The same object Set Rate Mode returns. Returned when confirming.array
Names of the stored market fields this confirmation changed. Returned when confirming.
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/allow-extension" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "allowed": true }'
const url = `https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/allow-extension`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const build = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ allowed: true }) });
const { data: calldata } = await build.json();
const tx = await adminWallet.sendTransaction({
to: calldata.to,
data: calldata.data,
value: calldata.value,
chainId: calldata.chainId
});
await tx.wait();
await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x..."
},
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"functionName": "setAllowExtension",
"requiredRole": "DEFAULT_ADMIN_ROLE",
"requiredSigner": null,
"heldByThisInstance": false,
"signerAddress": null,
"note": "No wallet registered on this instance holds DEFAULT_ADMIN_ROLE on this market, so a transaction signed here reverts NotAuthorized. The wallet the lender of record placed that role with must sign it.",
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/markets/clx_secmarket_001/allow-extension",
"field": "txHash"
},
"chainId": 11155111,
"value": "0"
}
}
{
"success": true,
"data": {
"txHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"functionName": "setAllowExtension",
"signedBy": "0x7712db30a7b4ffd9c445793089118b60e56d752a",
"blockNumber": 6789012,
"offering": {
"maxLoanDuration": "15552000",
"termGracePeriod": "259200",
"terminalDueDate": null,
"termPenalty": "200",
"marketDueFloor": null,
"allowExtension": true,
"rateMode": "CURVE",
"rateFloor": "0",
"rateCap": "0",
"maxFixedRate": null,
"reserveRatio": "0",
"operatorShare": "800"
},
"updatedColumns": ["allowExtension"]
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
MISSING_MARKET_ID | 400 | The marketId path segment is longer than 100 characters |
VALIDATION_ERROR | 400 | allowed is missing or not a boolean, or txHash is malformed |
INVALID_CONFIRMATION | 400 | The market has no on-chain address, so there is nothing to confirm against |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
MARKET_PENDING_CURATOR | 409 | The market has no lender of record yet, so nobody holds DEFAULT_ADMIN_ROLE. Skipped when confirming with txHash |
INTERNAL_ERROR | 500 | The chain could not be read while confirming. Retry shortly |
txHash can also return any transaction verification error.⌘I
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/allow-extension" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "allowed": true }'
const url = `https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/allow-extension`;
const headers = { 'X-API-Key': 'trusset_your_key_here', 'Content-Type': 'application/json' };
const build = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ allowed: true }) });
const { data: calldata } = await build.json();
const tx = await adminWallet.sendTransaction({
to: calldata.to,
data: calldata.data,
value: calldata.value,
chainId: calldata.chainId
});
await tx.wait();
await fetch(url, { method: 'POST', headers, body: JSON.stringify({ txHash: tx.hash }) });
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x..."
},
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"functionName": "setAllowExtension",
"requiredRole": "DEFAULT_ADMIN_ROLE",
"requiredSigner": null,
"heldByThisInstance": false,
"signerAddress": null,
"note": "No wallet registered on this instance holds DEFAULT_ADMIN_ROLE on this market, so a transaction signed here reverts NotAuthorized. The wallet the lender of record placed that role with must sign it.",
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/markets/clx_secmarket_001/allow-extension",
"field": "txHash"
},
"chainId": 11155111,
"value": "0"
}
}
{
"success": true,
"data": {
"txHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"functionName": "setAllowExtension",
"signedBy": "0x7712db30a7b4ffd9c445793089118b60e56d752a",
"blockNumber": 6789012,
"offering": {
"maxLoanDuration": "15552000",
"termGracePeriod": "259200",
"terminalDueDate": null,
"termPenalty": "200",
"marketDueFloor": null,
"allowExtension": true,
"rateMode": "CURVE",
"rateFloor": "0",
"rateCap": "0",
"maxFixedRate": null,
"reserveRatio": "0",
"operatorShare": "800"
},
"updatedColumns": ["allowExtension"]
}
}
