@inversealtruism/cairnx-core 0.1.27 → 0.1.29

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/index.cjs CHANGED
@@ -220,12 +220,12 @@ var HASH_RE = /^0x[0-9a-f]{64}$/;
220
220
  var SALT_RE = /^[0-9a-fA-F]{16,128}$/;
221
221
  var RESERVED_NAMES = /* @__PURE__ */ new Set(["csd", "treasury", "admin", "official", "root", "www", "support"]);
222
222
  var COMMIT_MAX_BLOCKS = 8 * import_csd_codec.EPOCH_LEN;
223
- var V25_HEIGHT = 1e7;
223
+ var V25_HEIGHT = 51e3;
224
224
  var REG_COMMIT_MAX_BLOCKS = 8;
225
225
  var REG_FINALIZE_GRACE_BLOCKS = 20;
226
226
  var MAX_PENDING_REG = 3;
227
227
  var FINALIZE_TIP_MARGIN = 2;
228
- var V26_HEIGHT = 1e7;
228
+ var V26_HEIGHT = 51200;
229
229
  var epochOf = (height) => Math.floor(height / import_csd_codec.EPOCH_LEN);
230
230
  var claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
231
231
  var claimWindowOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
@@ -1372,7 +1372,9 @@ function resolve(events, tipHeight) {
1372
1372
  for (const [id, o] of [...offers.entries()].sort(([a], [b]) => ord(a, b))) offersOut[id] = o;
1373
1373
  const bidsOut = {};
1374
1374
  for (const [id, b] of [...bids.entries()].sort(([a], [b2]) => ord(a, b2))) bidsOut[id] = b;
1375
- return { tipHeight, tokens: tokensOut, balances: balancesOut, names: namesOut, offers: offersOut, bids: bidsOut, events: log, feesPaid: feesPaid.toString() };
1375
+ const recapturesOut = {};
1376
+ for (const [nm, r] of [...recaptures.entries()].sort(([a], [b]) => ord(a, b))) recapturesOut[nm] = { owner: r.owner, effectiveHeight: r.effHeight, finalizeBy: r.finalizeBy };
1377
+ return { tipHeight, tokens: tokensOut, balances: balancesOut, names: namesOut, offers: offersOut, bids: bidsOut, recaptures: recapturesOut, events: log, feesPaid: feesPaid.toString() };
1376
1378
  }
1377
1379
  function canonicalState(s) {
1378
1380
  const sortKeys = (v) => {
@@ -1382,7 +1384,7 @@ function canonicalState(s) {
1382
1384
  }
1383
1385
  return v;
1384
1386
  };
1385
- const { events: _events, ...data } = s;
1387
+ const { events: _events, recaptures: _recaptures, ...data } = s;
1386
1388
  return JSON.stringify(sortKeys(data));
1387
1389
  }
1388
1390
 
package/dist/index.d.cts CHANGED
@@ -63,12 +63,12 @@ declare const HASH_RE: RegExp;
63
63
  declare const SALT_RE: RegExp;
64
64
  declare const RESERVED_NAMES: Set<string>;
65
65
  declare const COMMIT_MAX_BLOCKS: number;
66
- declare const V25_HEIGHT = 10000000;
66
+ declare const V25_HEIGHT = 51000;
67
67
  declare const REG_COMMIT_MAX_BLOCKS = 8;
68
68
  declare const REG_FINALIZE_GRACE_BLOCKS = 20;
69
69
  declare const MAX_PENDING_REG = 3;
70
70
  declare const FINALIZE_TIP_MARGIN = 2;
71
- declare const V26_HEIGHT = 10000000;
71
+ declare const V26_HEIGHT = 51200;
72
72
  declare const epochOf: (height: number) => number;
73
73
  declare const claimWindowAt: (height: number) => number;
74
74
  declare const claimWindowOf: (claimUntilHeight: number) => number;
@@ -334,6 +334,14 @@ interface CairnXState {
334
334
  names: Record<string, NameState>;
335
335
  offers: Record<string, OfferState>;
336
336
  bids: Record<string, BidState>;
337
+ /** v2.6 pending recapture reservations (name → the current winner). DIAGNOSTIC, excluded from canonicalState
338
+ * (like `events`); exposed so a wallet/UI can confirm it is still the winner before paying the premium.
339
+ * resolve() always returns it; the one initial-state literal (cairnx service) constructs an empty {}. */
340
+ recaptures: Record<string, {
341
+ owner: string;
342
+ effectiveHeight: number;
343
+ finalizeBy: number;
344
+ }>;
337
345
  events: AppliedEvent[];
338
346
  feesPaid: string;
339
347
  }
package/dist/index.d.ts CHANGED
@@ -63,12 +63,12 @@ declare const HASH_RE: RegExp;
63
63
  declare const SALT_RE: RegExp;
64
64
  declare const RESERVED_NAMES: Set<string>;
65
65
  declare const COMMIT_MAX_BLOCKS: number;
66
- declare const V25_HEIGHT = 10000000;
66
+ declare const V25_HEIGHT = 51000;
67
67
  declare const REG_COMMIT_MAX_BLOCKS = 8;
68
68
  declare const REG_FINALIZE_GRACE_BLOCKS = 20;
69
69
  declare const MAX_PENDING_REG = 3;
70
70
  declare const FINALIZE_TIP_MARGIN = 2;
71
- declare const V26_HEIGHT = 10000000;
71
+ declare const V26_HEIGHT = 51200;
72
72
  declare const epochOf: (height: number) => number;
73
73
  declare const claimWindowAt: (height: number) => number;
74
74
  declare const claimWindowOf: (claimUntilHeight: number) => number;
