Oracle
Verify Signed Price
Check an EIP-712 signed price against the market oracle without executing
POST
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
verify-price
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/verify-price" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"price": "105400000",
"timestamp": 1718445600,
"validUntil": 1718445900,
"signature": "0x5f1c3a9e0b7d24c68f1e3a5b7c9d0e2f4a6b8c0d1e3f5a7b9c1d3e5f7a9b0c2d4e6f8a1b3c5d7e9f0a2b4c6d8e0f1a3b5c7d9e1f3a5b7c9d0e2f4a6b8c0d1e3f1b"
}'
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/verify-price`,
{
method: 'POST',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
price: signed.price,
timestamp: signed.timestamp,
validUntil: signed.validUntil,
signature
})
}
);
const { data } = await res.json();
{
"success": true,
"data": {
"valid": true,
"signer": "0x9c1E57A2d0b34f86e7A15c9d2b4f60E38a7D4B70",
"error": null
}
}
{
"success": true,
"data": {
"valid": false,
"signer": "0x1234f9a07C6B53d81e2A4F70C9b385d6014a7E52",
"error": null
}
}
{
"success": true,
"data": {
"valid": false,
"signer": "0x0000000000000000000000000000000000000000",
"error": null
}
}
{
"success": false,
"error": {
"code": "NO_ORACLE",
"message": "No oracle configured"
}
}
Validates a signed price against the market’s oracle contract and returns the recovered signer. Nothing is submitted and no gas is spent.
Use it to confirm a signature before handing it to a borrower, or to diagnose a transaction that reverted on a price signature.
valid: true does not guarantee the price will land. The oracle’s check covers the signature, the signer, expiry and age, but not the deviation limit. It also ignores whether the signature is newer than the price the oracle holds. Inside a lending transaction, a signature dated no later than the stored price is skipped, and a price outside the deviation limit reverts the transaction.Path Parameters
string
required
Body Parameters
string
required
Price in base units as an integer string, exactly as returned by Sign Price. Decimal points are rejected.
integer
required
Signing timestamp in unix seconds. Must be a positive integer.
integer
required
Expiry in unix seconds. Must be a positive integer.
string
required
0x-prefixed hex signature.
Response Fields
object
Show child attributes
Show child attributes
boolean
Whether the oracle accepts the signature.
string
Recovered signer address, in EIP-55 checksum case rather than lowercased. The zero address when the oracle rejected the payload before recovering a signer, and
null when verification could not run.string
Reason the verification call failed, or
null on a completed check.valid: false with error: null means the oracle evaluated the signature and rejected it. valid: false with a populated error means the check itself could not run, usually an RPC failure or a signature that cannot be encoded, such as odd-length hex. These are different conditions and should be surfaced differently.Why a Signature Is Rejected
A rejection with a non-zerosigner means the signature recovered to a key that is neither an authorized signer nor the oracle’s owner. Grant it with Set Access Role and ORACLE_SIGNER, or sign with the declared price signer.
A rejection with the zero address as signer means the oracle refused before checking the key. Either validUntil has passed, timestamp is in the future or older than maxPriceAge, the price is zero, or the signature does not recover. An ORACLE-priced market rejects every signature this way, because its oracle takes no attested price. So does a FIXED market, whose oracle takes no signed price.
A signature the oracle considers valid can still be rejected at execution time if it has expired between verification and submission. Verification is a point-in-time check against validUntil.
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/verify-price" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"price": "105400000",
"timestamp": 1718445600,
"validUntil": 1718445900,
"signature": "0x5f1c3a9e0b7d24c68f1e3a5b7c9d0e2f4a6b8c0d1e3f5a7b9c1d3e5f7a9b0c2d4e6f8a1b3c5d7e9f0a2b4c6d8e0f1a3b5c7d9e1f3a5b7c9d0e2f4a6b8c0d1e3f1b"
}'
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/verify-price`,
{
method: 'POST',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
price: signed.price,
timestamp: signed.timestamp,
validUntil: signed.validUntil,
signature
})
}
);
const { data } = await res.json();
{
"success": true,
"data": {
"valid": true,
"signer": "0x9c1E57A2d0b34f86e7A15c9d2b4f60E38a7D4B70",
"error": null
}
}
{
"success": true,
"data": {
"valid": false,
"signer": "0x1234f9a07C6B53d81e2A4F70C9b385d6014a7E52",
"error": null
}
}
{
"success": true,
"data": {
"valid": false,
"signer": "0x0000000000000000000000000000000000000000",
"error": null
}
}
{
"success": false,
"error": {
"code": "NO_ORACLE",
"message": "No oracle configured"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
NO_ORACLE | 400 | The market records no oracle address. Checked before the body |
VALIDATION_ERROR | 400 | price is not an integer string, timestamp or validUntil is not a positive integer, or signature is not 0x-prefixed hex |
MISSING_MARKET_ID | 400 | marketId is longer than 100 characters |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
⌘I
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/verify-price" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"price": "105400000",
"timestamp": 1718445600,
"validUntil": 1718445900,
"signature": "0x5f1c3a9e0b7d24c68f1e3a5b7c9d0e2f4a6b8c0d1e3f5a7b9c1d3e5f7a9b0c2d4e6f8a1b3c5d7e9f0a2b4c6d8e0f1a3b5c7d9e1f3a5b7c9d0e2f4a6b8c0d1e3f1b"
}'
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/verify-price`,
{
method: 'POST',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
price: signed.price,
timestamp: signed.timestamp,
validUntil: signed.validUntil,
signature
})
}
);
const { data } = await res.json();
{
"success": true,
"data": {
"valid": true,
"signer": "0x9c1E57A2d0b34f86e7A15c9d2b4f60E38a7D4B70",
"error": null
}
}
{
"success": true,
"data": {
"valid": false,
"signer": "0x1234f9a07C6B53d81e2A4F70C9b385d6014a7E52",
"error": null
}
}
{
"success": true,
"data": {
"valid": false,
"signer": "0x0000000000000000000000000000000000000000",
"error": null
}
}
{
"success": false,
"error": {
"code": "NO_ORACLE",
"message": "No oracle configured"
}
}
