Getting a loan offer
The loan offers are queried via our subgraph, with each individual network having it's own endpoint as outlined in the introduction of this guide
The query structure is the same across networks.
For the sake of this example let's assume we are querying the subgraph for WETH offers on mainnet.
Querying for the offers
The query below is an example to get all available commitments for WETH
These fields are required for calculating the required data for submitting the transaction through the contracts.
query getCommitmentsForWETH {
commitments(
where: {
and: [
{
collateralToken_: {
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
}
status: "Active"
expirationTimestamp_gt: "1729708565"
committedAmount_gt: "0"
}
{
}
orderBy: maxPrincipalPerCollateralAmount
orderDirection: desc
)
{
committedAmount
expirationTimestamp
maxDuration
maxPrincipalPerCollateralAmount
minAPY
collateralToken {
id
address
nftId
type
decimals
symbol
name
}
principalToken {
address
type
nftId
decimals
symbol
name
}
marketplace {
marketplaceFeePercent
}
acceptedPrincipal
maxPrincipal
forwarderAddress
}
}The response from the above query would look like this, and these values will be used for executing the loan as outlined in the next section.
API Reference
Commitment fields
Last updated