@inversealtruism/cairnx-core 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.2
4
+
5
+ - `verifyFillSpv` fails closed when any id `offerEventIds` returns cannot be proven: `provenEvent` throws,
6
+ returns null, or returns an event under another id. It used to drop that event from the grant replay, so a
7
+ seller cancel whose block read failed replayed the offer as open. New refusal text: "an event on this offer
8
+ could not be merkle-proven (<id>) - refusing, the replay would miss it"; the offer and fclaim keep their
9
+ existing texts. The site's and the wallet's io return only ids they proved, so their honest fills do not move.
10
+ - New root export `countOtherHoldsAtGrant(candidates, target, me, closed?)`: the buyer's live holds on other
11
+ offers at an fclaim's grant, the `myLiveHoldsAtGrant` count for `verifyFillSpv`. It counts only fclaims applied
12
+ before the target (height, then position in the block), distinct offers, holds live at the grant height, and
13
+ skips the `closed` set. The site and the wallet counted later fclaims too, so a buyer's fourth reservation
14
+ (denied on the cap) made every earlier granted hold unfillable. An earlier fclaim the resolver denied is still
15
+ counted (an over-count, which only refuses). It returns `HoldCount` (`{ ok: true, count }` or
16
+ `{ ok: false, reason }`, which a caller treats as unsafe). Its domain is grants at or above
17
+ `LEGACY_HOLD_SUNSET_HEIGHT` (exported, 60,044: the last legacy claim at V28 - 1 plus its window and grace);
18
+ below it a legacy SCORE_CLAIM hold can still count against the cap and the counter does not read those, so it
19
+ refuses ("this reservation was granted at <h>, before block 60044, while claims made before V28 could still
20
+ count against the cap; it cannot be checked here").
21
+ - `finalizeWinnerCheck` refuses a supplied `tip` that is not a non-negative safe integer ("the chain tip given
22
+ (<tip>) is not a block height, so the finalize window cannot be checked"). A NaN, Infinity or fractional tip
23
+ used to skip or pass both window comparisons and return safe. An omitted or null tip keeps the winner-only check.
24
+ - New root export `provenOfferRefusal(rec, { domain, height, expiresEpoch, seller })`: the admission check for a
25
+ merkle-proven offer Propose. It refuses a domain other than `cairnx:v1` ("not a cairnx:v1 Propose (domain
26
+ "<domain>")") and then returns the resolver's own creation note for every rule that needs no chain state
27
+ (v1.2 shape before activation, the V13 to V17 open CSD offer ban, a treasury payee, an expiry outside the safe
28
+ integer range or already past at the anchor, the V21 to V22 duration cap). `applyOffer` now reads those rules
29
+ from the same function (`offerEnvelopeRefusal` in `src/resolve/market.ts`), in the same order with the same
30
+ notes. The give's backing is chain state and is not checked.
31
+ - `bindOfferTerms`'s wantType leg (on by default) also binds a token want's price: for a proven token want the
32
+ served `want.ticker` and `want.amount` must equal the record's, verbatim. `provenOfferTerms` carries them as
33
+ `wantTicker` and `wantAmount`. Before, a token-priced offer served with another ticker or amount passed, and
34
+ each caller (the site, cairn-sdk `preverifyOffer`) compared the price itself. Callers opting out with
35
+ `{ give: false, wantType: false }` keep the earlier verdict.
36
+ - New root export `MAX_TOKEN_DECIMALS` (8), the bound `parseRecord` applies to a deploy's `decimals`; the parser
37
+ reads it, so a consumer validating a served token's decimals uses the same number.
38
+ - `resolve()` and canonical state are byte-identical to 0.2.1.
39
+
40
+ ## 0.2.1
41
+
42
+ - Internal split, no behaviour change: `src/resolve.ts` keeps the replay loop and dispatches each record to
43
+ handlers in `src/resolve/` (tokens, names, market, attest) over one shared state context. The exported names
44
+ and their types are unchanged, and `resolve()` returns the same state, event log included, for the same input.
45
+ Every consumer may stay on 0.2.0.
46
+
3
47
  ## 0.2.0
4
48
 
5
49
  Breaking for callers that hand-build `ProvenOfferTerms` or rely on the old two-argument verdict; see Migration.