@inversealtruism/cairnx-core 0.2.2 → 0.2.3
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 +13 -0
- package/README.md +1 -1
- package/dist/index.cjs +6 -5
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.3
|
|
4
|
+
|
|
5
|
+
- `provenOfferRefusal` refuses the two record-only activation gates it lacked. An offer anchored below
|
|
6
|
+
`ACTIVATION_HEIGHT` (29,860), where `resolve()` skips every event, is refused with "anchored before CairnX
|
|
7
|
+
activation (block 29860)"; a name offer anchored below `V11_HEIGHT` (29,960) with the resolver's own note "name
|
|
8
|
+
offers need v1.1". Before, a canonical name offer proven at 29,959 returned no refusal. Correction to 0.2.2: its
|
|
9
|
+
entry said `provenOfferRefusal` returns the resolver's note "for every rule that needs no chain state"; it covered
|
|
10
|
+
only the rules in `offerEnvelopeRefusal`, without these two.
|
|
11
|
+
- The name-offer v1.1 rule moved from `applyOffer` into `offerEnvelopeRefusal`, after the rules already there, which
|
|
12
|
+
is where `applyOffer` checked it. New root export `beforeActivation(height)`, which `resolve()` reads to skip
|
|
13
|
+
events below `ACTIVATION_HEIGHT` and `provenOfferRefusal` reads to refuse them.
|
|
14
|
+
- `resolve()` and canonical state are byte-identical to 0.2.2.
|
|
15
|
+
|
|
3
16
|
## 0.2.2
|
|
4
17
|
|
|
5
18
|
- `verifyFillSpv` fails closed when any id `offerEventIds` returns cannot be proven: `provenEvent` throws,
|
package/README.md
CHANGED
|
@@ -316,7 +316,7 @@ is a silent chain fork, the exact bug class the shared-core de-dup (`cairn/docs/
|
|
|
316
316
|
**To make a consensus change:** edit `src/` here **and** `conformance/cairnx_ref.py`; add a height-gated
|
|
317
317
|
`V*_HEIGHT` (never reinterpret history) + a vector; `pnpm build && pnpm test && pnpm test:crosslang`
|
|
318
318
|
(all green); **bump the version** (`node scripts/check-lockstep.mjs` fails until you do: it compares the
|
|
319
|
-
published tarball of the current version with this build); `
|
|
319
|
+
published tarball of the current version with this build); the npm window (`node scripts/npm-window.mjs`); **rebuild + recommit
|
|
320
320
|
the two vendored bundles**; re-pin every consumer and deploy them **between** activation heights, not
|
|
321
321
|
across one (below the gate the output is byte-identical, so the rollout is fork-free).
|
|
322
322
|
|
package/dist/index.cjs
CHANGED
|
@@ -111,6 +111,7 @@ __export(index_exports, {
|
|
|
111
111
|
V28_HEIGHT: () => V28_HEIGHT,
|
|
112
112
|
V29_HEIGHT: () => V29_HEIGHT,
|
|
113
113
|
ZERO_ADDR: () => ZERO_ADDR,
|
|
114
|
+
beforeActivation: () => beforeActivation,
|
|
114
115
|
bid: () => bid,
|
|
115
116
|
bindOfferTerms: () => bindOfferTerms,
|
|
116
117
|
bindProvenOffer: () => bindProvenOffer,
|
|
@@ -182,6 +183,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
182
183
|
var import_csd_codec = require("@inversealtruism/csd-codec");
|
|
183
184
|
var DOMAIN = "cairnx:v1";
|
|
184
185
|
var ACTIVATION_HEIGHT = 29860;
|
|
186
|
+
var beforeActivation = (height) => height < ACTIVATION_HEIGHT;
|
|
185
187
|
var V11_HEIGHT = 29960;
|
|
186
188
|
var V12_HEIGHT = 30300;
|
|
187
189
|
var V13_HEIGHT = 31100;
|
|
@@ -1267,10 +1269,6 @@ function applyOffer(c, ev, rec, who) {
|
|
|
1267
1269
|
const payto = (rec.want.payto ?? who).toLowerCase();
|
|
1268
1270
|
const give = rec.give;
|
|
1269
1271
|
if (isNameGive(give)) {
|
|
1270
|
-
if (!v11) {
|
|
1271
|
-
note(ev, ev.id, "offer", false, "name offers need v1.1");
|
|
1272
|
-
return;
|
|
1273
|
-
}
|
|
1274
1272
|
const n = names.get(give.name);
|
|
1275
1273
|
if (!n || n.owner !== who) {
|
|
1276
1274
|
note(ev, ev.id, "offer", false, "you don't own this name");
|
|
@@ -1466,6 +1464,7 @@ function offerEnvelopeRefusal(rec, who, height, expiresEpoch) {
|
|
|
1466
1464
|
if (!Number.isSafeInteger(expiresEpoch)) return "expiresEpoch out of safe-integer range";
|
|
1467
1465
|
if ((0, import_csd_codec.epochOf)(height) > expiresEpoch) return "already expired at anchor";
|
|
1468
1466
|
if (height >= V21_HEIGHT && height < V22_HEIGHT && expiresEpoch - (0, import_csd_codec.epochOf)(height) > MAX_OFFER_EPOCHS) return "v2.1: offer duration exceeds the max";
|
|
1467
|
+
if (isNameGive(rec.give) && height < V11_HEIGHT) return "name offers need v1.1";
|
|
1469
1468
|
return null;
|
|
1470
1469
|
}
|
|
1471
1470
|
|
|
@@ -1589,7 +1588,7 @@ function resolve(events, tipHeight) {
|
|
|
1589
1588
|
c.pendingCancels = [];
|
|
1590
1589
|
};
|
|
1591
1590
|
for (const ev of applied) {
|
|
1592
|
-
if (ev.height
|
|
1591
|
+
if (beforeActivation(ev.height)) continue;
|
|
1593
1592
|
if (ev.height !== pendingBlock) {
|
|
1594
1593
|
applyPendingCancels();
|
|
1595
1594
|
pendingBlock = ev.height;
|
|
@@ -2123,6 +2122,7 @@ function countOtherHoldsAtGrant(candidates, target, me, closed = /* @__PURE__ */
|
|
|
2123
2122
|
// src/admission.ts
|
|
2124
2123
|
function provenOfferRefusal(rec, tx) {
|
|
2125
2124
|
if (tx.domain !== DOMAIN) return `not a ${DOMAIN} Propose (domain ${JSON.stringify(String(tx.domain))})`;
|
|
2125
|
+
if (beforeActivation(tx.height)) return `anchored before CairnX activation (block ${ACTIVATION_HEIGHT})`;
|
|
2126
2126
|
const ee = typeof tx.expiresEpoch === "bigint" ? Number(tx.expiresEpoch) : tx.expiresEpoch;
|
|
2127
2127
|
return offerEnvelopeRefusal(rec, String(tx.seller).toLowerCase(), tx.height, ee);
|
|
2128
2128
|
}
|
|
@@ -2222,6 +2222,7 @@ var import_csd_codec5 = require("@inversealtruism/csd-codec");
|
|
|
2222
2222
|
V28_HEIGHT,
|
|
2223
2223
|
V29_HEIGHT,
|
|
2224
2224
|
ZERO_ADDR,
|
|
2225
|
+
beforeActivation,
|
|
2225
2226
|
bid,
|
|
2226
2227
|
bindOfferTerms,
|
|
2227
2228
|
bindProvenOffer,
|
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,8 @@ export { EPOCH_LEN, HALVING_INTERVAL, INITIAL_REWARD, MIN_FEE_ATTEST, MIN_FEE_PR
|
|
|
2
2
|
|
|
3
3
|
declare const DOMAIN = "cairnx:v1";
|
|
4
4
|
declare const ACTIVATION_HEIGHT = 29860;
|
|
5
|
+
/** True below ACTIVATION_HEIGHT, where resolve() skips every event without a note. */
|
|
6
|
+
declare const beforeActivation: (height: number) => boolean;
|
|
5
7
|
declare const V11_HEIGHT = 29960;
|
|
6
8
|
declare const V12_HEIGHT = 30300;
|
|
7
9
|
declare const V13_HEIGHT = 31100;
|
|
@@ -852,7 +854,7 @@ interface ProvenOfferTx {
|
|
|
852
854
|
seller: string;
|
|
853
855
|
}
|
|
854
856
|
/** Why the proven offer Propose is not an offer the resolver admits (the resolver's own note for the record
|
|
855
|
-
* rules), or null when it passes. */
|
|
857
|
+
* rules; the resolver writes no note below activation), or null when it passes. */
|
|
856
858
|
declare function provenOfferRefusal(rec: OfferRecord, tx: ProvenOfferTx): string | null;
|
|
857
859
|
|
|
858
|
-
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 HoldCandidate, type HoldCount, type HoldReplay, type HoldTarget, LEGACY_HOLD_SUNSET_HEIGHT, type LegacyBindOpts, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MAX_TOKEN_DECIMALS, 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 ProvenOfferTx, 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, countOtherHoldsAtGrant, 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, provenOfferRefusal, provenOfferTerms, ptAmt, replayLiveHold, requiredClaimDepth, requiredFillOutputs, resolve, tokenMeta, tradeFee, transfer, unsafeMintProvenOfferTerms, verifyFillSpv };
|
|
860
|
+
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 HoldCandidate, type HoldCount, type HoldReplay, type HoldTarget, LEGACY_HOLD_SUNSET_HEIGHT, type LegacyBindOpts, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MAX_TOKEN_DECIMALS, 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 ProvenOfferTx, 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, beforeActivation, bid, bindOfferTerms, bindProvenOffer, buildFeeHeight, buildRecord, burnedPayment, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, countOtherHoldsAtGrant, 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, provenOfferRefusal, provenOfferTerms, ptAmt, replayLiveHold, requiredClaimDepth, requiredFillOutputs, resolve, tokenMeta, tradeFee, transfer, unsafeMintProvenOfferTerms, verifyFillSpv };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export { EPOCH_LEN, HALVING_INTERVAL, INITIAL_REWARD, MIN_FEE_ATTEST, MIN_FEE_PR
|
|
|
2
2
|
|
|
3
3
|
declare const DOMAIN = "cairnx:v1";
|
|
4
4
|
declare const ACTIVATION_HEIGHT = 29860;
|
|
5
|
+
/** True below ACTIVATION_HEIGHT, where resolve() skips every event without a note. */
|
|
6
|
+
declare const beforeActivation: (height: number) => boolean;
|
|
5
7
|
declare const V11_HEIGHT = 29960;
|
|
6
8
|
declare const V12_HEIGHT = 30300;
|
|
7
9
|
declare const V13_HEIGHT = 31100;
|
|
@@ -852,7 +854,7 @@ interface ProvenOfferTx {
|
|
|
852
854
|
seller: string;
|
|
853
855
|
}
|
|
854
856
|
/** Why the proven offer Propose is not an offer the resolver admits (the resolver's own note for the record
|
|
855
|
-
* rules), or null when it passes. */
|
|
857
|
+
* rules; the resolver writes no note below activation), or null when it passes. */
|
|
856
858
|
declare function provenOfferRefusal(rec: OfferRecord, tx: ProvenOfferTx): string | null;
|
|
857
859
|
|
|
858
|
-
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 HoldCandidate, type HoldCount, type HoldReplay, type HoldTarget, LEGACY_HOLD_SUNSET_HEIGHT, type LegacyBindOpts, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MAX_TOKEN_DECIMALS, 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 ProvenOfferTx, 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, countOtherHoldsAtGrant, 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, provenOfferRefusal, provenOfferTerms, ptAmt, replayLiveHold, requiredClaimDepth, requiredFillOutputs, resolve, tokenMeta, tradeFee, transfer, unsafeMintProvenOfferTerms, verifyFillSpv };
|
|
860
|
+
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 HoldCandidate, type HoldCount, type HoldReplay, type HoldTarget, LEGACY_HOLD_SUNSET_HEIGHT, type LegacyBindOpts, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MAX_TOKEN_DECIMALS, 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 ProvenOfferTx, 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, beforeActivation, bid, bindOfferTerms, bindProvenOffer, buildFeeHeight, buildRecord, burnedPayment, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, countOtherHoldsAtGrant, 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, provenOfferRefusal, provenOfferTerms, ptAmt, replayLiveHold, requiredClaimDepth, requiredFillOutputs, resolve, tokenMeta, tradeFee, transfer, unsafeMintProvenOfferTerms, verifyFillSpv };
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { EPOCH_LEN, MAX_URI_BYTES, epochOf } from "@inversealtruism/csd-codec";
|
|
3
3
|
var DOMAIN = "cairnx:v1";
|
|
4
4
|
var ACTIVATION_HEIGHT = 29860;
|
|
5
|
+
var beforeActivation = (height) => height < ACTIVATION_HEIGHT;
|
|
5
6
|
var V11_HEIGHT = 29960;
|
|
6
7
|
var V12_HEIGHT = 30300;
|
|
7
8
|
var V13_HEIGHT = 31100;
|
|
@@ -1087,10 +1088,6 @@ function applyOffer(c, ev, rec, who) {
|
|
|
1087
1088
|
const payto = (rec.want.payto ?? who).toLowerCase();
|
|
1088
1089
|
const give = rec.give;
|
|
1089
1090
|
if (isNameGive(give)) {
|
|
1090
|
-
if (!v11) {
|
|
1091
|
-
note(ev, ev.id, "offer", false, "name offers need v1.1");
|
|
1092
|
-
return;
|
|
1093
|
-
}
|
|
1094
1091
|
const n = names.get(give.name);
|
|
1095
1092
|
if (!n || n.owner !== who) {
|
|
1096
1093
|
note(ev, ev.id, "offer", false, "you don't own this name");
|
|
@@ -1286,6 +1283,7 @@ function offerEnvelopeRefusal(rec, who, height, expiresEpoch) {
|
|
|
1286
1283
|
if (!Number.isSafeInteger(expiresEpoch)) return "expiresEpoch out of safe-integer range";
|
|
1287
1284
|
if (epochOf(height) > expiresEpoch) return "already expired at anchor";
|
|
1288
1285
|
if (height >= V21_HEIGHT && height < V22_HEIGHT && expiresEpoch - epochOf(height) > MAX_OFFER_EPOCHS) return "v2.1: offer duration exceeds the max";
|
|
1286
|
+
if (isNameGive(rec.give) && height < V11_HEIGHT) return "name offers need v1.1";
|
|
1289
1287
|
return null;
|
|
1290
1288
|
}
|
|
1291
1289
|
|
|
@@ -1409,7 +1407,7 @@ function resolve(events, tipHeight) {
|
|
|
1409
1407
|
c.pendingCancels = [];
|
|
1410
1408
|
};
|
|
1411
1409
|
for (const ev of applied) {
|
|
1412
|
-
if (ev.height
|
|
1410
|
+
if (beforeActivation(ev.height)) continue;
|
|
1413
1411
|
if (ev.height !== pendingBlock) {
|
|
1414
1412
|
applyPendingCancels();
|
|
1415
1413
|
pendingBlock = ev.height;
|
|
@@ -1943,6 +1941,7 @@ function countOtherHoldsAtGrant(candidates, target, me, closed = /* @__PURE__ */
|
|
|
1943
1941
|
// src/admission.ts
|
|
1944
1942
|
function provenOfferRefusal(rec, tx) {
|
|
1945
1943
|
if (tx.domain !== DOMAIN) return `not a ${DOMAIN} Propose (domain ${JSON.stringify(String(tx.domain))})`;
|
|
1944
|
+
if (beforeActivation(tx.height)) return `anchored before CairnX activation (block ${ACTIVATION_HEIGHT})`;
|
|
1946
1945
|
const ee = typeof tx.expiresEpoch === "bigint" ? Number(tx.expiresEpoch) : tx.expiresEpoch;
|
|
1947
1946
|
return offerEnvelopeRefusal(rec, String(tx.seller).toLowerCase(), tx.height, ee);
|
|
1948
1947
|
}
|
|
@@ -2050,6 +2049,7 @@ export {
|
|
|
2050
2049
|
V28_HEIGHT,
|
|
2051
2050
|
V29_HEIGHT,
|
|
2052
2051
|
ZERO_ADDR,
|
|
2052
|
+
beforeActivation,
|
|
2053
2053
|
bid,
|
|
2054
2054
|
bindOfferTerms,
|
|
2055
2055
|
bindProvenOffer,
|