@sly-rentals/core 1.2.0 → 2.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.
- package/dist/api.json +9946 -8876
- package/dist/cjs/calculator/ContestTimeline.js +396 -0
- package/dist/cjs/calculator/ContestTimeline.js.map +1 -0
- package/dist/cjs/calculator/MinBidChart.js +419 -0
- package/dist/cjs/calculator/MinBidChart.js.map +1 -0
- package/dist/cjs/calculator/dom.js +39 -0
- package/dist/cjs/calculator/dom.js.map +1 -0
- package/dist/cjs/calculator/emitter.js +36 -0
- package/dist/cjs/calculator/emitter.js.map +1 -0
- package/dist/cjs/calculator/index.js +20 -0
- package/dist/cjs/calculator/index.js.map +1 -0
- package/dist/cjs/cost/constants.js +54 -5
- package/dist/cjs/cost/constants.js.map +1 -1
- package/dist/cjs/cost/estimate.js +7 -4
- package/dist/cjs/cost/estimate.js.map +1 -1
- package/dist/cjs/cost/estimate.test.js +16 -4
- package/dist/cjs/cost/estimate.test.js.map +1 -1
- package/dist/cjs/cost/index.js +32 -17
- package/dist/cjs/cost/index.js.map +1 -1
- package/dist/cjs/cost/sizes.js +20 -3
- package/dist/cjs/cost/sizes.js.map +1 -1
- package/dist/cjs/instructions/closeContract.js +3 -37
- package/dist/cjs/instructions/closeContract.js.map +1 -1
- package/dist/cjs/instructions/createContract.js +2 -4
- package/dist/cjs/instructions/createContract.js.map +1 -1
- package/dist/cjs/instructions/createContractThread.js +1 -2
- package/dist/cjs/instructions/createContractThread.js.map +1 -1
- package/dist/cjs/instructions/index.js +65 -42
- package/dist/cjs/instructions/index.js.map +1 -1
- package/dist/cjs/kit/index.js +5 -27
- package/dist/cjs/kit/index.js.map +1 -1
- package/dist/cjs/legacy/index.js +5 -3
- package/dist/cjs/legacy/index.js.map +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/react/ContestTimeline.js +59 -0
- package/dist/cjs/react/ContestTimeline.js.map +1 -0
- package/dist/cjs/react/MinBidChart.js +34 -0
- package/dist/cjs/react/MinBidChart.js.map +1 -0
- package/dist/cjs/react/index.js +18 -0
- package/dist/cjs/react/index.js.map +1 -0
- package/dist/cjs/utils/contestChain.js +199 -0
- package/dist/cjs/utils/contestChain.js.map +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/calculator/ContestTimeline.js +392 -0
- package/dist/esm/calculator/ContestTimeline.js.map +1 -0
- package/dist/esm/calculator/MinBidChart.js +412 -0
- package/dist/esm/calculator/MinBidChart.js.map +1 -0
- package/dist/esm/calculator/dom.js +35 -0
- package/dist/esm/calculator/dom.js.map +1 -0
- package/dist/esm/calculator/emitter.js +32 -0
- package/dist/esm/calculator/emitter.js.map +1 -0
- package/dist/esm/calculator/index.js +13 -0
- package/dist/esm/calculator/index.js.map +1 -0
- package/dist/esm/cost/constants.js +52 -4
- package/dist/esm/cost/constants.js.map +1 -1
- package/dist/esm/cost/estimate.js +9 -6
- package/dist/esm/cost/estimate.js.map +1 -1
- package/dist/esm/cost/estimate.test.js +18 -6
- package/dist/esm/cost/estimate.test.js.map +1 -1
- package/dist/esm/cost/index.js +13 -3
- package/dist/esm/cost/index.js.map +1 -1
- package/dist/esm/cost/sizes.js +19 -2
- package/dist/esm/cost/sizes.js.map +1 -1
- package/dist/esm/instructions/closeContract.js +1 -2
- package/dist/esm/instructions/closeContract.js.map +1 -1
- package/dist/esm/instructions/createContract.js +2 -4
- package/dist/esm/instructions/createContract.js.map +1 -1
- package/dist/esm/instructions/createContractThread.js +2 -3
- package/dist/esm/instructions/createContractThread.js.map +1 -1
- package/dist/esm/instructions/index.js +36 -28
- package/dist/esm/instructions/index.js.map +1 -1
- package/dist/esm/kit/index.js +4 -4
- package/dist/esm/kit/index.js.map +1 -1
- package/dist/esm/legacy/index.js +4 -2
- package/dist/esm/legacy/index.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/react/ContestTimeline.js +56 -0
- package/dist/esm/react/ContestTimeline.js.map +1 -0
- package/dist/esm/react/MinBidChart.js +30 -0
- package/dist/esm/react/MinBidChart.js.map +1 -0
- package/dist/esm/react/index.js +12 -0
- package/dist/esm/react/index.js.map +1 -0
- package/dist/esm/utils/contestChain.js +191 -0
- package/dist/esm/utils/contestChain.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/calculator/ContestTimeline.d.ts +69 -0
- package/dist/types/calculator/ContestTimeline.d.ts.map +1 -0
- package/dist/types/calculator/MinBidChart.d.ts +73 -0
- package/dist/types/calculator/MinBidChart.d.ts.map +1 -0
- package/dist/types/calculator/dom.d.ts +16 -0
- package/dist/types/calculator/dom.d.ts.map +1 -0
- package/dist/types/calculator/emitter.d.ts +13 -0
- package/dist/types/calculator/emitter.d.ts.map +1 -0
- package/dist/types/calculator/index.d.ts +13 -0
- package/dist/types/calculator/index.d.ts.map +1 -0
- package/dist/types/cost/constants.d.ts +49 -4
- package/dist/types/cost/constants.d.ts.map +1 -1
- package/dist/types/cost/estimate.d.ts +12 -1
- package/dist/types/cost/estimate.d.ts.map +1 -1
- package/dist/types/cost/index.d.ts +13 -3
- package/dist/types/cost/index.d.ts.map +1 -1
- package/dist/types/cost/sizes.d.ts +19 -2
- package/dist/types/cost/sizes.d.ts.map +1 -1
- package/dist/types/instructions/closeContract.d.ts.map +1 -1
- package/dist/types/instructions/createContract.d.ts.map +1 -1
- package/dist/types/instructions/index.d.ts +36 -28
- package/dist/types/instructions/index.d.ts.map +1 -1
- package/dist/types/kit/index.d.ts +0 -2
- package/dist/types/kit/index.d.ts.map +1 -1
- package/dist/types/legacy/index.d.ts +0 -2
- package/dist/types/legacy/index.d.ts.map +1 -1
- package/dist/types/react/ContestTimeline.d.ts +17 -0
- package/dist/types/react/ContestTimeline.d.ts.map +1 -0
- package/dist/types/react/MinBidChart.d.ts +12 -0
- package/dist/types/react/MinBidChart.d.ts.map +1 -0
- package/dist/types/react/index.d.ts +12 -0
- package/dist/types/react/index.d.ts.map +1 -0
- package/dist/types/utils/contestChain.d.ts +118 -0
- package/dist/types/utils/contestChain.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +15 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Pure-math chain-of-contests simulator.
|
|
3
|
+
*
|
|
4
|
+
* Walks a sequence of reservation events (calc defender + user-added
|
|
5
|
+
* takeovers) and produces per-row floor / bonus / owner-take values
|
|
6
|
+
* plus the segment breakdown UIs use to render piecewise curves.
|
|
7
|
+
*
|
|
8
|
+
* No React, no IO, no RPC. Feeds a calculator/visualization layer
|
|
9
|
+
* (`@sly-rentals/core/react/calculator`) but is callable standalone
|
|
10
|
+
* from any environment.
|
|
11
|
+
*/
|
|
12
|
+
import { computeMinimumBid } from './bidMath';
|
|
13
|
+
function clamp(n, lo, hi) {
|
|
14
|
+
return Math.max(lo, Math.min(hi, n));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Convert a stardust value into the caller's display currency.
|
|
18
|
+
*
|
|
19
|
+
* ATLAS: stardust / stardustPerAtlas.
|
|
20
|
+
* POINTS: stardust / (stardustPerAtlas × atlasPerPoint), with a
|
|
21
|
+
* min-capture floor since the on-chain threshold rejects sub-floor bids.
|
|
22
|
+
*/
|
|
23
|
+
export function stardustToDisplay(stardust, cur, stardustPerAtlas, atlasPerPoint, minCaptureThresholdPoints) {
|
|
24
|
+
const atlas = Number(stardust) / stardustPerAtlas;
|
|
25
|
+
if (cur === 'ATLAS')
|
|
26
|
+
return atlas;
|
|
27
|
+
return Math.max(atlas / atlasPerPoint, minCaptureThresholdPoints);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Walk a chain of contest events and produce per-contest math + segment
|
|
31
|
+
* breakdown.
|
|
32
|
+
*
|
|
33
|
+
* The chain begins with an optional calc defender row (the simulator's
|
|
34
|
+
* "your bid" entry). Subsequent takeover knobs are computed via
|
|
35
|
+
* `computeMinimumBid` against the previous row's bid.
|
|
36
|
+
*
|
|
37
|
+
* v1 assumes same-currency ATLAS knockoffs; tier-upgrade compensation
|
|
38
|
+
* is not modeled.
|
|
39
|
+
*/
|
|
40
|
+
export function computeContestChain(args) {
|
|
41
|
+
const { cfg, rateStardust, activeDays, userDefender, takeoverKnobs, displayCur, stardustPerAtlas, atlasPerPoint, minCaptureThresholdPoints, contestedThreshold, contestedCountStart, } = args;
|
|
42
|
+
const safeSpan = Math.max(0.0001, activeDays);
|
|
43
|
+
const sorted = [...takeoverKnobs].sort((a, b) => a.atDay - b.atDay);
|
|
44
|
+
const rows = [];
|
|
45
|
+
const segments = [];
|
|
46
|
+
const toDisplay = (s) => stardustToDisplay(s, displayCur, stardustPerAtlas, atlasPerPoint, minCaptureThresholdPoints);
|
|
47
|
+
const callMinBid = (closeness, defenderBidStardust) => computeMinimumBid({
|
|
48
|
+
rateStardust,
|
|
49
|
+
defenderBidStardust,
|
|
50
|
+
contestedMultiplierMaxBps: cfg.contestedMultiplierMaxBps,
|
|
51
|
+
captureRateBps: cfg.captureRateBps,
|
|
52
|
+
closenessFraction: closeness,
|
|
53
|
+
});
|
|
54
|
+
const tmp = [];
|
|
55
|
+
if (userDefender) {
|
|
56
|
+
tmp.push({
|
|
57
|
+
id: '__calc',
|
|
58
|
+
atDay: userDefender.atDay,
|
|
59
|
+
bidStardust: userDefender.bidStardust,
|
|
60
|
+
bidDisplay: toDisplay(userDefender.bidStardust),
|
|
61
|
+
defenderBidStardust: 0n,
|
|
62
|
+
defenderAtDay: 0,
|
|
63
|
+
source: 'calc',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const firstEventAt = tmp[0]?.atDay ?? 0;
|
|
67
|
+
if (firstEventAt > 0) {
|
|
68
|
+
segments.push({
|
|
69
|
+
startDay: 0,
|
|
70
|
+
endDay: firstEventAt,
|
|
71
|
+
defenderBidStardust: 0n,
|
|
72
|
+
hasDefender: false,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
let cursorBid = userDefender?.bidStardust ?? 0n;
|
|
76
|
+
let cursorAt = userDefender?.atDay ?? 0;
|
|
77
|
+
for (const k of sorted) {
|
|
78
|
+
segments.push({
|
|
79
|
+
startDay: cursorAt,
|
|
80
|
+
endDay: k.atDay,
|
|
81
|
+
defenderBidStardust: cursorBid,
|
|
82
|
+
hasDefender: true,
|
|
83
|
+
});
|
|
84
|
+
const closeness = clamp(k.atDay / safeSpan, 0, 1);
|
|
85
|
+
const floor = callMinBid(closeness, cursorBid);
|
|
86
|
+
tmp.push({
|
|
87
|
+
id: k.id,
|
|
88
|
+
atDay: k.atDay,
|
|
89
|
+
bidStardust: floor,
|
|
90
|
+
bidDisplay: toDisplay(floor),
|
|
91
|
+
defenderBidStardust: cursorBid,
|
|
92
|
+
defenderAtDay: cursorAt,
|
|
93
|
+
source: 'knob',
|
|
94
|
+
});
|
|
95
|
+
cursorBid = floor;
|
|
96
|
+
cursorAt = k.atDay;
|
|
97
|
+
}
|
|
98
|
+
if (tmp.length > 0) {
|
|
99
|
+
segments.push({
|
|
100
|
+
startDay: cursorAt,
|
|
101
|
+
endDay: activeDays,
|
|
102
|
+
defenderBidStardust: cursorBid,
|
|
103
|
+
hasDefender: true,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// Bonus multiplier — config knob, scales the same-cur knockoff bonus.
|
|
107
|
+
// 100 bps = 1× = no-op (current on-chain formula).
|
|
108
|
+
// TODO(bonus_multiplier_bps): drop the `?? 100` fallback once the
|
|
109
|
+
// on-chain field is guaranteed present.
|
|
110
|
+
const bonusMult = (cfg.bonusMultiplierBps ?? 100) / 100;
|
|
111
|
+
const bonusByIdx = tmp.map((_, i) => {
|
|
112
|
+
const next = tmp[i + 1];
|
|
113
|
+
if (!next)
|
|
114
|
+
return 0;
|
|
115
|
+
const closeness = clamp((next.atDay - tmp[i].atDay) / safeSpan, 0, 1);
|
|
116
|
+
const raw = Math.max(0, (next.bidDisplay - tmp[i].bidDisplay) * closeness * bonusMult);
|
|
117
|
+
// Match on-chain `b.min(bid_atlas)` — bonus capped at challenger's bid.
|
|
118
|
+
return Math.min(next.bidDisplay, raw);
|
|
119
|
+
});
|
|
120
|
+
// Owner-take is realized only by the LAST contester in the chain — every
|
|
121
|
+
// earlier contester gets their bid back as refund when outbid, plus a
|
|
122
|
+
// bonus from the next challenger's bid. Net contract escrow at end of
|
|
123
|
+
// chain = bid_last − Σ bonuses paid across the chain (the deficit on
|
|
124
|
+
// each refund is covered by the next challenger's bid). Intermediate
|
|
125
|
+
// rows therefore contribute 0 to owner take.
|
|
126
|
+
const totalBonusForOwner = bonusByIdx.reduce((acc, b) => acc + b, 0);
|
|
127
|
+
const lastIdx = tmp.length - 1;
|
|
128
|
+
let contestedCount = contestedCountStart;
|
|
129
|
+
let bumpFlagged = false;
|
|
130
|
+
for (let i = 0; i < tmp.length; i++) {
|
|
131
|
+
const t = tmp[i];
|
|
132
|
+
const bonusEarned = bonusByIdx[i];
|
|
133
|
+
const ownerTake = i === lastIdx ? Math.max(0, t.bidDisplay - totalBonusForOwner) : 0;
|
|
134
|
+
contestedCount = contestedCount + 1;
|
|
135
|
+
const isInitial = i === 0;
|
|
136
|
+
const triggersRateBump = !bumpFlagged && contestedThreshold > 0 && contestedCount >= contestedThreshold && !isInitial;
|
|
137
|
+
if (triggersRateBump)
|
|
138
|
+
bumpFlagged = true;
|
|
139
|
+
rows.push({
|
|
140
|
+
id: t.id,
|
|
141
|
+
idx: i + 1,
|
|
142
|
+
atDay: t.atDay,
|
|
143
|
+
floorStardust: t.bidStardust,
|
|
144
|
+
floorDisplay: t.bidDisplay,
|
|
145
|
+
bonusDisplay: bonusEarned,
|
|
146
|
+
ownerTakeDisplay: ownerTake,
|
|
147
|
+
defenderBidStardust: t.defenderBidStardust,
|
|
148
|
+
defenderAtDay: t.defenderAtDay,
|
|
149
|
+
source: t.source,
|
|
150
|
+
isInitial,
|
|
151
|
+
contestedCountAfter: contestedCount,
|
|
152
|
+
triggersRateBump,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
const baselineAtlas = (Number(rateStardust) / stardustPerAtlas) * activeDays;
|
|
156
|
+
const baselineDisplay = displayCur === 'ATLAS'
|
|
157
|
+
? baselineAtlas
|
|
158
|
+
: Math.max(baselineAtlas / atlasPerPoint, minCaptureThresholdPoints);
|
|
159
|
+
const totalOwnerDisplay = rows.reduce((acc, r) => acc + r.ownerTakeDisplay, 0);
|
|
160
|
+
const totalBonusDisplay = rows.reduce((acc, r) => acc + r.bonusDisplay, 0);
|
|
161
|
+
const multiplier = baselineDisplay > 0 ? totalOwnerDisplay / baselineDisplay : 0;
|
|
162
|
+
return {
|
|
163
|
+
segments,
|
|
164
|
+
rows,
|
|
165
|
+
totalOwnerDisplay,
|
|
166
|
+
totalBonusDisplay,
|
|
167
|
+
baselineDisplay,
|
|
168
|
+
multiplier,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/** Even spacing across [from, to] excluding endpoints. */
|
|
172
|
+
export function distributeEven(count, from, to) {
|
|
173
|
+
if (count <= 0 || to <= from)
|
|
174
|
+
return [];
|
|
175
|
+
const step = (to - from) / (count + 1);
|
|
176
|
+
return Array.from({ length: count }, (_, i) => from + step * (i + 1));
|
|
177
|
+
}
|
|
178
|
+
/** Quadratic bias toward `to` — clusters knobs near the snipe window. */
|
|
179
|
+
export function distributeSnipeHeavy(count, from, to) {
|
|
180
|
+
if (count <= 0 || to <= from)
|
|
181
|
+
return [];
|
|
182
|
+
const span = to - from;
|
|
183
|
+
return Array.from({ length: count }, (_, i) => {
|
|
184
|
+
const t = (i + 1) / (count + 1);
|
|
185
|
+
const skewed = 1 - Math.pow(1 - t, 2);
|
|
186
|
+
return from + span * skewed;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
let knobCounter = 0;
|
|
190
|
+
export const nextKnobId = () => `k${++knobCounter}`;
|
|
191
|
+
//# sourceMappingURL=contestChain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contestChain.js","sourceRoot":"","sources":["../../../src/utils/contestChain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.js
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Vanilla multi-contest simulator (slider strip + table + totals)
|
|
3
|
+
* for the SRSLY reservation calculator. Class-based lifecycle with an
|
|
4
|
+
* event emitter replacing React callback props. The React component at
|
|
5
|
+
* `@sly-rentals/core/react/ContestTimeline` is a thin wrapper that pipes
|
|
6
|
+
* emitter events to its callback props.
|
|
7
|
+
*/
|
|
8
|
+
import { type ContestChain, type ContestKnob, type Cur } from '../utils';
|
|
9
|
+
export interface ContestTimelineClassNames {
|
|
10
|
+
root?: string;
|
|
11
|
+
head?: string;
|
|
12
|
+
controls?: string;
|
|
13
|
+
strip?: string;
|
|
14
|
+
track?: string;
|
|
15
|
+
knob?: string;
|
|
16
|
+
table?: string;
|
|
17
|
+
totals?: string;
|
|
18
|
+
empty?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ContestTimelineProps {
|
|
21
|
+
activeDays: number;
|
|
22
|
+
nowDay?: number;
|
|
23
|
+
challengeCur: Cur;
|
|
24
|
+
knobs: ContestKnob[];
|
|
25
|
+
chain: ContestChain;
|
|
26
|
+
preset: 'even' | 'snipe' | 'custom';
|
|
27
|
+
chainDefenderExists: boolean;
|
|
28
|
+
classNames?: ContestTimelineClassNames;
|
|
29
|
+
}
|
|
30
|
+
export type ContestTimelineEvents = {
|
|
31
|
+
knobsChange: (next: ContestKnob[]) => void;
|
|
32
|
+
presetChange: (next: 'even' | 'snipe' | 'custom') => void;
|
|
33
|
+
calcDefenderAtDayChange: (atDay: number) => void;
|
|
34
|
+
};
|
|
35
|
+
export declare class ContestTimeline {
|
|
36
|
+
private readonly container;
|
|
37
|
+
private readonly emitter;
|
|
38
|
+
private props;
|
|
39
|
+
private readonly root;
|
|
40
|
+
private readonly controls;
|
|
41
|
+
private readonly strip;
|
|
42
|
+
private readonly track;
|
|
43
|
+
private readonly legend;
|
|
44
|
+
private readonly tableBody;
|
|
45
|
+
private readonly totals;
|
|
46
|
+
private readonly empty;
|
|
47
|
+
private dragState;
|
|
48
|
+
constructor(container: HTMLElement, props: ContestTimelineProps);
|
|
49
|
+
on<K extends keyof ContestTimelineEvents>(event: K, handler: ContestTimelineEvents[K]): () => void;
|
|
50
|
+
update(next: Partial<ContestTimelineProps>): void;
|
|
51
|
+
destroy(): void;
|
|
52
|
+
private get xStart();
|
|
53
|
+
private get xSpan();
|
|
54
|
+
private get startFloor();
|
|
55
|
+
private pct;
|
|
56
|
+
private applyPreset;
|
|
57
|
+
private setCount;
|
|
58
|
+
private renderControls;
|
|
59
|
+
private renderStrip;
|
|
60
|
+
private dayLabels;
|
|
61
|
+
private renderTable;
|
|
62
|
+
private renderTotals;
|
|
63
|
+
private renderEmpty;
|
|
64
|
+
private removeKnob;
|
|
65
|
+
private onKnobPointerDown;
|
|
66
|
+
private onPointerMove;
|
|
67
|
+
private onPointerUp;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=ContestTimeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContestTimeline.d.ts","sourceRoot":"","sources":["../../../src/calculator/ContestTimeline.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,GAAG,EACT,MAAM,UAAU,CAAC;AAIlB,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CA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ChC,MAAM,IAAI;IAIb,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI;IASjD,OAAO,IAAI,IAAI;IAQf,OAAO,KAAK,MAAM,GAGjB;IAED,OAAO,KAAK,KAAK,GAEhB;IAED,OAAO,KAAK,UAAU,GAGrB;IAED,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,QAAQ;IAwBhB,OAAO,CAAC,cAAc;IAsDtB,OAAO,CAAC,WAAW;IAuFnB,OAAO,CAAC,SAAS;IAYjB,OAAO,CAAC,WAAW;IAsDnB,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,iBAAiB,CAKvB;IAEF,OAAO,CAAC,aAAa,CA8BnB;IAEF,OAAO,CAAC,WAAW,CAOjB;CACH"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Vanilla floor + bonus curve renderer for the SRSLY reservation
|
|
3
|
+
* calculator. Wraps uPlot's imperative API with a class-based lifecycle
|
|
4
|
+
* (constructor / update / destroy) so the component is framework-agnostic.
|
|
5
|
+
* The `@sly-rentals/core/react/MinBidChart` is a thin React wrapper that
|
|
6
|
+
* forwards lifecycle to this class.
|
|
7
|
+
*/
|
|
8
|
+
import { type ContestChain, type ContestChainConfig, type Cur } from '../utils';
|
|
9
|
+
export interface MinBidChartTheme {
|
|
10
|
+
floor: string;
|
|
11
|
+
bonus: string;
|
|
12
|
+
defenderBid: string;
|
|
13
|
+
axis: string;
|
|
14
|
+
grid: string;
|
|
15
|
+
knobDot: string;
|
|
16
|
+
dotStroke: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const DEFAULT_MIN_BID_CHART_THEME: MinBidChartTheme;
|
|
19
|
+
export interface MinBidChartClassNames {
|
|
20
|
+
root?: string;
|
|
21
|
+
legend?: string;
|
|
22
|
+
legendItem?: string;
|
|
23
|
+
legendUnit?: string;
|
|
24
|
+
canvasWrap?: string;
|
|
25
|
+
canvas?: string;
|
|
26
|
+
tooltip?: string;
|
|
27
|
+
tooltipDay?: string;
|
|
28
|
+
tooltipRow?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface MinBidChartProps {
|
|
31
|
+
cfg: ContestChainConfig;
|
|
32
|
+
rateStardust: bigint;
|
|
33
|
+
defenderBidStardust: bigint;
|
|
34
|
+
activeDays: number;
|
|
35
|
+
challengeCur: Cur;
|
|
36
|
+
stardustPerAtlas: number;
|
|
37
|
+
atlasPerPoint: number;
|
|
38
|
+
minCaptureThresholdPoints: number;
|
|
39
|
+
defenderReservedAt: number;
|
|
40
|
+
defenderHeldDays: number;
|
|
41
|
+
hasDefender: boolean;
|
|
42
|
+
nowDay?: number;
|
|
43
|
+
chain?: ContestChain;
|
|
44
|
+
theme?: Partial<MinBidChartTheme>;
|
|
45
|
+
classNames?: MinBidChartClassNames;
|
|
46
|
+
}
|
|
47
|
+
export declare class MinBidChart {
|
|
48
|
+
private readonly container;
|
|
49
|
+
private readonly root;
|
|
50
|
+
private readonly canvasWrap;
|
|
51
|
+
private readonly canvasHost;
|
|
52
|
+
private readonly tooltip;
|
|
53
|
+
private readonly legend;
|
|
54
|
+
private plot;
|
|
55
|
+
private resizeObs;
|
|
56
|
+
private props;
|
|
57
|
+
private theme;
|
|
58
|
+
private knobMarks;
|
|
59
|
+
private defenderActive;
|
|
60
|
+
private defenderVal;
|
|
61
|
+
constructor(container: HTMLElement, props: MinBidChartProps);
|
|
62
|
+
update(next: Partial<MinBidChartProps>): void;
|
|
63
|
+
destroy(): void;
|
|
64
|
+
private onLeaveCanvas;
|
|
65
|
+
private renderLegend;
|
|
66
|
+
private toDisplay;
|
|
67
|
+
private callMinBid;
|
|
68
|
+
private computeData;
|
|
69
|
+
private syncRefs;
|
|
70
|
+
private mountPlot;
|
|
71
|
+
private applyData;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=MinBidChart.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,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAeD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;IACxC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiB;IAC5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiB;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IAExC,OAAO,CAAC,IAAI,CAAsB;IAClC,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,KAAK,CAAmB;IAEhC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,WAAW,CAAK;gBAEZ,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB;IAuB3D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAU7C,OAAO,IAAI,IAAI;IASf,OAAO,CAAC,aAAa,CAEnB;IAEF,OAAO,CAAC,YAAY;IA+BpB,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,WAAW;IAiGnB,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,SAAS;IAqLjB,OAAO,CAAC,SAAS;CAKlB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Minimal DOM helper used by the vanilla calculator components
|
|
3
|
+
* to build element trees without JSX. Sets className + text + appends
|
|
4
|
+
* children in one call.
|
|
5
|
+
*/
|
|
6
|
+
export type ElProps = {
|
|
7
|
+
className?: string;
|
|
8
|
+
text?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
ariaLabel?: string;
|
|
11
|
+
attrs?: Record<string, string>;
|
|
12
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
13
|
+
};
|
|
14
|
+
export declare function el<K extends keyof HTMLElementTagNameMap>(tag: K, props?: ElProps, children?: Array<HTMLElement | string | null | undefined>): HTMLElementTagNameMap[K];
|
|
15
|
+
export declare function clearChildren(node: Element): void;
|
|
16
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../src/calculator/dom.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACtC,CAAC;AAEF,wBAAgB,EAAE,CAAC,CAAC,SAAS,MAAM,qBAAqB,EACtD,GAAG,EAAE,CAAC,EACN,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GACxD,qBAAqB,CAAC,CAAC,CAAC,CAiB1B;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAEjD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Typed event emitter — replaces React callback props in the
|
|
3
|
+
* vanilla calculator components. Subscribers register via `.on(event,
|
|
4
|
+
* handler)` and receive an unsubscribe thunk.
|
|
5
|
+
*/
|
|
6
|
+
export type EventMap = Record<string, (...args: never[]) => void>;
|
|
7
|
+
export declare class Emitter<E extends EventMap> {
|
|
8
|
+
private readonly listeners;
|
|
9
|
+
on<K extends keyof E>(event: K, handler: E[K]): () => void;
|
|
10
|
+
emit<K extends keyof E>(event: K, ...args: Parameters<E[K]>): void;
|
|
11
|
+
clear(): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../../src/calculator/emitter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC,CAAC;AAElE,qBAAa,OAAO,CAAC,CAAC,SAAS,QAAQ;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsC;IAEhE,EAAE,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAY1D,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAMlE,KAAK,IAAI,IAAI;CAKd"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Framework-agnostic calculator components for the SRSLY
|
|
3
|
+
* reservation system. Class-based lifecycle (constructor / update /
|
|
4
|
+
* destroy) — works in any environment with a DOM. React consumers
|
|
5
|
+
* should prefer `@sly-rentals/core/react` which wraps these classes.
|
|
6
|
+
*
|
|
7
|
+
* Pair with `@sly-rentals/core/react/styles.css` for the default
|
|
8
|
+
* SRSLY look, or supply your own classNames / theme.
|
|
9
|
+
*/
|
|
10
|
+
export { MinBidChart, DEFAULT_MIN_BID_CHART_THEME, type MinBidChartProps, type MinBidChartTheme, type MinBidChartClassNames, } from './MinBidChart';
|
|
11
|
+
export { ContestTimeline, type ContestTimelineProps, type ContestTimelineClassNames, type ContestTimelineEvents, } from './ContestTimeline';
|
|
12
|
+
export { Emitter, type EventMap } from './emitter';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/calculator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,WAAW,EACX,2BAA2B,EAC3B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -5,12 +5,57 @@
|
|
|
5
5
|
* Mirrors on-chain constants in `rust/programs/srsly/src/instructions/contract_thread.rs`.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* Covers thread rent + 3 fiber rents (~0.034 SOL) plus a ~0.006 SOL buffer.
|
|
8
|
+
* Floor for the `amount` field passed into `antegen::create_thread`.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
10
|
+
* Matches the on-chain `MINIMUM_THREAD_LAMPORTS` enforcement in
|
|
11
|
+
* `rust/programs/srsly/src/instructions/contract_thread.rs:119`.
|
|
12
|
+
* Callers should NOT use this constant directly — prefer
|
|
13
|
+
* `computeThreadLamports(executionBudget)` which sizes the funding
|
|
14
|
+
* to what the contract's actual fiber set + execution budget needs
|
|
15
|
+
* and only falls back to this floor when the computed value is
|
|
16
|
+
* smaller (e.g. weekly/monthly contracts).
|
|
12
17
|
*/
|
|
13
|
-
export declare const MINIMUM_THREAD_FUNDING =
|
|
18
|
+
export declare const MINIMUM_THREAD_FUNDING = 30000000n;
|
|
19
|
+
/**
|
|
20
|
+
* Rent-exempt minimum for one antegen `FiberState` account (1092
|
|
21
|
+
* bytes — 32 thread + 4+1024 compiled_instruction + 8 last_executed
|
|
22
|
+
* + 8 exec_count + 8 priority_fee + 8 discriminator). The thread
|
|
23
|
+
* pre-funds this for every fiber it'll ever hold so lazy
|
|
24
|
+
* `update_fiber(init_if_needed)` calls can pay rent from the
|
|
25
|
+
* thread's own balance.
|
|
26
|
+
*
|
|
27
|
+
* Hardcoded against antegen-fiber-program v5.0.7. If Antegen
|
|
28
|
+
* changes the struct, update here.
|
|
29
|
+
*/
|
|
30
|
+
export declare const FIBER_STATE_RENT_LAMPORTS = 8500000n;
|
|
31
|
+
/**
|
|
32
|
+
* Number of fibers the srsly contract thread provisions over its
|
|
33
|
+
* lifetime. Currently 2:
|
|
34
|
+
* • Fiber 0 — controller (`contract_process`), created inline at
|
|
35
|
+
* `thread_create`.
|
|
36
|
+
* • Fiber 1 — close fiber (`rental_close` ix). Created lazily on
|
|
37
|
+
* the first `rental_accept` / `rental_reserve`, with its
|
|
38
|
+
* instruction payload swapped between accept and reserve
|
|
39
|
+
* contexts as needed (same slot, different content).
|
|
40
|
+
*
|
|
41
|
+
* Bump this if a future contract design adds another fiber.
|
|
42
|
+
*/
|
|
43
|
+
export declare const SRSLY_THREAD_FIBER_COUNT = 2n;
|
|
44
|
+
/**
|
|
45
|
+
* Total lamports to pass into `antegen::create_thread.amount`.
|
|
46
|
+
*
|
|
47
|
+
* Sized to the contract's actual needs:
|
|
48
|
+
* • Rent for every fiber the thread will hold (pre-funded from
|
|
49
|
+
* the thread's balance for lazy creation).
|
|
50
|
+
* • Execution budget — drained per tick at `PER_TICK_LAMPORTS`.
|
|
51
|
+
*
|
|
52
|
+
* Floors at `MINIMUM_THREAD_FUNDING` so the on-chain validation
|
|
53
|
+
* passes. For @daily/@weekly/@monthly contracts the computed
|
|
54
|
+
* value is below the floor so we still pay the 30M; for `@hourly`
|
|
55
|
+
* contracts the execution budget alone exceeds the floor and we
|
|
56
|
+
* pass the actual required amount.
|
|
57
|
+
*/
|
|
58
|
+
export declare function computeThreadLamports(executionBudget: bigint): bigint;
|
|
14
59
|
/**
|
|
15
60
|
* Default execution budget for contract thread ticks when caller does not
|
|
16
61
|
* specify one. 0.00219 SOL funds ~365 ticks at 0.000006 SOL each
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/cost/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/cost/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,YAAc,CAAC;AAElD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,WAAa,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAGrE;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,WAAa,CAAC;AAEnD,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAExC,+DAA+D;AAC/D,eAAO,MAAM,eAAe,SAAU,CAAC;AAEvC,qDAAqD;AACrD,eAAO,MAAM,YAAY,MAAM,CAAC"}
|
|
@@ -28,7 +28,13 @@ export interface OwnerSetupCostOptions {
|
|
|
28
28
|
export interface OwnerSetupCostQuote {
|
|
29
29
|
/** Recoverable rents: ContractState + 2×RentalState + contract ATA (+ owner ATA). */
|
|
30
30
|
rentLamports: bigint;
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Rent for the Antegen Thread account itself. Paid by the payer
|
|
33
|
+
* via `init_if_needed` inside `create_thread` CPI — separate from
|
|
34
|
+
* the `amount` param. Recoverable when the thread is closed.
|
|
35
|
+
*/
|
|
36
|
+
threadAccountRent: bigint;
|
|
37
|
+
/** Lamports sent to the thread — `max(fiber rents + execution budget, on-chain floor)`. */
|
|
32
38
|
threadLamports: bigint;
|
|
33
39
|
/** Base Solana tx fees for contract_create + contract_thread. */
|
|
34
40
|
txFees: bigint;
|
|
@@ -40,6 +46,11 @@ export interface OwnerSetupCostQuote {
|
|
|
40
46
|
rentalStateQueued: bigint;
|
|
41
47
|
contractAta: bigint;
|
|
42
48
|
ownerAta: bigint;
|
|
49
|
+
/** Rent-exempt minimum for the Antegen Thread account. */
|
|
50
|
+
threadAccount: bigint;
|
|
51
|
+
/** Same value as `threadLamports` minus `executionBudget` — i.e. the
|
|
52
|
+
* portion of the thread funding earmarked for fiber rents + any
|
|
53
|
+
* on-chain-minimum slack. */
|
|
43
54
|
threadInfraBase: bigint;
|
|
44
55
|
executionBudget: bigint;
|
|
45
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimate.d.ts","sourceRoot":"","sources":["../../../src/cost/estimate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAK3C,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"estimate.d.ts","sourceRoot":"","sources":["../../../src/cost/estimate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAK3C,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AA0B1D,MAAM,WA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C,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,eAAe,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CA8B3F;AAMD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEzD"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Cost helpers for SRSLY: rent + tx-fee constants, account sizes, and
|
|
3
|
+
* setup-cost estimators. Exposed as the `@sly-rentals/core/cost`
|
|
4
|
+
* subpath so callers (e.g. the landing-page CostBreakdown widget)
|
|
5
|
+
* can pull just these helpers without dragging in the instruction
|
|
6
|
+
* surface through the main `core/kit` barrel.
|
|
7
|
+
*
|
|
8
|
+
* Named re-exports (not `export *`) so bundlers can tree-shake unused
|
|
9
|
+
* estimators per-call site.
|
|
10
|
+
*/
|
|
11
|
+
export { MINIMUM_THREAD_FUNDING, FIBER_STATE_RENT_LAMPORTS, SRSLY_THREAD_FIBER_COUNT, computeThreadLamports, DEFAULT_EXECUTION_BUDGET, TX_BASE_FEE_LAMPORTS, PER_TICK_LAMPORTS, SECONDS_PER_DAY, SPL_ATA_SIZE, } from './constants';
|
|
12
|
+
export { CONTRACT_STATE_SIZE, RENTAL_STATE_SIZE, ANTEGEN_THREAD_SIZE, BORROWER_STATE_SIZE, CONFIG_STATE_SIZE, } from './sizes';
|
|
13
|
+
export { estimateOwnerSetupCost, estimateBorrowerSetupCost, estimateRentalCost, tickBudget, type OwnerSetupCostOptions, type OwnerSetupCostQuote, type BorrowerSetupCostQuote, type RentalCostParams, type RentalCostQuote, } from './estimate';
|
|
4
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cost/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cost/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,kBAAkB,EAClB,UAAU,EACV,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC"}
|
|
@@ -9,8 +9,25 @@
|
|
|
9
9
|
*/
|
|
10
10
|
/** ContractState — `state/contract.rs` */
|
|
11
11
|
export declare const CONTRACT_STATE_SIZE = 638;
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* RentalState — `state/rental.rs` (two instances per contract: active + queued).
|
|
14
|
+
*
|
|
15
|
+
* Struct = u32 (4) + u8 (1) + 4×Pubkey (128) + 6×u64/i64 (48) + 2×u16 (4)
|
|
16
|
+
* + Option<Pubkey> (33) + 2×u64 (16) + i64 (8) + RentalStatus enum (1)
|
|
17
|
+
* + 2×i64 (16) = 259 bytes data, + 8 anchor discriminator = 267.
|
|
18
|
+
*/
|
|
19
|
+
export declare const RENTAL_STATE_SIZE = 267;
|
|
20
|
+
/**
|
|
21
|
+
* Antegen Thread account — `antegen_thread_program::state::Thread`.
|
|
22
|
+
*
|
|
23
|
+
* Init'd via `init_if_needed` inside `create_thread` CPI with the
|
|
24
|
+
* payer footing the rent. NOT covered by the `amount` we pass into
|
|
25
|
+
* `create_thread`; it's a separate outflow the SDK previously
|
|
26
|
+
* missed. Sized at 1152 bytes based on the deployed antegen v5.0.12
|
|
27
|
+
* struct (32-byte authority + Vec<u8>/String maxes + Trigger/Schedule
|
|
28
|
+
* enum largest variants + 50-fiber id list + Signal enum + counters).
|
|
29
|
+
*/
|
|
30
|
+
export declare const ANTEGEN_THREAD_SIZE = 1152;
|
|
14
31
|
/** BorrowerState — `state/borrower.rs` (Vec<Pubkey> max_len 10) */
|
|
15
32
|
export declare const BORROWER_STATE_SIZE = 423;
|
|
16
33
|
/** ConfigState — `state/config.rs` */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizes.d.ts","sourceRoot":"","sources":["../../../src/cost/sizes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,0CAA0C;AAC1C,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC
|
|
1
|
+
{"version":3,"file":"sizes.d.ts","sourceRoot":"","sources":["../../../src/cost/sizes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,0CAA0C;AAC1C,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,mEAAmE;AACnE,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"closeContract.d.ts","sourceRoot":"","sources":["../../../src/instructions/closeContract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAwB,KAAK,OAAO,EAAoB,MAAM,aAAa,CAAC;AAKnF,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAI3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"closeContract.d.ts","sourceRoot":"","sources":["../../../src/instructions/closeContract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAwB,KAAK,OAAO,EAAoB,MAAM,aAAa,CAAC;AAKnF,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAI3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,KAAK,EAAE,eAAe,CAAC;IAEvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAE5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAE/B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAElC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAC1B,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAmLjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContract.d.ts","sourceRoot":"","sources":["../../../src/instructions/createContract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAKpD,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"createContract.d.ts","sourceRoot":"","sources":["../../../src/instructions/createContract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAKpD,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,kBAA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