@inversealtruism/cairnx-core 0.1.18 → 0.1.20

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/README.md CHANGED
@@ -57,3 +57,54 @@ console.log(state.tokens.CAIRN, state.balances.CAIRN, state.names);
57
57
 
58
58
  The invariant after v1.3+v1.4: **a buyer can never lose more than the anchor fee** — not to a
59
59
  racing buyer, not to a malicious seller.
60
+
61
+ ## ★ Single source of truth — consumers & how to change consensus without drift
62
+
63
+ **This package is the ONE canonical implementation of the CairnX convention.** Every consumer in the
64
+ ecosystem **imports** its constants / regexes / fee+claim+expiry math / `canonicalJson` / `parseRecord`
65
+ from here (directly via npm, or via a *deterministic vendored esbuild* of this exact dist where a
66
+ browser/MV3 constraint forbids a runtime dep tree). **Nothing re-declares a consensus value by hand** — a
67
+ hand-mirror that drifts across a version bump is a silent chain fork, which is exactly the bug class the
68
+ 2026-06-24 shared-core de-duplication (`cairn/docs/Plans/46`) deleted. Do not re-introduce one.
69
+
70
+ | Consumer | How it gets consensus | Guard |
71
+ |---|---|---|
72
+ | **cairnx svc** (`cairnx/`, the live resolver `:8794`) | npm pin → `src/resolve.ts` re-export shim | svc replay-hash conformance |
73
+ | **cairn /trade + /names UI** (browser) | `public/vendor/cairnx-core.js` — esbuild of this dist; `helpers.js` imports+re-exports it | `test/vendor-cairnx-parity.test.mjs` (consumer golden) + `scripts/check-vendor-fresh.mjs` (CI) |
74
+ | **cairn-wallet** (MV3 extension, fund custody) | `src/vendor/cairnx-spv.js` — esbuild of this dist (`export *`); `core/cairnx.ts` imports it | `test/cairnx.ts` (fixtures vs this pkg) + `scripts/check-vendor-fresh.mjs` + `PROVENANCE.json` |
75
+ | **cairn-cli** | npm pin → `src/lib/cairnx.ts` imports the regexes/limits | `test/cairnx.mjs` |
76
+ | **cairn server** (`cairn/src`) | proxies reads to the cairnx svc; imports `csd-*` (codec/crypto/tx) via `file:` | — |
77
+ | **the Python oracle** `conformance/cairnx_ref.py` | INDEPENDENT re-implementation (the differential — **KEEP**, never collapse) | `test:crosslang` (JS⇄Python) |
78
+
79
+ ### Versioning (independent cadence)
80
+
81
+ `cairnx-core` versions on its **own** consensus cadence (it bumps when the convention changes); the stable
82
+ `csd-*` primitives version on theirs. They need **not** share a version — coherence comes from `workspace:*`
83
+ inter-deps (pnpm freezes each to the exact published version at publish), enforced by `scripts/check-lockstep.mjs`.
84
+ **Never publish two different builds under one version** (the M4 hazard): bump the version whenever the bytes change.
85
+
86
+ ### To make a CONSENSUS change (the whole flow — edit ONE source, not 4–5 mirrors)
87
+
88
+ 1. Edit `src/` here **and** the Python oracle `conformance/cairnx_ref.py` (the differential). Add a height-gated
89
+ activation (`V*_HEIGHT`) — never reinterpret history; add/extend a vector in `test/vectors/cases.json`.
90
+ 2. `pnpm --filter @inversealtruism/cairnx-core build` · `pnpm --filter @inversealtruism/cairnx-core test` ·
91
+ `pnpm test:crosslang` (JS≡Python) · `node scripts/check-lockstep.mjs`. All green.
92
+ 3. **Bump** `package.json` version. `pnpm publish` (converts `workspace:*` → the exact csd-* version).
93
+ 4. **Rebuild + recommit the two vendored bundles** (they are generated artifacts, not hand-copies):
94
+ `cd cairn && bash scripts/build-trade-vendor.sh` → commit `public/vendor/cairnx-core.js`; `node scripts/check-vendor-fresh.mjs`.
95
+ `cd cairn-wallet && bash scripts/build-spv-vendor.sh` → `node scripts/check-vendor-fresh.mjs --write` (regen PROVENANCE) → commit the bundle + `PROVENANCE.json`.
96
+ *(esbuild is version-pinned in each repo — same version → byte-reproducible bundle; the freshness gates fail loud on a stale bundle.)*
97
+ 5. **Re-pin every consumer** to the new version (cairnx svc + cairn-cli `package.json`) and, for a height-gated
98
+ change, **deploy all consumers BETWEEN activation heights, not across one** (below the gate the output is
99
+ byte-identical to history, so the rollout is safe).
100
+ 6. Restart the cairnx svc; run its replay-hash conformance; (wallet) run the release flow + CWS upload.
101
+
102
+ ### For agents / contributors
103
+
104
+ - **Never hand-declare a CairnX consensus constant/regex/formula in a consumer.** Import it from this package
105
+ (or its vendored bundle). If you find a hand-mirror, collapse it — don't add a guard.
106
+ - A new exported symbol must be added to the consumers' import+re-export lists (`helpers.js`, `core/cairnx.ts`)
107
+ and to the wallet's `cairnx-spv.d.ts`; the build scripts' export-assertion lists catch a dropped one.
108
+ - The KEEP-list (do **not** collapse — these are *verification*, not duplication): the Python oracle, the
109
+ wallet/swapguard SPV light-client + `namespv.ts`, the wallet `core/csdtx.ts` tx-codec twin, the portable
110
+ vectors. The cross-language differential is the trust model — keep it intact.
package/dist/index.cjs CHANGED
@@ -23,29 +23,42 @@ __export(index_exports, {
23
23
  ACTIVATION_HEIGHT: () => ACTIVATION_HEIGHT,
24
24
  ADDR_RE: () => ADDR_RE,
25
25
  AMOUNT_RE: () => AMOUNT_RE,
26
+ BID_KEYS: () => BID_KEYS,
27
+ CLAIM_ATTACKER_Q: () => CLAIM_ATTACKER_Q,
26
28
  CLAIM_COOLDOWN_BLOCKS: () => CLAIM_COOLDOWN_BLOCKS,
27
29
  CLAIM_FILL_GRACE_BLOCKS: () => CLAIM_FILL_GRACE_BLOCKS,
30
+ CLAIM_MIN_DEPTH: () => CLAIM_MIN_DEPTH,
28
31
  CLAIM_WINDOW_BLOCKS: () => CLAIM_WINDOW_BLOCKS,
29
32
  CLAIM_WINDOW_BLOCKS_V20: () => CLAIM_WINDOW_BLOCKS_V20,
30
33
  COMMIT_MAX_BLOCKS: () => COMMIT_MAX_BLOCKS,
34
+ COMMIT_REVEAL_MIN_DEPTH: () => COMMIT_REVEAL_MIN_DEPTH,
31
35
  CONF_TOKEN_FILL: () => CONF_TOKEN_FILL,
32
36
  DEPLOY_FEE: () => DEPLOY_FEE,
37
+ DEPLOY_KEYS: () => DEPLOY_KEYS,
33
38
  DOMAIN: () => DOMAIN,
34
- EPOCH_LEN: () => import_csd_codec.EPOCH_LEN,
39
+ EPOCH_LEN: () => import_csd_codec4.EPOCH_LEN,
35
40
  FEE_BPS: () => FEE_BPS,
36
41
  FEE_BPS_V16: () => FEE_BPS_V16,
42
+ HALVING_INTERVAL: () => import_csd_codec4.HALVING_INTERVAL,
37
43
  HASH_RE: () => HASH_RE,
44
+ INITIAL_REWARD: () => import_csd_codec4.INITIAL_REWARD,
38
45
  MAX_ACTIVE_CLAIMS: () => MAX_ACTIVE_CLAIMS,
39
46
  MAX_AMOUNT: () => MAX_AMOUNT,
40
47
  MAX_OFFER_EPOCHS: () => MAX_OFFER_EPOCHS,
41
48
  MAX_RECORD_BYTES: () => MAX_RECORD_BYTES,
49
+ MINT_KEYS: () => MINT_KEYS,
50
+ MIN_FEE_ATTEST: () => import_csd_codec4.MIN_FEE_ATTEST,
51
+ MIN_FEE_PROPOSE: () => import_csd_codec4.MIN_FEE_PROPOSE,
42
52
  NAME_FEE_SHORT_V18: () => NAME_FEE_SHORT_V18,
43
53
  NAME_FEE_V18: () => NAME_FEE_V18,
44
54
  NAME_GRACE_EPOCHS: () => NAME_GRACE_EPOCHS,
55
+ NAME_KEYS: () => NAME_KEYS,
45
56
  NAME_PREMIUM_DECAY_EPOCHS: () => NAME_PREMIUM_DECAY_EPOCHS,
46
57
  NAME_PREMIUM_START: () => NAME_PREMIUM_START,
47
58
  NAME_RE: () => NAME_RE,
48
59
  NAME_TERM_EPOCHS: () => NAME_TERM_EPOCHS,
60
+ NPROFILE_KEYS: () => NPROFILE_KEYS,
61
+ OFFER_KEYS: () => OFFER_KEYS,
49
62
  PKEY: () => PKEY,
50
63
  PROFILE_MAX_KEYS: () => PROFILE_MAX_KEYS,
51
64
  PROFILE_MAX_VALUE_BYTES: () => PROFILE_MAX_VALUE_BYTES,
@@ -57,6 +70,7 @@ __export(index_exports, {
57
70
  SCORE_CLAIM: () => SCORE_CLAIM,
58
71
  SCORE_FILL: () => SCORE_FILL,
59
72
  TICKER_RE: () => TICKER_RE,
73
+ TRANSFER_KEYS: () => TRANSFER_KEYS,
60
74
  TREASURY_ADDR: () => TREASURY_ADDR,
61
75
  V11_HEIGHT: () => V11_HEIGHT,
62
76
  V12_HEIGHT: () => V12_HEIGHT,
@@ -69,9 +83,15 @@ __export(index_exports, {
69
83
  V19_HEIGHT: () => V19_HEIGHT,
70
84
  V20_HEIGHT: () => V20_HEIGHT,
71
85
  V21_HEIGHT: () => V21_HEIGHT,
86
+ V22_HEIGHT: () => V22_HEIGHT,
72
87
  bid: () => bid,
88
+ blockReward: () => import_csd_codec4.blockReward,
73
89
  buildRecord: () => buildRecord,
90
+ canonicalJson: () => import_csd_codec4.canonicalJson,
74
91
  canonicalState: () => canonicalState,
92
+ claimGraceOf: () => claimGraceOf,
93
+ claimWindowAt: () => claimWindowAt,
94
+ claimWindowOf: () => claimWindowOf,
75
95
  deploy: () => deploy,
76
96
  epochOf: () => epochOf,
77
97
  expiredClaimFee: () => expiredClaimFee,
@@ -90,8 +110,11 @@ __export(index_exports, {
90
110
  nameXfer: () => nameXfer,
91
111
  offer: () => offer,
92
112
  offerCancelAll: () => offerCancelAll,
113
+ offerExpiryHeightOf: () => offerExpiryHeightOf,
93
114
  parseAmount: () => parseAmount,
94
115
  parseRecord: () => parseRecord,
116
+ payloadHash: () => import_csd_codec4.payloadHash,
117
+ requiredClaimDepth: () => requiredClaimDepth,
95
118
  resolve: () => resolve,
96
119
  tokenMeta: () => tokenMeta,
97
120
  tradeFee: () => tradeFee,
@@ -145,6 +168,7 @@ var V19_HEIGHT = 36700;
145
168
  var V20_HEIGHT = 38400;
146
169
  var V21_HEIGHT = 40100;
147
170
  var MAX_OFFER_EPOCHS = 168;
171
+ var V22_HEIGHT = 41300;
148
172
  var PKEY = /^[a-z0-9](?:[a-z0-9.-]{0,30}[a-z0-9])?$/;
149
173
  var PROFILE_MAX_KEYS = 16;
150
174
  var PROFILE_MAX_VALUE_BYTES = 256;
@@ -168,6 +192,15 @@ var SALT_RE = /^[0-9a-fA-F]{16,128}$/;
168
192
  var RESERVED_NAMES = /* @__PURE__ */ new Set(["csd", "treasury", "admin", "official", "root", "www", "support"]);
169
193
  var COMMIT_MAX_BLOCKS = 8 * import_csd_codec.EPOCH_LEN;
170
194
  var epochOf = (height) => Math.floor(height / import_csd_codec.EPOCH_LEN);
195
+ var claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
196
+ var claimWindowOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
197
+ var claimGraceOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_FILL_GRACE_BLOCKS : 0;
198
+ var offerExpiryHeightOf = (expiresEpoch, anchorHeight) => {
199
+ const raw = (Number(expiresEpoch ?? 0) + 1) * import_csd_codec.EPOCH_LEN;
200
+ if (anchorHeight >= V22_HEIGHT) return raw;
201
+ const capped = (epochOf(anchorHeight) + MAX_OFFER_EPOCHS + 1) * import_csd_codec.EPOCH_LEN;
202
+ return Math.min(raw, Math.max(V21_HEIGHT, capped));
203
+ };
171
204
  var isNameGive = (g) => typeof g.name === "string";
172
205
  var isTokenWant = (w) => typeof w.ticker === "string";
173
206
 
@@ -442,7 +475,7 @@ function resolve(events, tipHeight) {
442
475
  b.available += amt;
443
476
  }
444
477
  };
445
- const effExpiry = (e, height) => height >= V21_HEIGHT ? Math.min(e.expiresEpoch, epochOf(e.height) + MAX_OFFER_EPOCHS) : e.expiresEpoch;
478
+ 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;
446
479
  const sweepExpired = (height) => {
447
480
  const ep = epochOf(height);
448
481
  for (const o of offers.values()) {
@@ -464,9 +497,8 @@ function resolve(events, tipHeight) {
464
497
  const b = bids.get(o.bid);
465
498
  if (b && b.status === "open" && b.bidder === buyer) b.status = "done";
466
499
  };
467
- const claimGrace = (o) => o.claimUntilHeight !== void 0 && o.claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_FILL_GRACE_BLOCKS : 0;
500
+ const claimGrace = (o) => o.claimUntilHeight !== void 0 ? claimGraceOf(o.claimUntilHeight) : 0;
468
501
  const claimHeld = (o, height) => o.claimedBy !== void 0 && o.claimUntilHeight !== void 0 && height < o.claimUntilHeight + claimGrace(o);
469
- const claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
470
502
  const openFillReject = (o, height, who) => {
471
503
  if (!(height >= V13_HEIGHT && !o.taker)) return void 0;
472
504
  if (height < V17_HEIGHT) return "v1.3: open CSD-quoted fills disabled (offer must be taker-bound)";
@@ -712,7 +744,7 @@ function resolve(events, tipHeight) {
712
744
  note(ev, ev.id, "offer", false, "already expired at anchor");
713
745
  continue;
714
746
  }
715
- if (ev.height >= V21_HEIGHT && ev.expiresEpoch - epochOf(ev.height) > MAX_OFFER_EPOCHS) {
747
+ if (ev.height >= V21_HEIGHT && ev.height < V22_HEIGHT && ev.expiresEpoch - epochOf(ev.height) > MAX_OFFER_EPOCHS) {
716
748
  note(ev, ev.id, "offer", false, "v2.1: offer duration exceeds the max");
717
749
  continue;
718
750
  }
@@ -785,7 +817,7 @@ function resolve(events, tipHeight) {
785
817
  note(ev, ev.id, "bid", false, "already expired at anchor");
786
818
  continue;
787
819
  }
788
- if (ev.height >= V21_HEIGHT && ev.expiresEpoch - epochOf(ev.height) > MAX_OFFER_EPOCHS) {
820
+ if (ev.height >= V21_HEIGHT && ev.height < V22_HEIGHT && ev.expiresEpoch - epochOf(ev.height) > MAX_OFFER_EPOCHS) {
789
821
  note(ev, ev.id, "bid", false, "v2.1: bid duration exceeds the max");
790
822
  continue;
791
823
  }
@@ -1150,34 +1182,66 @@ function canonicalState(s) {
1150
1182
  const { events: _events, ...data } = s;
1151
1183
  return JSON.stringify(sortKeys(data));
1152
1184
  }
1185
+
1186
+ // src/client.ts
1187
+ var import_csd_codec3 = require("@inversealtruism/csd-codec");
1188
+ var CLAIM_ATTACKER_Q = 0.2;
1189
+ var CLAIM_MIN_DEPTH = 3;
1190
+ var COMMIT_REVEAL_MIN_DEPTH = 3;
1191
+ function requiredClaimDepth(valueSats, height) {
1192
+ const r = CLAIM_ATTACKER_Q / (1 - CLAIM_ATTACKER_Q);
1193
+ const V = Number(valueSats);
1194
+ const R = (0, import_csd_codec3.blockReward)(height) || import_csd_codec3.INITIAL_REWARD;
1195
+ const max = claimWindowAt(height) - 5;
1196
+ for (let D = CLAIM_MIN_DEPTH; D <= max; D++) {
1197
+ if (Math.pow(r, D) * V <= D * R) return { depth: D, reversalPct: Math.pow(r, D) * 100, capped: false };
1198
+ }
1199
+ return { depth: max, reversalPct: Math.pow(r, max) * 100, capped: true };
1200
+ }
1201
+
1202
+ // src/index.ts
1203
+ var import_csd_codec4 = require("@inversealtruism/csd-codec");
1153
1204
  // Annotate the CommonJS export names for ESM import in node:
1154
1205
  0 && (module.exports = {
1155
1206
  ACTIVATION_HEIGHT,
1156
1207
  ADDR_RE,
1157
1208
  AMOUNT_RE,
1209
+ BID_KEYS,
1210
+ CLAIM_ATTACKER_Q,
1158
1211
  CLAIM_COOLDOWN_BLOCKS,
1159
1212
  CLAIM_FILL_GRACE_BLOCKS,
1213
+ CLAIM_MIN_DEPTH,
1160
1214
  CLAIM_WINDOW_BLOCKS,
1161
1215
  CLAIM_WINDOW_BLOCKS_V20,
1162
1216
  COMMIT_MAX_BLOCKS,
1217
+ COMMIT_REVEAL_MIN_DEPTH,
1163
1218
  CONF_TOKEN_FILL,
1164
1219
  DEPLOY_FEE,
1220
+ DEPLOY_KEYS,
1165
1221
  DOMAIN,
1166
1222
  EPOCH_LEN,
1167
1223
  FEE_BPS,
1168
1224
  FEE_BPS_V16,
1225
+ HALVING_INTERVAL,
1169
1226
  HASH_RE,
1227
+ INITIAL_REWARD,
1170
1228
  MAX_ACTIVE_CLAIMS,
1171
1229
  MAX_AMOUNT,
1172
1230
  MAX_OFFER_EPOCHS,
1173
1231
  MAX_RECORD_BYTES,
1232
+ MINT_KEYS,
1233
+ MIN_FEE_ATTEST,
1234
+ MIN_FEE_PROPOSE,
1174
1235
  NAME_FEE_SHORT_V18,
1175
1236
  NAME_FEE_V18,
1176
1237
  NAME_GRACE_EPOCHS,
1238
+ NAME_KEYS,
1177
1239
  NAME_PREMIUM_DECAY_EPOCHS,
1178
1240
  NAME_PREMIUM_START,
1179
1241
  NAME_RE,
1180
1242
  NAME_TERM_EPOCHS,
1243
+ NPROFILE_KEYS,
1244
+ OFFER_KEYS,
1181
1245
  PKEY,
1182
1246
  PROFILE_MAX_KEYS,
1183
1247
  PROFILE_MAX_VALUE_BYTES,
@@ -1189,6 +1253,7 @@ function canonicalState(s) {
1189
1253
  SCORE_CLAIM,
1190
1254
  SCORE_FILL,
1191
1255
  TICKER_RE,
1256
+ TRANSFER_KEYS,
1192
1257
  TREASURY_ADDR,
1193
1258
  V11_HEIGHT,
1194
1259
  V12_HEIGHT,
@@ -1201,9 +1266,15 @@ function canonicalState(s) {
1201
1266
  V19_HEIGHT,
1202
1267
  V20_HEIGHT,
1203
1268
  V21_HEIGHT,
1269
+ V22_HEIGHT,
1204
1270
  bid,
1271
+ blockReward,
1205
1272
  buildRecord,
1273
+ canonicalJson,
1206
1274
  canonicalState,
1275
+ claimGraceOf,
1276
+ claimWindowAt,
1277
+ claimWindowOf,
1207
1278
  deploy,
1208
1279
  epochOf,
1209
1280
  expiredClaimFee,
@@ -1222,8 +1293,11 @@ function canonicalState(s) {
1222
1293
  nameXfer,
1223
1294
  offer,
1224
1295
  offerCancelAll,
1296
+ offerExpiryHeightOf,
1225
1297
  parseAmount,
1226
1298
  parseRecord,
1299
+ payloadHash,
1300
+ requiredClaimDepth,
1227
1301
  resolve,
1228
1302
  tokenMeta,
1229
1303
  tradeFee,
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { EPOCH_LEN } from '@inversealtruism/csd-codec';
1
+ export { EPOCH_LEN, HALVING_INTERVAL, INITIAL_REWARD, MIN_FEE_ATTEST, MIN_FEE_PROPOSE, blockReward, canonicalJson, payloadHash } from '@inversealtruism/csd-codec';
2
2
 
3
3
  declare const DOMAIN = "cairnx:v1";
4
4
  declare const ACTIVATION_HEIGHT = 29860;
@@ -41,6 +41,7 @@ declare const V19_HEIGHT = 36700;
41
41
  declare const V20_HEIGHT = 38400;
42
42
  declare const V21_HEIGHT = 40100;
43
43
  declare const MAX_OFFER_EPOCHS = 168;
44
+ declare const V22_HEIGHT = 41300;
44
45
  declare const PKEY: RegExp;
45
46
  declare const PROFILE_MAX_KEYS = 16;
46
47
  declare const PROFILE_MAX_VALUE_BYTES = 256;
@@ -56,6 +57,10 @@ declare const SALT_RE: RegExp;
56
57
  declare const RESERVED_NAMES: Set<string>;
57
58
  declare const COMMIT_MAX_BLOCKS: number;
58
59
  declare const epochOf: (height: number) => number;
60
+ declare const claimWindowAt: (height: number) => number;
61
+ declare const claimWindowOf: (claimUntilHeight: number) => number;
62
+ declare const claimGraceOf: (claimUntilHeight: number) => number;
63
+ declare const offerExpiryHeightOf: (expiresEpoch: number, anchorHeight: number) => number;
59
64
  interface DeployRecord {
60
65
  v: 1;
61
66
  t: "deploy";
@@ -329,6 +334,13 @@ declare function parseAmount(s: unknown, opts?: {
329
334
  declare const isName: (n: unknown) => n is string;
330
335
  /** Deterministic commit hash for front-run-proof name registration (commit-reveal). */
331
336
  declare function nameCommit(name: string, salt: string, owner: string): string;
337
+ declare const DEPLOY_KEYS: Set<string>;
338
+ declare const MINT_KEYS: Set<string>;
339
+ declare const TRANSFER_KEYS: Set<string>;
340
+ declare const OFFER_KEYS: Set<string>;
341
+ declare const BID_KEYS: Set<string>;
342
+ declare const NAME_KEYS: Set<string>;
343
+ declare const NPROFILE_KEYS: Set<string>;
332
344
  /**
333
345
  * Parse + validate a record from an anchored `uri`. Returns null for anything invalid —
334
346
  * per CONVENTION §3, invalid is a no-op, never an error that poisons the replay.
@@ -362,4 +374,25 @@ declare function resolve(events: ChainEvent[], tipHeight: number): CairnXState;
362
374
  * history.) Keys sort in ordinal (code-unit) order at every depth. */
363
375
  declare function canonicalState(s: CairnXState): string;
364
376
 
365
- export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, type BalanceState, type BidRecord, type BidState, type BidStatus, type BuiltRecord, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DOMAIN, type DeployRecord, FEE_BPS, FEE_BPS_V16, type FillEntry, type Give, HASH_RE, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_RECORD_BYTES, type MintRecord, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, type NameCommitRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, REBATE_BPS, REBATE_FLAT, RESERVED_NAMES, SALT_RE, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, 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, type Want, bid, buildRecord, canonicalState, deploy, epochOf, expiredClaimFee, isName, isNameGive, isTokenWant, makerRebate, mint, nameClaim, nameCommit, nameCommitRecord, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, parseAmount, parseRecord, resolve, tokenMeta, tradeFee, transfer };
377
+ declare const CLAIM_ATTACKER_Q = 0.2;
378
+ declare const CLAIM_MIN_DEPTH = 3;
379
+ declare const COMMIT_REVEAL_MIN_DEPTH = 3;
380
+ /**
381
+ * Confirmations the CLAIM must have before a payment-bearing fill on an open V17 offer worth `valueSats`
382
+ * (anchored at `height`) is reorg-safe. Returns `{ depth, reversalPct, capped }`; `capped=true` ⇒ the value
383
+ * exceeds what one claim window can safely settle (the buyer should split the trade).
384
+ *
385
+ * A MINORITY attacker (the dominant pool is trusted; a majority means the chain is already lost) only profits
386
+ * if `P(reverse D)·V > the honest reward it forgoes`, with `P(reverse D) ≈ (q/(1−q))^D` (gambler's ruin,
387
+ * Nakamoto §11). That is logarithmic in value → ~3 conf for nearly every trade, 4 for a whale. Everything is
388
+ * in CSD (block reward), so no USD price is needed. The required depth is capped at `claimWindow − 5` so a
389
+ * capped/whale value stays fillable for a usable multi-block span rather than a 1-block knife-edge (only
390
+ * absurd > total-supply values ever reach the cap).
391
+ */
392
+ declare function requiredClaimDepth(valueSats: number | bigint, height: number): {
393
+ depth: number;
394
+ reversalPct: number;
395
+ capped: boolean;
396
+ };
397
+
398
+ export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, 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, FEE_BPS, FEE_BPS_V16, type FillEntry, type Give, HASH_RE, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_RECORD_BYTES, MINT_KEYS, type MintRecord, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NPROFILE_KEYS, type NameCommitRecord, 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, REBATE_BPS, REBATE_FLAT, RESERVED_NAMES, SALT_RE, 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, type Want, bid, buildRecord, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy, epochOf, expiredClaimFee, isName, isNameGive, isTokenWant, makerRebate, mint, nameClaim, nameCommit, nameCommitRecord, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, offerExpiryHeightOf, parseAmount, parseRecord, requiredClaimDepth, resolve, tokenMeta, tradeFee, transfer };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { EPOCH_LEN } from '@inversealtruism/csd-codec';
1
+ export { EPOCH_LEN, HALVING_INTERVAL, INITIAL_REWARD, MIN_FEE_ATTEST, MIN_FEE_PROPOSE, blockReward, canonicalJson, payloadHash } from '@inversealtruism/csd-codec';
2
2
 
3
3
  declare const DOMAIN = "cairnx:v1";
4
4
  declare const ACTIVATION_HEIGHT = 29860;
@@ -41,6 +41,7 @@ declare const V19_HEIGHT = 36700;
41
41
  declare const V20_HEIGHT = 38400;
42
42
  declare const V21_HEIGHT = 40100;
43
43
  declare const MAX_OFFER_EPOCHS = 168;
44
+ declare const V22_HEIGHT = 41300;
44
45
  declare const PKEY: RegExp;
45
46
  declare const PROFILE_MAX_KEYS = 16;
46
47
  declare const PROFILE_MAX_VALUE_BYTES = 256;
@@ -56,6 +57,10 @@ declare const SALT_RE: RegExp;
56
57
  declare const RESERVED_NAMES: Set<string>;
57
58
  declare const COMMIT_MAX_BLOCKS: number;
58
59
  declare const epochOf: (height: number) => number;
60
+ declare const claimWindowAt: (height: number) => number;
61
+ declare const claimWindowOf: (claimUntilHeight: number) => number;
62
+ declare const claimGraceOf: (claimUntilHeight: number) => number;
63
+ declare const offerExpiryHeightOf: (expiresEpoch: number, anchorHeight: number) => number;
59
64
  interface DeployRecord {
60
65
  v: 1;
61
66
  t: "deploy";
@@ -329,6 +334,13 @@ declare function parseAmount(s: unknown, opts?: {
329
334
  declare const isName: (n: unknown) => n is string;
330
335
  /** Deterministic commit hash for front-run-proof name registration (commit-reveal). */
331
336
  declare function nameCommit(name: string, salt: string, owner: string): string;
337
+ declare const DEPLOY_KEYS: Set<string>;
338
+ declare const MINT_KEYS: Set<string>;
339
+ declare const TRANSFER_KEYS: Set<string>;
340
+ declare const OFFER_KEYS: Set<string>;
341
+ declare const BID_KEYS: Set<string>;
342
+ declare const NAME_KEYS: Set<string>;
343
+ declare const NPROFILE_KEYS: Set<string>;
332
344
  /**
333
345
  * Parse + validate a record from an anchored `uri`. Returns null for anything invalid —
334
346
  * per CONVENTION §3, invalid is a no-op, never an error that poisons the replay.
@@ -362,4 +374,25 @@ declare function resolve(events: ChainEvent[], tipHeight: number): CairnXState;
362
374
  * history.) Keys sort in ordinal (code-unit) order at every depth. */
363
375
  declare function canonicalState(s: CairnXState): string;
364
376
 
365
- export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, type BalanceState, type BidRecord, type BidState, type BidStatus, type BuiltRecord, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DOMAIN, type DeployRecord, FEE_BPS, FEE_BPS_V16, type FillEntry, type Give, HASH_RE, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_RECORD_BYTES, type MintRecord, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, type NameCommitRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, REBATE_BPS, REBATE_FLAT, RESERVED_NAMES, SALT_RE, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, 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, type Want, bid, buildRecord, canonicalState, deploy, epochOf, expiredClaimFee, isName, isNameGive, isTokenWant, makerRebate, mint, nameClaim, nameCommit, nameCommitRecord, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, parseAmount, parseRecord, resolve, tokenMeta, tradeFee, transfer };
377
+ declare const CLAIM_ATTACKER_Q = 0.2;
378
+ declare const CLAIM_MIN_DEPTH = 3;
379
+ declare const COMMIT_REVEAL_MIN_DEPTH = 3;
380
+ /**
381
+ * Confirmations the CLAIM must have before a payment-bearing fill on an open V17 offer worth `valueSats`
382
+ * (anchored at `height`) is reorg-safe. Returns `{ depth, reversalPct, capped }`; `capped=true` ⇒ the value
383
+ * exceeds what one claim window can safely settle (the buyer should split the trade).
384
+ *
385
+ * A MINORITY attacker (the dominant pool is trusted; a majority means the chain is already lost) only profits
386
+ * if `P(reverse D)·V > the honest reward it forgoes`, with `P(reverse D) ≈ (q/(1−q))^D` (gambler's ruin,
387
+ * Nakamoto §11). That is logarithmic in value → ~3 conf for nearly every trade, 4 for a whale. Everything is
388
+ * in CSD (block reward), so no USD price is needed. The required depth is capped at `claimWindow − 5` so a
389
+ * capped/whale value stays fillable for a usable multi-block span rather than a 1-block knife-edge (only
390
+ * absurd > total-supply values ever reach the cap).
391
+ */
392
+ declare function requiredClaimDepth(valueSats: number | bigint, height: number): {
393
+ depth: number;
394
+ reversalPct: number;
395
+ capped: boolean;
396
+ };
397
+
398
+ export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, 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, FEE_BPS, FEE_BPS_V16, type FillEntry, type Give, HASH_RE, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_RECORD_BYTES, MINT_KEYS, type MintRecord, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NPROFILE_KEYS, type NameCommitRecord, 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, REBATE_BPS, REBATE_FLAT, RESERVED_NAMES, SALT_RE, 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, type Want, bid, buildRecord, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy, epochOf, expiredClaimFee, isName, isNameGive, isTokenWant, makerRebate, mint, nameClaim, nameCommit, nameCommitRecord, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, offerExpiryHeightOf, parseAmount, parseRecord, requiredClaimDepth, resolve, tokenMeta, tradeFee, transfer };
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ var V19_HEIGHT = 36700;
44
44
  var V20_HEIGHT = 38400;
45
45
  var V21_HEIGHT = 40100;
46
46
  var MAX_OFFER_EPOCHS = 168;
47
+ var V22_HEIGHT = 41300;
47
48
  var PKEY = /^[a-z0-9](?:[a-z0-9.-]{0,30}[a-z0-9])?$/;
48
49
  var PROFILE_MAX_KEYS = 16;
49
50
  var PROFILE_MAX_VALUE_BYTES = 256;
@@ -67,6 +68,15 @@ var SALT_RE = /^[0-9a-fA-F]{16,128}$/;
67
68
  var RESERVED_NAMES = /* @__PURE__ */ new Set(["csd", "treasury", "admin", "official", "root", "www", "support"]);
68
69
  var COMMIT_MAX_BLOCKS = 8 * EPOCH_LEN;
69
70
  var epochOf = (height) => Math.floor(height / EPOCH_LEN);
71
+ var claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
72
+ var claimWindowOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
73
+ var claimGraceOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_FILL_GRACE_BLOCKS : 0;
74
+ var offerExpiryHeightOf = (expiresEpoch, anchorHeight) => {
75
+ const raw = (Number(expiresEpoch ?? 0) + 1) * EPOCH_LEN;
76
+ if (anchorHeight >= V22_HEIGHT) return raw;
77
+ const capped = (epochOf(anchorHeight) + MAX_OFFER_EPOCHS + 1) * EPOCH_LEN;
78
+ return Math.min(raw, Math.max(V21_HEIGHT, capped));
79
+ };
70
80
  var isNameGive = (g) => typeof g.name === "string";
71
81
  var isTokenWant = (w) => typeof w.ticker === "string";
72
82
 
@@ -341,7 +351,7 @@ function resolve(events, tipHeight) {
341
351
  b.available += amt;
342
352
  }
343
353
  };
344
- const effExpiry = (e, height) => height >= V21_HEIGHT ? Math.min(e.expiresEpoch, epochOf(e.height) + MAX_OFFER_EPOCHS) : e.expiresEpoch;
354
+ 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;
345
355
  const sweepExpired = (height) => {
346
356
  const ep = epochOf(height);
347
357
  for (const o of offers.values()) {
@@ -363,9 +373,8 @@ function resolve(events, tipHeight) {
363
373
  const b = bids.get(o.bid);
364
374
  if (b && b.status === "open" && b.bidder === buyer) b.status = "done";
365
375
  };
366
- const claimGrace = (o) => o.claimUntilHeight !== void 0 && o.claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_FILL_GRACE_BLOCKS : 0;
376
+ const claimGrace = (o) => o.claimUntilHeight !== void 0 ? claimGraceOf(o.claimUntilHeight) : 0;
367
377
  const claimHeld = (o, height) => o.claimedBy !== void 0 && o.claimUntilHeight !== void 0 && height < o.claimUntilHeight + claimGrace(o);
368
- const claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
369
378
  const openFillReject = (o, height, who) => {
370
379
  if (!(height >= V13_HEIGHT && !o.taker)) return void 0;
371
380
  if (height < V17_HEIGHT) return "v1.3: open CSD-quoted fills disabled (offer must be taker-bound)";
@@ -611,7 +620,7 @@ function resolve(events, tipHeight) {
611
620
  note(ev, ev.id, "offer", false, "already expired at anchor");
612
621
  continue;
613
622
  }
614
- if (ev.height >= V21_HEIGHT && ev.expiresEpoch - epochOf(ev.height) > MAX_OFFER_EPOCHS) {
623
+ if (ev.height >= V21_HEIGHT && ev.height < V22_HEIGHT && ev.expiresEpoch - epochOf(ev.height) > MAX_OFFER_EPOCHS) {
615
624
  note(ev, ev.id, "offer", false, "v2.1: offer duration exceeds the max");
616
625
  continue;
617
626
  }
@@ -684,7 +693,7 @@ function resolve(events, tipHeight) {
684
693
  note(ev, ev.id, "bid", false, "already expired at anchor");
685
694
  continue;
686
695
  }
687
- if (ev.height >= V21_HEIGHT && ev.expiresEpoch - epochOf(ev.height) > MAX_OFFER_EPOCHS) {
696
+ if (ev.height >= V21_HEIGHT && ev.height < V22_HEIGHT && ev.expiresEpoch - epochOf(ev.height) > MAX_OFFER_EPOCHS) {
688
697
  note(ev, ev.id, "bid", false, "v2.1: bid duration exceeds the max");
689
698
  continue;
690
699
  }
@@ -1049,33 +1058,74 @@ function canonicalState(s) {
1049
1058
  const { events: _events, ...data } = s;
1050
1059
  return JSON.stringify(sortKeys(data));
1051
1060
  }
1061
+
1062
+ // src/client.ts
1063
+ import { blockReward, INITIAL_REWARD } from "@inversealtruism/csd-codec";
1064
+ var CLAIM_ATTACKER_Q = 0.2;
1065
+ var CLAIM_MIN_DEPTH = 3;
1066
+ var COMMIT_REVEAL_MIN_DEPTH = 3;
1067
+ function requiredClaimDepth(valueSats, height) {
1068
+ const r = CLAIM_ATTACKER_Q / (1 - CLAIM_ATTACKER_Q);
1069
+ const V = Number(valueSats);
1070
+ const R = blockReward(height) || INITIAL_REWARD;
1071
+ const max = claimWindowAt(height) - 5;
1072
+ for (let D = CLAIM_MIN_DEPTH; D <= max; D++) {
1073
+ if (Math.pow(r, D) * V <= D * R) return { depth: D, reversalPct: Math.pow(r, D) * 100, capped: false };
1074
+ }
1075
+ return { depth: max, reversalPct: Math.pow(r, max) * 100, capped: true };
1076
+ }
1077
+
1078
+ // src/index.ts
1079
+ import {
1080
+ canonicalJson as canonicalJson2,
1081
+ payloadHash as payloadHash2,
1082
+ blockReward as blockReward2,
1083
+ INITIAL_REWARD as INITIAL_REWARD2,
1084
+ HALVING_INTERVAL,
1085
+ MIN_FEE_PROPOSE,
1086
+ MIN_FEE_ATTEST,
1087
+ EPOCH_LEN as EPOCH_LEN2
1088
+ } from "@inversealtruism/csd-codec";
1052
1089
  export {
1053
1090
  ACTIVATION_HEIGHT,
1054
1091
  ADDR_RE,
1055
1092
  AMOUNT_RE,
1093
+ BID_KEYS,
1094
+ CLAIM_ATTACKER_Q,
1056
1095
  CLAIM_COOLDOWN_BLOCKS,
1057
1096
  CLAIM_FILL_GRACE_BLOCKS,
1097
+ CLAIM_MIN_DEPTH,
1058
1098
  CLAIM_WINDOW_BLOCKS,
1059
1099
  CLAIM_WINDOW_BLOCKS_V20,
1060
1100
  COMMIT_MAX_BLOCKS,
1101
+ COMMIT_REVEAL_MIN_DEPTH,
1061
1102
  CONF_TOKEN_FILL,
1062
1103
  DEPLOY_FEE,
1104
+ DEPLOY_KEYS,
1063
1105
  DOMAIN,
1064
- EPOCH_LEN,
1106
+ EPOCH_LEN2 as EPOCH_LEN,
1065
1107
  FEE_BPS,
1066
1108
  FEE_BPS_V16,
1109
+ HALVING_INTERVAL,
1067
1110
  HASH_RE,
1111
+ INITIAL_REWARD2 as INITIAL_REWARD,
1068
1112
  MAX_ACTIVE_CLAIMS,
1069
1113
  MAX_AMOUNT,
1070
1114
  MAX_OFFER_EPOCHS,
1071
1115
  MAX_RECORD_BYTES,
1116
+ MINT_KEYS,
1117
+ MIN_FEE_ATTEST,
1118
+ MIN_FEE_PROPOSE,
1072
1119
  NAME_FEE_SHORT_V18,
1073
1120
  NAME_FEE_V18,
1074
1121
  NAME_GRACE_EPOCHS,
1122
+ NAME_KEYS,
1075
1123
  NAME_PREMIUM_DECAY_EPOCHS,
1076
1124
  NAME_PREMIUM_START,
1077
1125
  NAME_RE,
1078
1126
  NAME_TERM_EPOCHS,
1127
+ NPROFILE_KEYS,
1128
+ OFFER_KEYS,
1079
1129
  PKEY,
1080
1130
  PROFILE_MAX_KEYS,
1081
1131
  PROFILE_MAX_VALUE_BYTES,
@@ -1087,6 +1137,7 @@ export {
1087
1137
  SCORE_CLAIM,
1088
1138
  SCORE_FILL,
1089
1139
  TICKER_RE,
1140
+ TRANSFER_KEYS,
1090
1141
  TREASURY_ADDR,
1091
1142
  V11_HEIGHT,
1092
1143
  V12_HEIGHT,
@@ -1099,9 +1150,15 @@ export {
1099
1150
  V19_HEIGHT,
1100
1151
  V20_HEIGHT,
1101
1152
  V21_HEIGHT,
1153
+ V22_HEIGHT,
1102
1154
  bid,
1155
+ blockReward2 as blockReward,
1103
1156
  buildRecord,
1157
+ canonicalJson2 as canonicalJson,
1104
1158
  canonicalState,
1159
+ claimGraceOf,
1160
+ claimWindowAt,
1161
+ claimWindowOf,
1105
1162
  deploy,
1106
1163
  epochOf,
1107
1164
  expiredClaimFee,
@@ -1120,8 +1177,11 @@ export {
1120
1177
  nameXfer,
1121
1178
  offer,
1122
1179
  offerCancelAll,
1180
+ offerExpiryHeightOf,
1123
1181
  parseAmount,
1124
1182
  parseRecord,
1183
+ payloadHash2 as payloadHash,
1184
+ requiredClaimDepth,
1125
1185
  resolve,
1126
1186
  tokenMeta,
1127
1187
  tradeFee,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inversealtruism/cairnx-core",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "CairnX — tokens, atomic DvP trades and leased .csd names on Compute Substrate, as a pure deterministic convention library (Ordinals/Runes class). Ships the normative CONVENTION.md and the conformance vectors.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -37,6 +37,6 @@
37
37
  "homepage": "https://cairn-substrate.com/trade",
38
38
  "scripts": {
39
39
  "build": "tsup src/index.ts --format esm,cjs --dts --clean",
40
- "test": "tsx test/vectors.test.ts && tsx test/name-decoy.test.ts"
40
+ "test": "tsx test/vectors.test.ts && tsx test/name-decoy.test.ts && tsx test/client-helpers.test.ts"
41
41
  }
42
42
  }