@inversealtruism/cairnx-core 0.1.19 → 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 +51 -0
- package/dist/index.cjs +7 -3
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -3
- package/package.json +1 -1
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
|
@@ -83,6 +83,7 @@ __export(index_exports, {
|
|
|
83
83
|
V19_HEIGHT: () => V19_HEIGHT,
|
|
84
84
|
V20_HEIGHT: () => V20_HEIGHT,
|
|
85
85
|
V21_HEIGHT: () => V21_HEIGHT,
|
|
86
|
+
V22_HEIGHT: () => V22_HEIGHT,
|
|
86
87
|
bid: () => bid,
|
|
87
88
|
blockReward: () => import_csd_codec4.blockReward,
|
|
88
89
|
buildRecord: () => buildRecord,
|
|
@@ -167,6 +168,7 @@ var V19_HEIGHT = 36700;
|
|
|
167
168
|
var V20_HEIGHT = 38400;
|
|
168
169
|
var V21_HEIGHT = 40100;
|
|
169
170
|
var MAX_OFFER_EPOCHS = 168;
|
|
171
|
+
var V22_HEIGHT = 41300;
|
|
170
172
|
var PKEY = /^[a-z0-9](?:[a-z0-9.-]{0,30}[a-z0-9])?$/;
|
|
171
173
|
var PROFILE_MAX_KEYS = 16;
|
|
172
174
|
var PROFILE_MAX_VALUE_BYTES = 256;
|
|
@@ -195,6 +197,7 @@ var claimWindowOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS
|
|
|
195
197
|
var claimGraceOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_FILL_GRACE_BLOCKS : 0;
|
|
196
198
|
var offerExpiryHeightOf = (expiresEpoch, anchorHeight) => {
|
|
197
199
|
const raw = (Number(expiresEpoch ?? 0) + 1) * import_csd_codec.EPOCH_LEN;
|
|
200
|
+
if (anchorHeight >= V22_HEIGHT) return raw;
|
|
198
201
|
const capped = (epochOf(anchorHeight) + MAX_OFFER_EPOCHS + 1) * import_csd_codec.EPOCH_LEN;
|
|
199
202
|
return Math.min(raw, Math.max(V21_HEIGHT, capped));
|
|
200
203
|
};
|
|
@@ -472,7 +475,7 @@ function resolve(events, tipHeight) {
|
|
|
472
475
|
b.available += amt;
|
|
473
476
|
}
|
|
474
477
|
};
|
|
475
|
-
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;
|
|
476
479
|
const sweepExpired = (height) => {
|
|
477
480
|
const ep = epochOf(height);
|
|
478
481
|
for (const o of offers.values()) {
|
|
@@ -741,7 +744,7 @@ function resolve(events, tipHeight) {
|
|
|
741
744
|
note(ev, ev.id, "offer", false, "already expired at anchor");
|
|
742
745
|
continue;
|
|
743
746
|
}
|
|
744
|
-
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) {
|
|
745
748
|
note(ev, ev.id, "offer", false, "v2.1: offer duration exceeds the max");
|
|
746
749
|
continue;
|
|
747
750
|
}
|
|
@@ -814,7 +817,7 @@ function resolve(events, tipHeight) {
|
|
|
814
817
|
note(ev, ev.id, "bid", false, "already expired at anchor");
|
|
815
818
|
continue;
|
|
816
819
|
}
|
|
817
|
-
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) {
|
|
818
821
|
note(ev, ev.id, "bid", false, "v2.1: bid duration exceeds the max");
|
|
819
822
|
continue;
|
|
820
823
|
}
|
|
@@ -1263,6 +1266,7 @@ var import_csd_codec4 = require("@inversealtruism/csd-codec");
|
|
|
1263
1266
|
V19_HEIGHT,
|
|
1264
1267
|
V20_HEIGHT,
|
|
1265
1268
|
V21_HEIGHT,
|
|
1269
|
+
V22_HEIGHT,
|
|
1266
1270
|
bid,
|
|
1267
1271
|
blockReward,
|
|
1268
1272
|
buildRecord,
|
package/dist/index.d.cts
CHANGED
|
@@ -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;
|
|
@@ -394,4 +395,4 @@ declare function requiredClaimDepth(valueSats: number | bigint, height: number):
|
|
|
394
395
|
capped: boolean;
|
|
395
396
|
};
|
|
396
397
|
|
|
397
|
-
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, 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 };
|
|
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
|
@@ -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;
|
|
@@ -394,4 +395,4 @@ declare function requiredClaimDepth(valueSats: number | bigint, height: number):
|
|
|
394
395
|
capped: boolean;
|
|
395
396
|
};
|
|
396
397
|
|
|
397
|
-
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, 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 };
|
|
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;
|
|
@@ -72,6 +73,7 @@ var claimWindowOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS
|
|
|
72
73
|
var claimGraceOf = (claimUntilHeight) => claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_FILL_GRACE_BLOCKS : 0;
|
|
73
74
|
var offerExpiryHeightOf = (expiresEpoch, anchorHeight) => {
|
|
74
75
|
const raw = (Number(expiresEpoch ?? 0) + 1) * EPOCH_LEN;
|
|
76
|
+
if (anchorHeight >= V22_HEIGHT) return raw;
|
|
75
77
|
const capped = (epochOf(anchorHeight) + MAX_OFFER_EPOCHS + 1) * EPOCH_LEN;
|
|
76
78
|
return Math.min(raw, Math.max(V21_HEIGHT, capped));
|
|
77
79
|
};
|
|
@@ -349,7 +351,7 @@ function resolve(events, tipHeight) {
|
|
|
349
351
|
b.available += amt;
|
|
350
352
|
}
|
|
351
353
|
};
|
|
352
|
-
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;
|
|
353
355
|
const sweepExpired = (height) => {
|
|
354
356
|
const ep = epochOf(height);
|
|
355
357
|
for (const o of offers.values()) {
|
|
@@ -618,7 +620,7 @@ function resolve(events, tipHeight) {
|
|
|
618
620
|
note(ev, ev.id, "offer", false, "already expired at anchor");
|
|
619
621
|
continue;
|
|
620
622
|
}
|
|
621
|
-
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) {
|
|
622
624
|
note(ev, ev.id, "offer", false, "v2.1: offer duration exceeds the max");
|
|
623
625
|
continue;
|
|
624
626
|
}
|
|
@@ -691,7 +693,7 @@ function resolve(events, tipHeight) {
|
|
|
691
693
|
note(ev, ev.id, "bid", false, "already expired at anchor");
|
|
692
694
|
continue;
|
|
693
695
|
}
|
|
694
|
-
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) {
|
|
695
697
|
note(ev, ev.id, "bid", false, "v2.1: bid duration exceeds the max");
|
|
696
698
|
continue;
|
|
697
699
|
}
|
|
@@ -1148,6 +1150,7 @@ export {
|
|
|
1148
1150
|
V19_HEIGHT,
|
|
1149
1151
|
V20_HEIGHT,
|
|
1150
1152
|
V21_HEIGHT,
|
|
1153
|
+
V22_HEIGHT,
|
|
1151
1154
|
bid,
|
|
1152
1155
|
blockReward2 as blockReward,
|
|
1153
1156
|
buildRecord,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inversealtruism/cairnx-core",
|
|
3
|
-
"version": "0.1.
|
|
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",
|