@sly-rentals/core 3.0.0 → 4.0.0

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.
@@ -30,22 +30,32 @@ export declare function computeMinimumBid(args: {
30
30
  closenessFraction: number;
31
31
  }): bigint;
32
32
  export type MinimumBid = {
33
- /** Stardust amount a challenger must bid to clear the floor. */
34
- minBidStardust: bigint;
35
- /** Stardust amount of the existing defender bid (sum of bidAtlas + bidPoints
36
- * converted via `atlasPerPoint`). 0 if no defender. */
37
- defenderBidStardust: bigint;
38
- /** Contract rate per day in stardust. */
39
- rateStardust: bigint;
40
- /** Closeness fraction at the moment of evaluation (0..1). */
41
- closenessFraction: number;
42
- /** Effective ramp multiplier applied (e.g. 4.65 for 4.65×). */
43
- rampMultiplier: number;
44
- /** Unix-second timestamp the floor was computed for (now + delaySeconds). */
45
- evaluatedAtSeconds: number;
46
- /** Active rental's end_time in unix seconds, if an active rental exists. */
47
- activeEndSeconds: number | null;
48
- /** Active rental's start_time in unix seconds, if one exists. */
49
- activeStartSeconds: number | null;
33
+ /** Minimum bid a challenger paying in ATLAS must submit as `bidAtlas`
34
+ * to clear the floor. Same unit as the on-chain field — ATLAS is
35
+ * denominated in stardust (1 ATLAS = `stardustPerAtlas` stardust). */
36
+ atlas: bigint;
37
+ /** Minimum bid a challenger paying in POINTS must submit as `bidPoints`
38
+ * to clear the floor. Same unit as the on-chain field — points-dust
39
+ * (1 point = 1e8 dust). Rounded up so the result clears the floor
40
+ * exactly; straight integer division would underbid by one dust unit
41
+ * at non-multiple boundaries and fail the on-chain `>=` check. */
42
+ points: bigint;
43
+ /** The current queued-reservation holder's bid in raw on-chain units —
44
+ * the challenger needs to clear at least these levels (or whichever
45
+ * is higher between this and the contract rate) to take the slot.
46
+ * `null` when no reservation is queued (challenger faces only the
47
+ * contract rate). Mixed-currency bids populate both fields;
48
+ * single-currency bids leave the unused field at `0n`. Presence
49
+ * (`current !== null`) is the canonical "is there an incumbent to
50
+ * outbid" check. */
51
+ current: {
52
+ atlas: bigint;
53
+ points: bigint;
54
+ } | null;
55
+ /** Unix-second timestamp the floor was evaluated for — `Math.floor(
56
+ * Date.now() / 1000) + delaySeconds`, or `nowSeconds` when supplied.
57
+ * Consumers anchor against this rather than client wall-clock so
58
+ * time-projected floors line up with the moment the math was done. */
59
+ now: number;
50
60
  };
51
61
  //# sourceMappingURL=bidMath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bidMath.d.ts","sourceRoot":"","sources":["../../../src/utils/bidMath.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,MAAM,CAYT;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IACvB;4DACwD;IACxD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,+DAA+D;IAC/D,cAAc,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,kBAAkB,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,iEAAiE;IACjE,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAAC"}
1
+ {"version":3,"file":"bidMath.d.ts","sourceRoot":"","sources":["../../../src/utils/bidMath.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,MAAM,CAYT;AAED,MAAM,MAAM,UAAU,GAAG;IACvB;;2EAEuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd;;;;uEAImE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;yBAOqB;IACrB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI,CAAC;IACT;;;2EAGuE;IACvE,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
@@ -49,8 +49,9 @@ export type ContractSnapshot = {
49
49
  * ```ts
50
50
  * const snap = await getContractSnapshot({ contractAddress: 'Abc...' });
51
51
  * const rate = snap.contract.data.rate;
52
- * const defenderBid = snap.queuedRental?.data.bidAtlas ?? 0n;
53
- * const floorNow = snap.minimumBid.minBidStardust;
52
+ * const currentBid = snap.minimumBid.current?.atlas ?? 0n;
53
+ * const floorNowAtlas = snap.minimumBid.atlas;
54
+ * const floorNowPoints = snap.minimumBid.points;
54
55
  *
55
56
  * // Project the floor 4 hours forward without re-fetching:
56
57
  * const floorLater = computeMinimumBidFromSnapshot(snap, {
@@ -1 +1 @@
1
- {"version":3,"file":"contractSnapshot.d.ts","sourceRoot":"","sources":["../../../src/utils/contractSnapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;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;;;;;;;;;GAuBG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,eAAe,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8B5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,eAAe,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA+B5B;AAUD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,EAC1C,IAAI,GAAE;IACJ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACnB,GACL,UAAU,CAqEZ;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,eAAe,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;oDACgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;+BAC2B;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;wDACoD;IACpD,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B,GAAG,OAAO,CAAC,UAAU,CAAC,CA2BtB"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.0.0";
1
+ export declare const VERSION = "4.0.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sly-rentals/core",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "TypeScript SDK for SRSLY",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",