@@ -334,6 +334,14 @@ interface CairnXState {
334
334
  names: Record<string, NameState>;
335
335
  offers: Record<string, OfferState>;
336
336
  bids: Record<string, BidState>;
337
+ /** v2.6 pending recapture reservations (name → the current winner). DIAGNOSTIC, excluded from canonicalState
338
+ * (like `events`); exposed so a wallet/UI can confirm it is still the winner before paying the premium.
339
+ * resolve() always returns it; the one initial-state literal (cairnx service) constructs an empty {}. */
340
+ recaptures: Record<string, {
341
+ owner: string;
342
+ effectiveHeight: number;
343
+ finalizeBy: number;
344
+ }>;
337
345
  events: AppliedEvent[];
338
346
  feesPaid: string;
339
347
  }
package/dist/index.js CHANGED
@@ -81,12 +81,12 @@ var HASH_RE = /^0x[0-9a-f]{64}$/;
81
81
  var SALT_RE = /^[0-9a-fA-F]{16,128}$/;
82
82
  var RESERVED_NAMES = /* @__PURE__ */ new Set(["csd", "treasury", "admin", "official", "root", "www", "support"]);
83
83
  var COMMIT_MAX_BLOCKS = 8 * EPOCH_LEN;
84
- var V25_HEIGHT = 1e7;
84
+ var V25_HEIGHT = 51e3;
85
85
  var REG_COMMIT_MAX_BLOCKS = 8;
86
86
  var REG_FINALIZE_GRACE_BLOCKS = 20;
87
87
  var MAX_PENDING_REG = 3;
88
88
  var FINALIZE_TIP_MARGIN = 2;
89
- var V26_HEIGHT = 1e7;
89
+ var V26_HEIGHT = 51200;
90
90
  var epochOf = (height) => Math.floor(height / EPOCH_LEN);
91
91
  var claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
92
92
  var claimWindowOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
@@ -1233,7 +1233,9 @@ function resolve(events, tipHeight) {
1233
1233
  for (const [id, o] of [...offers.entries()].sort(([a], [b]) => ord(a, b))) offersOut[id] = o;
1234
1234
  const bidsOut = {};
1235
1235
  for (const [id, b] of [...bids.entries()].sort(([a], [b2]) => ord(a, b2))) bidsOut[id] = b;
1236
- return { tipHeight, tokens: tokensOut, balances: balancesOut, names: namesOut, offers: offersOut, bids: bidsOut, events: log, feesPaid: feesPaid.toString() };
1236
+ const recapturesOut = {};
1237
+ for (const [nm, r] of [...recaptures.entries()].sort(([a], [b]) => ord(a, b))) recapturesOut[nm] = { owner: r.owner, effectiveHeight: r.effHeight, finalizeBy: r.finalizeBy };
1238
+ return { tipHeight, tokens: tokensOut, balances: balancesOut, names: namesOut, offers: offersOut, bids: bidsOut, recaptures: recapturesOut, events: log, feesPaid: feesPaid.toString() };
1237
1239
  }
1238
1240
  function canonicalState(s) {
1239
1241
  const sortKeys = (v) => {
@@ -1243,7 +1245,7 @@ function canonicalState(s) {
1243
1245
  }
1244
1246
  return v;
1245
1247
  };
1246
- const { events: _events, ...data } = s;
1248
+ const { events: _events, recaptures: _recaptures, ...data } = s;
1247
1249
  return JSON.stringify(sortKeys(data));
1248
1250
  }
1249
1251
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inversealtruism/cairnx-core",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
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",
@@ -21,8 +21,12 @@
21
21
  "MAKERS.md",
22
22
  "test/vectors"
23
23
  ],
24
+ "scripts": {
25
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean",
26
+ "test": "tsx test/vectors.test.ts && tsx test/name-decoy.test.ts && tsx test/client-helpers.test.ts"
27
+ },
24
28
  "dependencies": {
25
- "@inversealtruism/csd-codec": "0.1.14"
29
+ "@inversealtruism/csd-codec": "workspace:*"
26
30
  },
27
31
  "license": "MIT",
28
32
  "sideEffects": false,
@@ -34,9 +38,5 @@
34
38
  "url": "git+https://github.com/InverseAltruism/csd-sdk.git",
35
39
  "directory": "packages/cairnx"
36
40
  },
37
- "homepage": "https://cairn-substrate.com/trade",
38
- "scripts": {
39
- "build": "tsup src/index.ts --format esm,cjs --dts --clean",
40
- "test": "tsx test/vectors.test.ts && tsx test/name-decoy.test.ts && tsx test/client-helpers.test.ts"
41
- }
42
- }
41
+ "homepage": "https://cairn-substrate.com/trade"
42
+ }
@@ -6122,17 +6122,17 @@
6122
6122
  "expectedState": {
6123
6123
  "balances": {},
6124
6124
  "bids": {},
6125
- "feesPaid": "19670000000",
6125
+ "feesPaid": "670000000",
6126
6126
  "names": {
6127
6127
  "erin": {
6128
- "claimId": "0x00000000000000000000000000000000000000000000000000000000f1900051",
6129
- "effectiveHeight": 324603,
6130
- "height": 324603,
6128
+ "claimId": "0x00000000000000000000000000000000000000000000000000000000f1900050",
6129
+ "effectiveHeight": 40050,
6130
+ "expired": true,
6131
+ "height": 40052,
6131
6132
  "locked": false,
6132
6133
  "name": "erin",
6133
- "owner": "0xc3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3",
6134
- "paidThroughEpoch": 19580,
6135
- "viaFill": true
6134
+ "owner": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
6135
+ "paidThroughEpoch": 10095
6136
6136
  }
6137
6137
  },
6138
6138
  "offers": {},