@inversealtruism/cairnx-core 0.1.43 → 0.2.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/CHANGELOG.md +55 -0
- package/CONVENTION.md +11 -0
- package/MAKERS.md +399 -117
- package/README.md +2 -2
- package/dist/index.cjs +76 -41
- package/dist/index.d.cts +46 -16
- package/dist/index.d.ts +46 -16
- package/dist/index.js +55 -23
- package/dist/mm/index.cjs +2 -2
- package/dist/mm/index.d.cts +3 -2
- package/dist/mm/index.d.ts +3 -2
- package/dist/mm/index.js +3 -3
- package/package.json +3 -2
- package/test/vectors/replay-corpus.json +1 -1
- package/test/vectors/replay-hashes.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -115,13 +115,14 @@ __export(index_exports, {
|
|
|
115
115
|
blockReward: () => import_csd_codec5.blockReward,
|
|
116
116
|
buildFeeHeight: () => buildFeeHeight,
|
|
117
117
|
buildRecord: () => buildRecord,
|
|
118
|
+
burnedPayment: () => burnedPayment,
|
|
118
119
|
canonicalJson: () => import_csd_codec5.canonicalJson,
|
|
119
120
|
canonicalState: () => canonicalState,
|
|
120
121
|
claimGraceOf: () => claimGraceOf,
|
|
121
122
|
claimWindowAt: () => claimWindowAt,
|
|
122
123
|
claimWindowOf: () => claimWindowOf,
|
|
123
124
|
deploy: () => deploy,
|
|
124
|
-
epochOf: () => epochOf,
|
|
125
|
+
epochOf: () => import_csd_codec.epochOf,
|
|
125
126
|
expiredClaimFee: () => expiredClaimFee,
|
|
126
127
|
fclaim: () => fclaim,
|
|
127
128
|
fclaimEpochFor: () => fclaimEpochFor,
|
|
@@ -139,6 +140,7 @@ __export(index_exports, {
|
|
|
139
140
|
isTokenWant: () => isTokenWant,
|
|
140
141
|
makerRebate: () => makerRebate,
|
|
141
142
|
mint: () => mint,
|
|
143
|
+
myProvenFillClosedOffer: () => myProvenFillClosedOffer,
|
|
142
144
|
nameClaim: () => nameClaim,
|
|
143
145
|
nameCommit: () => nameCommit,
|
|
144
146
|
nameCommitRecord: () => nameCommitRecord,
|
|
@@ -159,6 +161,7 @@ __export(index_exports, {
|
|
|
159
161
|
previewFill: () => previewFill,
|
|
160
162
|
primaryRankBefore: () => primaryRankBefore,
|
|
161
163
|
provenOfferTerms: () => provenOfferTerms,
|
|
164
|
+
ptAmt: () => ptAmt,
|
|
162
165
|
replayLiveHold: () => replayLiveHold,
|
|
163
166
|
requiredClaimDepth: () => requiredClaimDepth,
|
|
164
167
|
requiredFillOutputs: () => requiredFillOutputs,
|
|
@@ -193,7 +196,7 @@ function expiredClaimFee(name, epochsPastGraceEnd, height) {
|
|
|
193
196
|
const mult = 1n + (NAME_PREMIUM_START - 1n) * left / BigInt(NAME_PREMIUM_DECAY_EPOCHS);
|
|
194
197
|
return base * mult;
|
|
195
198
|
}
|
|
196
|
-
var MAX_RECORD_BYTES =
|
|
199
|
+
var MAX_RECORD_BYTES = import_csd_codec.MAX_URI_BYTES;
|
|
197
200
|
var MAX_AMOUNT = (1n << 96n) - 1n;
|
|
198
201
|
var SCORE_FILL = 100;
|
|
199
202
|
var SCORE_CANCEL = 0;
|
|
@@ -265,7 +268,6 @@ var V26_HEIGHT = 46480;
|
|
|
265
268
|
var V27_HEIGHT = 46520;
|
|
266
269
|
var V28_HEIGHT = 6e4;
|
|
267
270
|
var V29_HEIGHT = 88e3;
|
|
268
|
-
var epochOf = (height) => Math.floor(height / import_csd_codec.EPOCH_LEN);
|
|
269
271
|
var claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
|
|
270
272
|
var FCLAIM_WINDOW_MIN = CLAIM_WINDOW_BLOCKS_V20 + CLAIM_FILL_GRACE_BLOCKS + 1;
|
|
271
273
|
var claimWindowOf = (claimUntilHeight, claimTxid) => {
|
|
@@ -273,12 +275,12 @@ var claimWindowOf = (claimUntilHeight, claimTxid) => {
|
|
|
273
275
|
return claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
|
|
274
276
|
};
|
|
275
277
|
var claimGraceOf = (claimUntilHeight, claimTxid) => claimTxid !== void 0 ? 0 : claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_FILL_GRACE_BLOCKS : 0;
|
|
276
|
-
var fclaimEpochFor = (tipHeight, offerExpiresEpoch) => Math.min(epochOf(tipHeight + CLAIM_WINDOW_BLOCKS_V20 + CLAIM_FILL_GRACE_BLOCKS), offerExpiresEpoch);
|
|
278
|
+
var fclaimEpochFor = (tipHeight, offerExpiresEpoch) => Math.min((0, import_csd_codec.epochOf)(tipHeight + CLAIM_WINDOW_BLOCKS_V20 + CLAIM_FILL_GRACE_BLOCKS), offerExpiresEpoch);
|
|
277
279
|
var fclaimHoldEnd = (expiresEpoch) => (expiresEpoch + 1) * import_csd_codec.EPOCH_LEN - 1;
|
|
278
280
|
var offerExpiryHeightOf = (expiresEpoch, anchorHeight) => {
|
|
279
281
|
const raw = (Number(expiresEpoch ?? 0) + 1) * import_csd_codec.EPOCH_LEN;
|
|
280
282
|
if (anchorHeight >= V22_HEIGHT) return raw;
|
|
281
|
-
const capped = (epochOf(anchorHeight) + MAX_OFFER_EPOCHS + 1) * import_csd_codec.EPOCH_LEN;
|
|
283
|
+
const capped = ((0, import_csd_codec.epochOf)(anchorHeight) + MAX_OFFER_EPOCHS + 1) * import_csd_codec.EPOCH_LEN;
|
|
282
284
|
return Math.min(raw, Math.max(V21_HEIGHT, capped));
|
|
283
285
|
};
|
|
284
286
|
var isNameGive = (g) => typeof g.name === "string";
|
|
@@ -300,27 +302,12 @@ var isName = (n) => typeof n === "string" && NAME_RE.test(n) && !RESERVED_NAMES.
|
|
|
300
302
|
function nameCommit(name, salt, owner) {
|
|
301
303
|
return (0, import_csd_codec2.payloadHash)({ t: "cairnx:name:commit:v1", name, salt, owner: owner.toLowerCase() });
|
|
302
304
|
}
|
|
303
|
-
function strWellFormed(s) {
|
|
304
|
-
const wf = String.prototype.isWellFormed;
|
|
305
|
-
if (typeof wf === "function") return wf.call(s);
|
|
306
|
-
for (let i = 0; i < s.length; i++) {
|
|
307
|
-
const c = s.charCodeAt(i);
|
|
308
|
-
if (c >= 55296 && c <= 56319) {
|
|
309
|
-
const n = s.charCodeAt(i + 1);
|
|
310
|
-
if (!(n >= 56320 && n <= 57343)) return false;
|
|
311
|
-
i++;
|
|
312
|
-
} else if (c >= 56320 && c <= 57343) {
|
|
313
|
-
return false;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return true;
|
|
317
|
-
}
|
|
318
305
|
function isWellFormedDeep(v) {
|
|
319
|
-
if (typeof v === "string") return
|
|
306
|
+
if (typeof v === "string") return (0, import_csd_codec2.isWellFormedUtf16)(v);
|
|
320
307
|
if (Array.isArray(v)) return v.every(isWellFormedDeep);
|
|
321
308
|
if (v && typeof v === "object") {
|
|
322
309
|
for (const [k, val] of Object.entries(v)) {
|
|
323
|
-
if (!
|
|
310
|
+
if (!(0, import_csd_codec2.isWellFormedUtf16)(k)) return false;
|
|
324
311
|
if (!isWellFormedDeep(val)) return false;
|
|
325
312
|
}
|
|
326
313
|
}
|
|
@@ -604,9 +591,9 @@ function resolve(events, tipHeight) {
|
|
|
604
591
|
b.available += amt;
|
|
605
592
|
}
|
|
606
593
|
};
|
|
607
|
-
const effExpiry = (e, height) => e.height >= V22_HEIGHT ? e.expiresEpoch : height >= V21_HEIGHT ? Math.min(e.expiresEpoch, epochOf(e.height) + MAX_OFFER_EPOCHS) : e.expiresEpoch;
|
|
594
|
+
const effExpiry = (e, height) => e.height >= V22_HEIGHT ? e.expiresEpoch : height >= V21_HEIGHT ? Math.min(e.expiresEpoch, (0, import_csd_codec.epochOf)(e.height) + MAX_OFFER_EPOCHS) : e.expiresEpoch;
|
|
608
595
|
const sweepExpired = (height) => {
|
|
609
|
-
const ep = epochOf(height);
|
|
596
|
+
const ep = (0, import_csd_codec.epochOf)(height);
|
|
610
597
|
for (const id of [...openOffers]) {
|
|
611
598
|
const o = offers.get(id);
|
|
612
599
|
if (!o || o.status !== "open") {
|
|
@@ -642,7 +629,7 @@ function resolve(events, tipHeight) {
|
|
|
642
629
|
if (height > r.finalizeBy) recaptures.delete(nm);
|
|
643
630
|
}
|
|
644
631
|
};
|
|
645
|
-
const V15_EPOCH = epochOf(V15_HEIGHT);
|
|
632
|
+
const V15_EPOCH = (0, import_csd_codec.epochOf)(V15_HEIGHT);
|
|
646
633
|
const paidThrough = (n) => n.paidThroughEpoch ?? V15_EPOCH + NAME_TERM_EPOCHS;
|
|
647
634
|
const lapsed = (n, ep) => ep > paidThrough(n) + NAME_GRACE_EPOCHS;
|
|
648
635
|
const inGrace = (n, ep) => ep > paidThrough(n) && !lapsed(n, ep);
|
|
@@ -799,7 +786,7 @@ function resolve(events, tipHeight) {
|
|
|
799
786
|
effHeight = cH;
|
|
800
787
|
}
|
|
801
788
|
const cur = names.get(rec.name);
|
|
802
|
-
const epClaim = epochOf(ev.height);
|
|
789
|
+
const epClaim = (0, import_csd_codec.epochOf)(ev.height);
|
|
803
790
|
const curActive = cur && cur.pending && cur.finalizeBy !== void 0 && ev.height > cur.finalizeBy ? void 0 : cur;
|
|
804
791
|
if (curActive && !curActive.pending && v15 && lapsed(curActive, epClaim)) {
|
|
805
792
|
if (v26) {
|
|
@@ -909,7 +896,7 @@ function resolve(events, tipHeight) {
|
|
|
909
896
|
delete n.pending;
|
|
910
897
|
delete n.finalizeBy;
|
|
911
898
|
pendingNames.delete(rec.name);
|
|
912
|
-
n.paidThroughEpoch = epochOf(ev.height) + NAME_TERM_EPOCHS;
|
|
899
|
+
n.paidThroughEpoch = (0, import_csd_codec.epochOf)(ev.height) + NAME_TERM_EPOCHS;
|
|
913
900
|
feesPaid += nameRegFee(rec.name, ev.height);
|
|
914
901
|
note(ev, ev.id, "nfinalize", true);
|
|
915
902
|
continue;
|
|
@@ -930,7 +917,7 @@ function resolve(events, tipHeight) {
|
|
|
930
917
|
continue;
|
|
931
918
|
}
|
|
932
919
|
const cur = names.get(rec.name);
|
|
933
|
-
const ep = epochOf(ev.height);
|
|
920
|
+
const ep = (0, import_csd_codec.epochOf)(ev.height);
|
|
934
921
|
if (!cur || cur.pending || !lapsed(cur, ep)) {
|
|
935
922
|
recaptures.delete(rec.name);
|
|
936
923
|
note(ev, ev.id, "nfinalize", false, "name is no longer lapsed");
|
|
@@ -959,7 +946,7 @@ function resolve(events, tipHeight) {
|
|
|
959
946
|
note(ev, ev.id, "nxfer", false, "name reservation not yet finalized");
|
|
960
947
|
continue;
|
|
961
948
|
}
|
|
962
|
-
if (v15 && lapsed(n, epochOf(ev.height))) {
|
|
949
|
+
if (v15 && lapsed(n, (0, import_csd_codec.epochOf)(ev.height))) {
|
|
963
950
|
note(ev, ev.id, "nxfer", false, "lease lapsed \u2014 claim it instead");
|
|
964
951
|
continue;
|
|
965
952
|
}
|
|
@@ -981,7 +968,7 @@ function resolve(events, tipHeight) {
|
|
|
981
968
|
note(ev, ev.id, "nset", false, "name reservation not yet finalized");
|
|
982
969
|
continue;
|
|
983
970
|
}
|
|
984
|
-
if (v15 && lapsed(n, epochOf(ev.height))) {
|
|
971
|
+
if (v15 && lapsed(n, (0, import_csd_codec.epochOf)(ev.height))) {
|
|
985
972
|
note(ev, ev.id, "nset", false, "lease lapsed \u2014 claim it instead");
|
|
986
973
|
continue;
|
|
987
974
|
}
|
|
@@ -1002,7 +989,7 @@ function resolve(events, tipHeight) {
|
|
|
1002
989
|
note(ev, ev.id, "nprofile", false, "name reservation not yet finalized");
|
|
1003
990
|
continue;
|
|
1004
991
|
}
|
|
1005
|
-
if (v15 && lapsed(n, epochOf(ev.height))) {
|
|
992
|
+
if (v15 && lapsed(n, (0, import_csd_codec.epochOf)(ev.height))) {
|
|
1006
993
|
note(ev, ev.id, "nprofile", false, "lease lapsed \u2014 claim it instead");
|
|
1007
994
|
continue;
|
|
1008
995
|
}
|
|
@@ -1027,11 +1014,11 @@ function resolve(events, tipHeight) {
|
|
|
1027
1014
|
note(ev, ev.id, "offer", false, "expiresEpoch out of safe-integer range");
|
|
1028
1015
|
continue;
|
|
1029
1016
|
}
|
|
1030
|
-
if (epochOf(ev.height) > ev.expiresEpoch) {
|
|
1017
|
+
if ((0, import_csd_codec.epochOf)(ev.height) > ev.expiresEpoch) {
|
|
1031
1018
|
note(ev, ev.id, "offer", false, "already expired at anchor");
|
|
1032
1019
|
continue;
|
|
1033
1020
|
}
|
|
1034
|
-
if (ev.height >= V21_HEIGHT && ev.height < V22_HEIGHT && ev.expiresEpoch - epochOf(ev.height) > MAX_OFFER_EPOCHS) {
|
|
1021
|
+
if (ev.height >= V21_HEIGHT && ev.height < V22_HEIGHT && ev.expiresEpoch - (0, import_csd_codec.epochOf)(ev.height) > MAX_OFFER_EPOCHS) {
|
|
1035
1022
|
note(ev, ev.id, "offer", false, "v2.1: offer duration exceeds the max");
|
|
1036
1023
|
continue;
|
|
1037
1024
|
}
|
|
@@ -1106,11 +1093,11 @@ function resolve(events, tipHeight) {
|
|
|
1106
1093
|
note(ev, ev.id, "bid", false, "expiresEpoch out of safe-integer range");
|
|
1107
1094
|
continue;
|
|
1108
1095
|
}
|
|
1109
|
-
if (epochOf(ev.height) > ev.expiresEpoch) {
|
|
1096
|
+
if ((0, import_csd_codec.epochOf)(ev.height) > ev.expiresEpoch) {
|
|
1110
1097
|
note(ev, ev.id, "bid", false, "already expired at anchor");
|
|
1111
1098
|
continue;
|
|
1112
1099
|
}
|
|
1113
|
-
if (ev.height >= V21_HEIGHT && ev.height < V22_HEIGHT && ev.expiresEpoch - epochOf(ev.height) > MAX_OFFER_EPOCHS) {
|
|
1100
|
+
if (ev.height >= V21_HEIGHT && ev.height < V22_HEIGHT && ev.expiresEpoch - (0, import_csd_codec.epochOf)(ev.height) > MAX_OFFER_EPOCHS) {
|
|
1114
1101
|
note(ev, ev.id, "bid", false, "v2.1: bid duration exceeds the max");
|
|
1115
1102
|
continue;
|
|
1116
1103
|
}
|
|
@@ -1165,7 +1152,7 @@ function resolve(events, tipHeight) {
|
|
|
1165
1152
|
continue;
|
|
1166
1153
|
}
|
|
1167
1154
|
const n = names.get(rec.name);
|
|
1168
|
-
const ep = epochOf(ev.height);
|
|
1155
|
+
const ep = (0, import_csd_codec.epochOf)(ev.height);
|
|
1169
1156
|
if (n && n.pending) {
|
|
1170
1157
|
note(ev, ev.id, "nrenew", false, "name reservation not yet finalized");
|
|
1171
1158
|
continue;
|
|
@@ -1236,11 +1223,11 @@ function resolve(events, tipHeight) {
|
|
|
1236
1223
|
deny("hold would outlive the offer expiry");
|
|
1237
1224
|
continue;
|
|
1238
1225
|
}
|
|
1239
|
-
if (E > epochOf(ev.height) + FCLAIM_MAX_EPOCH_AHEAD) {
|
|
1226
|
+
if (E > (0, import_csd_codec.epochOf)(ev.height) + FCLAIM_MAX_EPOCH_AHEAD) {
|
|
1240
1227
|
deny("hold too far ahead (anti-squat)");
|
|
1241
1228
|
continue;
|
|
1242
1229
|
}
|
|
1243
|
-
if (epochOf(ev.height) > E) {
|
|
1230
|
+
if ((0, import_csd_codec.epochOf)(ev.height) > E) {
|
|
1244
1231
|
deny("expiry already in the past");
|
|
1245
1232
|
continue;
|
|
1246
1233
|
}
|
|
@@ -1535,7 +1522,7 @@ function resolve(events, tipHeight) {
|
|
|
1535
1522
|
const tipV15 = tipHeight >= V15_HEIGHT;
|
|
1536
1523
|
const tipV19 = tipHeight >= V19_HEIGHT;
|
|
1537
1524
|
const tipV25 = tipHeight >= V25_HEIGHT;
|
|
1538
|
-
const tipEpoch = epochOf(tipHeight);
|
|
1525
|
+
const tipEpoch = (0, import_csd_codec.epochOf)(tipHeight);
|
|
1539
1526
|
for (const [nm, n] of [...names.entries()].sort(([a], [b]) => ord(a, b))) {
|
|
1540
1527
|
if (tipV25 && n.pending) {
|
|
1541
1528
|
namesOut[nm] = { name: nm, owner: n.owner, claimId: n.id, height: n.height, effectiveHeight: n.effHeight, locked: n.locked, pending: true, finalizeBy: n.finalizeBy };
|
|
@@ -1882,10 +1869,10 @@ function bindOfferTerms(servedOffer, t, opts) {
|
|
|
1882
1869
|
const om = o?.min;
|
|
1883
1870
|
if ((om !== void 0 && om !== null) !== (t.min !== void 0)) return true;
|
|
1884
1871
|
if (t.min !== void 0 && String(om) !== t.min) return true;
|
|
1885
|
-
if (opts?.wantType) {
|
|
1872
|
+
if (opts?.wantType !== false) {
|
|
1886
1873
|
if (t.wantType === void 0 || typeof o?.want?.ticker === "string" !== (t.wantType === "token")) return true;
|
|
1887
1874
|
}
|
|
1888
|
-
if (opts?.give) {
|
|
1875
|
+
if (opts?.give !== false) {
|
|
1889
1876
|
const g = o?.give;
|
|
1890
1877
|
if ((g?.ticker !== void 0 && g?.ticker !== null) !== (t.giveTicker !== void 0) || t.giveTicker !== void 0 && String(g?.ticker) !== t.giveTicker) return true;
|
|
1891
1878
|
if ((g?.amount !== void 0 && g?.amount !== null) !== (t.giveAmount !== void 0) || t.giveAmount !== void 0 && String(g?.amount) !== t.giveAmount) return true;
|
|
@@ -1911,6 +1898,51 @@ function paidToFromOutputs(outputs) {
|
|
|
1911
1898
|
}
|
|
1912
1899
|
return m;
|
|
1913
1900
|
}
|
|
1901
|
+
function burnedPayment(paidTo, payer, offer2) {
|
|
1902
|
+
const read = (addr) => addr === payer ? 0n : ptAmt(paidTo?.[addr]);
|
|
1903
|
+
let counterparty = 0n;
|
|
1904
|
+
if (offer2) {
|
|
1905
|
+
for (const addr of /* @__PURE__ */ new Set([offer2.seller, offer2.want.payto])) if (addr !== TREASURY_ADDR) counterparty += read(addr);
|
|
1906
|
+
}
|
|
1907
|
+
return { treasury: read(TREASURY_ADDR), counterparty };
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
// src/fillclosed.ts
|
|
1911
|
+
var lc = (v) => String(v).toLowerCase();
|
|
1912
|
+
function myProvenFillClosedOffer(fill, fclaim2, offerEv, me, grantHeight) {
|
|
1913
|
+
if (!(grantHeight >= V29_HEIGHT)) return false;
|
|
1914
|
+
if (!fill || fill.kind !== "attest" || fill.score !== SCORE_FILL) return false;
|
|
1915
|
+
if (lc(fill.attester) !== lc(me) || lc(fill.proposalId) !== lc(fclaim2.id)) return false;
|
|
1916
|
+
if (!(fill.height > fclaim2.height && fill.height < grantHeight)) return false;
|
|
1917
|
+
if (!offerEv || offerEv.kind !== "propose" || lc(offerEv.id) !== lc(fclaim2.offer)) return false;
|
|
1918
|
+
const bound = bindProvenOffer(offerEv);
|
|
1919
|
+
const value = bound?.terms.value;
|
|
1920
|
+
if (!bound || value === void 0) return false;
|
|
1921
|
+
const t = bound.terms;
|
|
1922
|
+
const state = {
|
|
1923
|
+
id: lc(offerEv.id),
|
|
1924
|
+
seller: bound.seller,
|
|
1925
|
+
give: t.giveName !== void 0 ? { name: t.giveName } : { ticker: String(t.giveTicker ?? ""), amount: String(t.giveAmount ?? "") },
|
|
1926
|
+
want: { value, payto: bound.payto },
|
|
1927
|
+
status: "open",
|
|
1928
|
+
expiresEpoch: offerEv.expiresEpoch,
|
|
1929
|
+
height: t.height,
|
|
1930
|
+
feeBps: t.feeBps,
|
|
1931
|
+
taker: t.taker,
|
|
1932
|
+
bid: t.bid,
|
|
1933
|
+
min: t.min,
|
|
1934
|
+
paid: "0",
|
|
1935
|
+
delivered: "0"
|
|
1936
|
+
};
|
|
1937
|
+
let need;
|
|
1938
|
+
try {
|
|
1939
|
+
need = requiredFillOutputs(state, BigInt(value));
|
|
1940
|
+
} catch {
|
|
1941
|
+
return false;
|
|
1942
|
+
}
|
|
1943
|
+
if (!need) return false;
|
|
1944
|
+
return need.every((leg) => ptAmt(fill.paidTo?.[lc(leg.to)]) >= leg.value);
|
|
1945
|
+
}
|
|
1914
1946
|
|
|
1915
1947
|
// src/index.ts
|
|
1916
1948
|
var import_csd_codec5 = require("@inversealtruism/csd-codec");
|
|
@@ -2011,6 +2043,7 @@ var import_csd_codec5 = require("@inversealtruism/csd-codec");
|
|
|
2011
2043
|
blockReward,
|
|
2012
2044
|
buildFeeHeight,
|
|
2013
2045
|
buildRecord,
|
|
2046
|
+
burnedPayment,
|
|
2014
2047
|
canonicalJson,
|
|
2015
2048
|
canonicalState,
|
|
2016
2049
|
claimGraceOf,
|
|
@@ -2035,6 +2068,7 @@ var import_csd_codec5 = require("@inversealtruism/csd-codec");
|
|
|
2035
2068
|
isTokenWant,
|
|
2036
2069
|
makerRebate,
|
|
2037
2070
|
mint,
|
|
2071
|
+
myProvenFillClosedOffer,
|
|
2038
2072
|
nameClaim,
|
|
2039
2073
|
nameCommit,
|
|
2040
2074
|
nameCommitRecord,
|
|
@@ -2055,6 +2089,7 @@ var import_csd_codec5 = require("@inversealtruism/csd-codec");
|
|
|
2055
2089
|
previewFill,
|
|
2056
2090
|
primaryRankBefore,
|
|
2057
2091
|
provenOfferTerms,
|
|
2092
|
+
ptAmt,
|
|
2058
2093
|
replayLiveHold,
|
|
2059
2094
|
requiredClaimDepth,
|
|
2060
2095
|
requiredFillOutputs,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { EPOCH_LEN, HALVING_INTERVAL, INITIAL_REWARD, MIN_FEE_ATTEST, MIN_FEE_PROPOSE, blockReward, canonicalJson, payloadHash } from '@inversealtruism/csd-codec';
|
|
1
|
+
export { EPOCH_LEN, HALVING_INTERVAL, INITIAL_REWARD, MIN_FEE_ATTEST, MIN_FEE_PROPOSE, blockReward, canonicalJson, epochOf, payloadHash } from '@inversealtruism/csd-codec';
|
|
2
2
|
|
|
3
3
|
declare const DOMAIN = "cairnx:v1";
|
|
4
4
|
declare const ACTIVATION_HEIGHT = 29860;
|
|
@@ -74,7 +74,6 @@ declare const V26_HEIGHT = 46480;
|
|
|
74
74
|
declare const V27_HEIGHT = 46520;
|
|
75
75
|
declare const V28_HEIGHT = 60000;
|
|
76
76
|
declare const V29_HEIGHT = 88000;
|
|
77
|
-
declare const epochOf: (height: number) => number;
|
|
78
77
|
declare const claimWindowAt: (height: number) => number;
|
|
79
78
|
declare const FCLAIM_WINDOW_MIN: number;
|
|
80
79
|
declare const claimWindowOf: (claimUntilHeight: number, claimTxid?: string) => number;
|
|
@@ -427,6 +426,7 @@ declare const tokenMeta: (r: Omit<TokenMetaRecord, "v" | "t">) => BuiltRecord;
|
|
|
427
426
|
declare const nameProfile: (r: Omit<NameProfileRecord, "v" | "t">) => BuiltRecord;
|
|
428
427
|
declare const fclaim: (r: Omit<FclaimRecord, "v" | "t">) => BuiltRecord;
|
|
429
428
|
|
|
429
|
+
declare function ptAmt(v: unknown): bigint;
|
|
430
430
|
declare function resolve(events: ChainEvent[], tipHeight: number): CairnXState;
|
|
431
431
|
/** Canonical serialization of state (FORMAT 2) — byte-identical across honest resolvers.
|
|
432
432
|
* The canonical surface is the DATA ONLY: {tipHeight, tokens, balances, names, offers, bids,
|
|
@@ -688,6 +688,8 @@ interface FillVerdict {
|
|
|
688
688
|
* across offers, so without this the surface would false-accept a cap-denied fclaim. `opts.pay` overrides the
|
|
689
689
|
* payment (base units to want.payto) for a PARTIAL tail-fill; defaults to the offer's full want.value.
|
|
690
690
|
*
|
|
691
|
+
* `opts.sums` is caller data (the per-address outputs the caller is about to build), so it cannot default on:
|
|
692
|
+
* without it there is nothing to bind. A caller that omits it keeps the overpay exposure described next.
|
|
691
693
|
* `opts.sums` (OPT-IN, B6a / REBIND W3; default OFF = byte-identical verdicts for existing callers) binds the
|
|
692
694
|
* caller's PLANNED per-address CSD payment sums to the PROVEN offer state: requiredFillOutputs is re-run over
|
|
693
695
|
* the merkle-proven, replayed offer (so `paid`/`delivered` are the chain's, not a served lie) and the caller's
|
|
@@ -739,24 +741,30 @@ declare function provenOfferTerms(offerRec: OfferRecord, provenHeight: number):
|
|
|
739
741
|
* `value` is bound only when `t.value` is defined so a token<->token offer (no CSD value) is not spuriously
|
|
740
742
|
* refused; a caller that binds want.value separately (the site does) may still pass it here (redundant-safe).
|
|
741
743
|
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
744
|
+
* The give and wantType legs (REBIND W2 legs + W7) are ON by default. Their third-argument switches opt out
|
|
745
|
+
* explicitly (`false`); omitted or `undefined` keeps a leg on. With a leg on the terms must be MINTED (the
|
|
746
|
+
* brand), because a hand-built terms object leaves the give/wantType fields undefined and would refuse every
|
|
747
|
+
* honest fill (the W2 trap this file documents). A plain ProvenOfferTerms is accepted only with both legs
|
|
748
|
+
* off, which is the pre-B6 predicate exactly (`scripts/seal-differential.mjs` step 5).
|
|
749
|
+
* give - bind give.ticker / give.amount / give.name: EXPLICIT PRESENCE (a served give growing or
|
|
750
|
+
* losing a field mismatches) AND verbatim string equality. Closes the W7 shortchange (a
|
|
751
|
+
* genuine offer served with give.amount inflated a millionfold passes every other leg).
|
|
752
|
+
* wantType - the SYMMETRIC want-type refusal: the served offer's want type (token iff want.ticker is
|
|
753
|
+
* a string, the isTokenWant pivot) must equal the proven type. The value leg already
|
|
754
|
+
* catches proven-CSD-served-as-token (String(undefined) mismatches t.value); this closes
|
|
755
|
+
* the reverse, proven-token-served-as-CSD.
|
|
753
756
|
*/
|
|
754
757
|
interface BindTermsOpts {
|
|
755
758
|
give?: boolean;
|
|
756
759
|
wantType?: boolean;
|
|
757
760
|
}
|
|
758
|
-
|
|
759
|
-
|
|
761
|
+
/** Both legs off: the pre-B6 verdict, for callers that hold hand-built (unminted) terms. */
|
|
762
|
+
type LegacyBindOpts = {
|
|
763
|
+
give: false;
|
|
764
|
+
wantType: false;
|
|
765
|
+
};
|
|
766
|
+
declare function bindOfferTerms(servedOffer: unknown, t: MintedProvenOfferTerms, opts?: BindTermsOpts): boolean;
|
|
767
|
+
declare function bindOfferTerms(servedOffer: unknown, t: ProvenOfferTerms, opts: LegacyBindOpts): boolean;
|
|
760
768
|
declare function bindProvenOffer(offerEv: ProvenPropose): {
|
|
761
769
|
payto: string;
|
|
762
770
|
seller: string;
|
|
@@ -767,5 +775,27 @@ declare function paidToFromOutputs(outputs: readonly {
|
|
|
767
775
|
addr: string;
|
|
768
776
|
value: number;
|
|
769
777
|
}[]): Record<string, string>;
|
|
778
|
+
/** What a record resolve() refused paid to the parties the protocol pays, read with the resolver's ptAmt:
|
|
779
|
+
* `treasury` is the output to TREASURY_ADDR, `counterparty` the outputs to the target offer's seller and
|
|
780
|
+
* want.payto (pass `offer` for a fill, omit it otherwise). Each address counts once and the payer's own
|
|
781
|
+
* outputs never count, so a payer paying itself burns nothing. */
|
|
782
|
+
declare function burnedPayment(paidTo: Readonly<Record<string, unknown>> | undefined, payer: string, offer?: Pick<OfferState, "seller" | "want"> | null): {
|
|
783
|
+
treasury: bigint;
|
|
784
|
+
counterparty: bigint;
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* True only when `fill` proves `me`'s own fill CLOSED the offer behind `fclaim` before `grantHeight`, so a
|
|
789
|
+
* resolver at a grant height >= V29_HEIGHT no longer counts that hold. `fill` and `offerEv` must be
|
|
790
|
+
* merkle-proven and prevout-bound by the caller. The fill must be a SCORE_FILL by `me` on exactly this fclaim,
|
|
791
|
+
* mined strictly after the fclaim and strictly before the grant, and carry every output of a FULL fill of the
|
|
792
|
+
* proven offer (want.value to payto, the fee, the maker rebate), read as the resolver reads them (ptAmt).
|
|
793
|
+
* A partial-lane offer closed by a remainder fill stays counted: the remainder depends on the served `paid`.
|
|
794
|
+
*/
|
|
795
|
+
declare function myProvenFillClosedOffer(fill: ProvenEvent | null, fclaim: {
|
|
796
|
+
id: string;
|
|
797
|
+
height: number;
|
|
798
|
+
offer: string;
|
|
799
|
+
}, offerEv: ProvenEvent | null, me: string, grantHeight: number): boolean;
|
|
770
800
|
|
|
771
|
-
export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, type BindTermsOpts, type BuiltRecord, CLAIM_ATTACKER_Q, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_MIN_DEPTH, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, COMMIT_REVEAL_MIN_DEPTH, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DEPLOY_KEYS, DOMAIN, type DeployRecord, FCLAIM_KEYS, FCLAIM_MAX_EPOCH_AHEAD, FCLAIM_WINDOW_MIN, FEE_BPS, FEE_BPS_V16, FEE_GATE_MARGIN_BLOCKS, FILL_TIP_MARGIN, FINALIZE_TIP_MARGIN, type FclaimRecord, type FillEndorsement, type FillEntry, type FillOutputPlan, type FillPreview, type FillSafety, type FillSpvIo, type FillVerdict, GAP_NEEDED, type Give, HASH_RE, type HoldReplay, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MINT_KEYS, type MintRecord, type MintedProvenOfferTerms, NAME_FEE_LEN3_V24, NAME_FEE_LEN4_V24, NAME_FEE_LONG_V24, NAME_FEE_MID_V24, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NFINALIZE_KEYS, NPROFILE_KEYS, type NameCommitRecord, type NameFinalizeRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, OFFER_KEYS, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, type ProvenAttest, type ProvenEvent, type ProvenOfferTerms, type ProvenPropose, REBATE_BPS, REBATE_FLAT, REG_COMMIT_MAX_BLOCKS, REG_FINALIZE_GRACE_BLOCKS, RESERVED_NAMES, SALT_RE, SCAN_MARGIN, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, TRANSFER_KEYS, TREASURY_ADDR, type TokenMetaRecord, type TokenState, type TransferRecord, V11_HEIGHT, V12_HEIGHT, V13_HEIGHT, V14_HEIGHT, V15_HEIGHT, V16_HEIGHT, V17_HEIGHT, V18_HEIGHT, V19_HEIGHT, V20_HEIGHT, V21_HEIGHT, V22_HEIGHT, V23_HEIGHT, V24_HEIGHT, V25_HEIGHT, V26_HEIGHT, V27_HEIGHT, V28_HEIGHT, V29_HEIGHT, type Want, ZERO_ADDR, bid, bindOfferTerms, bindProvenOffer, buildFeeHeight, buildRecord, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy,
|
|
801
|
+
export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, type BindTermsOpts, type BuiltRecord, CLAIM_ATTACKER_Q, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_MIN_DEPTH, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, COMMIT_REVEAL_MIN_DEPTH, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DEPLOY_KEYS, DOMAIN, type DeployRecord, FCLAIM_KEYS, FCLAIM_MAX_EPOCH_AHEAD, FCLAIM_WINDOW_MIN, FEE_BPS, FEE_BPS_V16, FEE_GATE_MARGIN_BLOCKS, FILL_TIP_MARGIN, FINALIZE_TIP_MARGIN, type FclaimRecord, type FillEndorsement, type FillEntry, type FillOutputPlan, type FillPreview, type FillSafety, type FillSpvIo, type FillVerdict, GAP_NEEDED, type Give, HASH_RE, type HoldReplay, type LegacyBindOpts, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MINT_KEYS, type MintRecord, type MintedProvenOfferTerms, NAME_FEE_LEN3_V24, NAME_FEE_LEN4_V24, NAME_FEE_LONG_V24, NAME_FEE_MID_V24, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NFINALIZE_KEYS, NPROFILE_KEYS, type NameCommitRecord, type NameFinalizeRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, OFFER_KEYS, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, type ProvenAttest, type ProvenEvent, type ProvenOfferTerms, type ProvenPropose, REBATE_BPS, REBATE_FLAT, REG_COMMIT_MAX_BLOCKS, REG_FINALIZE_GRACE_BLOCKS, RESERVED_NAMES, SALT_RE, SCAN_MARGIN, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, TRANSFER_KEYS, TREASURY_ADDR, type TokenMetaRecord, type TokenState, type TransferRecord, V11_HEIGHT, V12_HEIGHT, V13_HEIGHT, V14_HEIGHT, V15_HEIGHT, V16_HEIGHT, V17_HEIGHT, V18_HEIGHT, V19_HEIGHT, V20_HEIGHT, V21_HEIGHT, V22_HEIGHT, V23_HEIGHT, V24_HEIGHT, V25_HEIGHT, V26_HEIGHT, V27_HEIGHT, V28_HEIGHT, V29_HEIGHT, type Want, ZERO_ADDR, bid, bindOfferTerms, bindProvenOffer, buildFeeHeight, buildRecord, burnedPayment, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy, expiredClaimFee, fclaim, fclaimEpochFor, fclaimHoldEnd, feeBpsAt, fillEndorsement, fillIsSafe, fillOutputPlan, fillTargetId, finalizeWinnerCheck, hasLiveClaim, isName, isNameGive, isOpenClaimLane, isTokenWant, makerRebate, mint, myProvenFillClosedOffer, nameClaim, nameCommit, nameCommitRecord, nameFinalize, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, offerExpiryHeightOf, paidToFromOutputs, parseAmount, parseRecord, pickPrimaryName, previewFill, primaryRankBefore, provenOfferTerms, ptAmt, replayLiveHold, requiredClaimDepth, requiredFillOutputs, resolve, tokenMeta, tradeFee, transfer, unsafeMintProvenOfferTerms, verifyFillSpv };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { EPOCH_LEN, HALVING_INTERVAL, INITIAL_REWARD, MIN_FEE_ATTEST, MIN_FEE_PROPOSE, blockReward, canonicalJson, payloadHash } from '@inversealtruism/csd-codec';
|
|
1
|
+
export { EPOCH_LEN, HALVING_INTERVAL, INITIAL_REWARD, MIN_FEE_ATTEST, MIN_FEE_PROPOSE, blockReward, canonicalJson, epochOf, payloadHash } from '@inversealtruism/csd-codec';
|
|
2
2
|
|
|
3
3
|
declare const DOMAIN = "cairnx:v1";
|
|
4
4
|
declare const ACTIVATION_HEIGHT = 29860;
|
|
@@ -74,7 +74,6 @@ declare const V26_HEIGHT = 46480;
|
|
|
74
74
|
declare const V27_HEIGHT = 46520;
|
|
75
75
|
declare const V28_HEIGHT = 60000;
|
|
76
76
|
declare const V29_HEIGHT = 88000;
|
|
77
|
-
declare const epochOf: (height: number) => number;
|
|
78
77
|
declare const claimWindowAt: (height: number) => number;
|
|
79
78
|
declare const FCLAIM_WINDOW_MIN: number;
|
|
80
79
|
declare const claimWindowOf: (claimUntilHeight: number, claimTxid?: string) => number;
|
|
@@ -427,6 +426,7 @@ declare const tokenMeta: (r: Omit<TokenMetaRecord, "v" | "t">) => BuiltRecord;
|
|
|
427
426
|
declare const nameProfile: (r: Omit<NameProfileRecord, "v" | "t">) => BuiltRecord;
|
|
428
427
|
declare const fclaim: (r: Omit<FclaimRecord, "v" | "t">) => BuiltRecord;
|
|
429
428
|
|
|
429
|
+
declare function ptAmt(v: unknown): bigint;
|
|
430
430
|
declare function resolve(events: ChainEvent[], tipHeight: number): CairnXState;
|
|
431
431
|
/** Canonical serialization of state (FORMAT 2) — byte-identical across honest resolvers.
|
|
432
432
|
* The canonical surface is the DATA ONLY: {tipHeight, tokens, balances, names, offers, bids,
|
|
@@ -688,6 +688,8 @@ interface FillVerdict {
|
|
|
688
688
|
* across offers, so without this the surface would false-accept a cap-denied fclaim. `opts.pay` overrides the
|
|
689
689
|
* payment (base units to want.payto) for a PARTIAL tail-fill; defaults to the offer's full want.value.
|
|
690
690
|
*
|
|
691
|
+
* `opts.sums` is caller data (the per-address outputs the caller is about to build), so it cannot default on:
|
|
692
|
+
* without it there is nothing to bind. A caller that omits it keeps the overpay exposure described next.
|
|
691
693
|
* `opts.sums` (OPT-IN, B6a / REBIND W3; default OFF = byte-identical verdicts for existing callers) binds the
|
|
692
694
|
* caller's PLANNED per-address CSD payment sums to the PROVEN offer state: requiredFillOutputs is re-run over
|
|
693
695
|
* the merkle-proven, replayed offer (so `paid`/`delivered` are the chain's, not a served lie) and the caller's
|
|
@@ -739,24 +741,30 @@ declare function provenOfferTerms(offerRec: OfferRecord, provenHeight: number):
|
|
|
739
741
|
* `value` is bound only when `t.value` is defined so a token<->token offer (no CSD value) is not spuriously
|
|
740
742
|
* refused; a caller that binds want.value separately (the site does) may still pass it here (redundant-safe).
|
|
741
743
|
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
744
|
+
* The give and wantType legs (REBIND W2 legs + W7) are ON by default. Their third-argument switches opt out
|
|
745
|
+
* explicitly (`false`); omitted or `undefined` keeps a leg on. With a leg on the terms must be MINTED (the
|
|
746
|
+
* brand), because a hand-built terms object leaves the give/wantType fields undefined and would refuse every
|
|
747
|
+
* honest fill (the W2 trap this file documents). A plain ProvenOfferTerms is accepted only with both legs
|
|
748
|
+
* off, which is the pre-B6 predicate exactly (`scripts/seal-differential.mjs` step 5).
|
|
749
|
+
* give - bind give.ticker / give.amount / give.name: EXPLICIT PRESENCE (a served give growing or
|
|
750
|
+
* losing a field mismatches) AND verbatim string equality. Closes the W7 shortchange (a
|
|
751
|
+
* genuine offer served with give.amount inflated a millionfold passes every other leg).
|
|
752
|
+
* wantType - the SYMMETRIC want-type refusal: the served offer's want type (token iff want.ticker is
|
|
753
|
+
* a string, the isTokenWant pivot) must equal the proven type. The value leg already
|
|
754
|
+
* catches proven-CSD-served-as-token (String(undefined) mismatches t.value); this closes
|
|
755
|
+
* the reverse, proven-token-served-as-CSD.
|
|
753
756
|
*/
|
|
754
757
|
interface BindTermsOpts {
|
|
755
758
|
give?: boolean;
|
|
756
759
|
wantType?: boolean;
|
|
757
760
|
}
|
|
758
|
-
|
|
759
|
-
|
|
761
|
+
/** Both legs off: the pre-B6 verdict, for callers that hold hand-built (unminted) terms. */
|
|
762
|
+
type LegacyBindOpts = {
|
|
763
|
+
give: false;
|
|
764
|
+
wantType: false;
|
|
765
|
+
};
|
|
766
|
+
declare function bindOfferTerms(servedOffer: unknown, t: MintedProvenOfferTerms, opts?: BindTermsOpts): boolean;
|
|
767
|
+
declare function bindOfferTerms(servedOffer: unknown, t: ProvenOfferTerms, opts: LegacyBindOpts): boolean;
|
|
760
768
|
declare function bindProvenOffer(offerEv: ProvenPropose): {
|
|
761
769
|
payto: string;
|
|
762
770
|
seller: string;
|
|
@@ -767,5 +775,27 @@ declare function paidToFromOutputs(outputs: readonly {
|
|
|
767
775
|
addr: string;
|
|
768
776
|
value: number;
|
|
769
777
|
}[]): Record<string, string>;
|
|
778
|
+
/** What a record resolve() refused paid to the parties the protocol pays, read with the resolver's ptAmt:
|
|
779
|
+
* `treasury` is the output to TREASURY_ADDR, `counterparty` the outputs to the target offer's seller and
|
|
780
|
+
* want.payto (pass `offer` for a fill, omit it otherwise). Each address counts once and the payer's own
|
|
781
|
+
* outputs never count, so a payer paying itself burns nothing. */
|
|
782
|
+
declare function burnedPayment(paidTo: Readonly<Record<string, unknown>> | undefined, payer: string, offer?: Pick<OfferState, "seller" | "want"> | null): {
|
|
783
|
+
treasury: bigint;
|
|
784
|
+
counterparty: bigint;
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* True only when `fill` proves `me`'s own fill CLOSED the offer behind `fclaim` before `grantHeight`, so a
|
|
789
|
+
* resolver at a grant height >= V29_HEIGHT no longer counts that hold. `fill` and `offerEv` must be
|
|
790
|
+
* merkle-proven and prevout-bound by the caller. The fill must be a SCORE_FILL by `me` on exactly this fclaim,
|
|
791
|
+
* mined strictly after the fclaim and strictly before the grant, and carry every output of a FULL fill of the
|
|
792
|
+
* proven offer (want.value to payto, the fee, the maker rebate), read as the resolver reads them (ptAmt).
|
|
793
|
+
* A partial-lane offer closed by a remainder fill stays counted: the remainder depends on the served `paid`.
|
|
794
|
+
*/
|
|
795
|
+
declare function myProvenFillClosedOffer(fill: ProvenEvent | null, fclaim: {
|
|
796
|
+
id: string;
|
|
797
|
+
height: number;
|
|
798
|
+
offer: string;
|
|
799
|
+
}, offerEv: ProvenEvent | null, me: string, grantHeight: number): boolean;
|
|
770
800
|
|
|
771
|
-
export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, type BindTermsOpts, type BuiltRecord, CLAIM_ATTACKER_Q, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_MIN_DEPTH, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, COMMIT_REVEAL_MIN_DEPTH, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DEPLOY_KEYS, DOMAIN, type DeployRecord, FCLAIM_KEYS, FCLAIM_MAX_EPOCH_AHEAD, FCLAIM_WINDOW_MIN, FEE_BPS, FEE_BPS_V16, FEE_GATE_MARGIN_BLOCKS, FILL_TIP_MARGIN, FINALIZE_TIP_MARGIN, type FclaimRecord, type FillEndorsement, type FillEntry, type FillOutputPlan, type FillPreview, type FillSafety, type FillSpvIo, type FillVerdict, GAP_NEEDED, type Give, HASH_RE, type HoldReplay, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MINT_KEYS, type MintRecord, type MintedProvenOfferTerms, NAME_FEE_LEN3_V24, NAME_FEE_LEN4_V24, NAME_FEE_LONG_V24, NAME_FEE_MID_V24, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NFINALIZE_KEYS, NPROFILE_KEYS, type NameCommitRecord, type NameFinalizeRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, OFFER_KEYS, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, type ProvenAttest, type ProvenEvent, type ProvenOfferTerms, type ProvenPropose, REBATE_BPS, REBATE_FLAT, REG_COMMIT_MAX_BLOCKS, REG_FINALIZE_GRACE_BLOCKS, RESERVED_NAMES, SALT_RE, SCAN_MARGIN, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, TRANSFER_KEYS, TREASURY_ADDR, type TokenMetaRecord, type TokenState, type TransferRecord, V11_HEIGHT, V12_HEIGHT, V13_HEIGHT, V14_HEIGHT, V15_HEIGHT, V16_HEIGHT, V17_HEIGHT, V18_HEIGHT, V19_HEIGHT, V20_HEIGHT, V21_HEIGHT, V22_HEIGHT, V23_HEIGHT, V24_HEIGHT, V25_HEIGHT, V26_HEIGHT, V27_HEIGHT, V28_HEIGHT, V29_HEIGHT, type Want, ZERO_ADDR, bid, bindOfferTerms, bindProvenOffer, buildFeeHeight, buildRecord, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy,
|
|
801
|
+
export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, type BindTermsOpts, type BuiltRecord, CLAIM_ATTACKER_Q, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_MIN_DEPTH, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, COMMIT_REVEAL_MIN_DEPTH, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DEPLOY_KEYS, DOMAIN, type DeployRecord, FCLAIM_KEYS, FCLAIM_MAX_EPOCH_AHEAD, FCLAIM_WINDOW_MIN, FEE_BPS, FEE_BPS_V16, FEE_GATE_MARGIN_BLOCKS, FILL_TIP_MARGIN, FINALIZE_TIP_MARGIN, type FclaimRecord, type FillEndorsement, type FillEntry, type FillOutputPlan, type FillPreview, type FillSafety, type FillSpvIo, type FillVerdict, GAP_NEEDED, type Give, HASH_RE, type HoldReplay, type LegacyBindOpts, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MINT_KEYS, type MintRecord, type MintedProvenOfferTerms, NAME_FEE_LEN3_V24, NAME_FEE_LEN4_V24, NAME_FEE_LONG_V24, NAME_FEE_MID_V24, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NFINALIZE_KEYS, NPROFILE_KEYS, type NameCommitRecord, type NameFinalizeRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, OFFER_KEYS, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, type ProvenAttest, type ProvenEvent, type ProvenOfferTerms, type ProvenPropose, REBATE_BPS, REBATE_FLAT, REG_COMMIT_MAX_BLOCKS, REG_FINALIZE_GRACE_BLOCKS, RESERVED_NAMES, SALT_RE, SCAN_MARGIN, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, TRANSFER_KEYS, TREASURY_ADDR, type TokenMetaRecord, type TokenState, type TransferRecord, V11_HEIGHT, V12_HEIGHT, V13_HEIGHT, V14_HEIGHT, V15_HEIGHT, V16_HEIGHT, V17_HEIGHT, V18_HEIGHT, V19_HEIGHT, V20_HEIGHT, V21_HEIGHT, V22_HEIGHT, V23_HEIGHT, V24_HEIGHT, V25_HEIGHT, V26_HEIGHT, V27_HEIGHT, V28_HEIGHT, V29_HEIGHT, type Want, ZERO_ADDR, bid, bindOfferTerms, bindProvenOffer, buildFeeHeight, buildRecord, burnedPayment, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy, expiredClaimFee, fclaim, fclaimEpochFor, fclaimHoldEnd, feeBpsAt, fillEndorsement, fillIsSafe, fillOutputPlan, fillTargetId, finalizeWinnerCheck, hasLiveClaim, isName, isNameGive, isOpenClaimLane, isTokenWant, makerRebate, mint, myProvenFillClosedOffer, nameClaim, nameCommit, nameCommitRecord, nameFinalize, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, offerExpiryHeightOf, paidToFromOutputs, parseAmount, parseRecord, pickPrimaryName, previewFill, primaryRankBefore, provenOfferTerms, ptAmt, replayLiveHold, requiredClaimDepth, requiredFillOutputs, resolve, tokenMeta, tradeFee, transfer, unsafeMintProvenOfferTerms, verifyFillSpv };
|