Docs / Guides
File a claim
A claim is one transaction with one outcome. The SDK builds it from the record it kept at payment time.
- Fetch through the SDK. After payment it evaluates every predicate and lists any breaches on
warranty.breaches. Ifwarranty.problemsis non-empty the response is untrusted and cannot be claimed. - Call
agent.claim(warranty)beforewarranty.claimableUntil. It uses the first breach unless you pass a predicate ID; for P1 it attaches the duplicate receipt automatically. - Read the result:
{ outcome: { paid: amount } | { rejected: "not_proven" | "not_verifiable" }, transaction }.
TypeScript
const { warranty } = await agent.fetch(url);
if (warranty && !warranty.problems.length && warranty.breaches.length) {
const result = await agent.claim(warranty, warranty.breaches[0]);
if ("paid" in result.outcome) console.log("paid", result.outcome.paid, "tx", result.transaction);
else console.log("rejected:", result.outcome.rejected);
}
// Later: const open = await agent.store.list(); // records whose claim windows are still openClaims contract
claim(predicate_id: u32, offer: SignedOffer, receipt: SignedReceipt, extra: ClaimExtra) -> Result<ClaimOutcome, ClaimError>
// extra = SecondReceipt(SignedReceipt) for P1, None otherwise
// ClaimOutcome = Paid(i128) | Rejected(1 NotProven | 2 NotVerifiable)| Fact | Detail |
|---|---|
| Who may submit | Anyone holding the evidence. The payout always goes to receipt.buyer. |
| Claim window | Starts at served_at; lasts the terms’ claim_window (at most 24 hours; at most one hour when P6 is offered). |
| Payout | min(offer.max_claim, stake remaining), also capped by the launch limit max_payout when one is set, and subject to the slash rate limit. |
| Recorded outcomes | Paid(amount) emits ClaimPaid. Rejected(NotProven | NotVerifiable) emits ClaimRejected and does not block a later valid claim for the same payment. |
| Errors (nothing recorded) | UnknownService, BadSignature, OfferMismatch, WindowClosed, AlreadyClaimed, PredicateNotOffered, NoStake, ValidatorNotSet, KeyRetired, UnsupportedVersion, SlashRateLimited. Full table in the claims reference. |
| Rate limited? | SlashRateLimited means this service already paid out 50% of its epoch-start stake in the current epoch. Retry in the next epoch if the window is still open. |
| Fees | The submitter pays the normal transaction fee, including the oracle read for P6. A rejected claim costs the fee and nothing else. |
Keep evidence: the FileReceiptStore keeps every record until its claim window closes and survives restarts. You can also call binding.submitClaim(signer, predicateId, offer, receipt, secondReceipt?) directly with evidence obtained elsewhere.