@inversealtruism/cairnx-core 0.1.44 → 0.2.1
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 +62 -0
- package/CONVENTION.md +150 -150
- package/MAKERS.md +4 -7
- package/README.md +7 -6
- package/dist/index.cjs +1025 -886
- package/dist/index.d.cts +31 -23
- package/dist/index.d.ts +31 -23
- package/dist/index.js +1026 -887
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -427,6 +427,7 @@ declare const nameProfile: (r: Omit<NameProfileRecord, "v" | "t">) => BuiltRecor
|
|
|
427
427
|
declare const fclaim: (r: Omit<FclaimRecord, "v" | "t">) => BuiltRecord;
|
|
428
428
|
|
|
429
429
|
declare function ptAmt(v: unknown): bigint;
|
|
430
|
+
|
|
430
431
|
declare function resolve(events: ChainEvent[], tipHeight: number): CairnXState;
|
|
431
432
|
/** Canonical serialization of state (FORMAT 2) — byte-identical across honest resolvers.
|
|
432
433
|
* The canonical surface is the DATA ONLY: {tipHeight, tokens, balances, names, offers, bids,
|
|
@@ -477,8 +478,9 @@ interface FillPreview {
|
|
|
477
478
|
/** Preview a fill of `offer` paying `payRaw` CSD base units to the seller. Pure; no I/O. */
|
|
478
479
|
declare function previewFill(offer: OfferState, payRaw: bigint | string | number): FillPreview;
|
|
479
480
|
/** The exact CSD outputs a fill of `offer` paying `payRaw` must carry to clear the resolver's value
|
|
480
|
-
* gate
|
|
481
|
-
*
|
|
481
|
+
* gate: the addr→sum map of `applyFill` (whole: payto + treasury fee + maker rebate) and the payment and
|
|
482
|
+
* fee checks of `applyPartialFill` (partial: clamped payment + fee on the clamped amount, NO rebate), both in
|
|
483
|
+
* src/resolve/attest.ts, as a build-ready output
|
|
482
484
|
* list. Amounts are ACCUMULATED per address (payto === seller is the common case; the resolver checks
|
|
483
485
|
* the per-address SUM, so two merged entries must merge here too), insertion order payto → treasury →
|
|
484
486
|
* seller, zero-value entries omitted (a 0 output is unbuildable and the resolver requires nothing).
|
|
@@ -512,7 +514,7 @@ declare function requiredFillOutputs(offer: OfferState, payRaw: bigint | string
|
|
|
512
514
|
* address). The normal CSD-priced case.
|
|
513
515
|
* "token-settled" - a token-priced offer: there are NO CSD outputs to build, and that is NOT the same
|
|
514
516
|
* as "checked". The fill debits the ATTESTER's want-token balance and the attest MUST
|
|
515
|
-
* carry `confidence` (= CONF_TOKEN_FILL
|
|
517
|
+
* carry `confidence` (= CONF_TOKEN_FILL; `applyTokenFill` in src/resolve/attest.ts requires the explicit marker).
|
|
516
518
|
* Verify your token balance and terms yourself before signing.
|
|
517
519
|
* "undeliverable" - the resolver would reject this payment AFTER the CSD moved; do not sign.
|
|
518
520
|
* ADDITIVE and default-safe: requiredFillOutputs is unchanged in behavior (its `[]` is load-bearing in
|
|
@@ -545,10 +547,10 @@ declare function fillOutputPlan(offer: OfferState, payRaw: bigint | string | num
|
|
|
545
547
|
declare const FEE_GATE_MARGIN_BLOCKS = 5;
|
|
546
548
|
declare const buildFeeHeight: (tip: number) => number;
|
|
547
549
|
/** Is the offer an OPEN (untaken) CSD-priced offer subject to the v1.7 claim-to-fill gate at `tip`?
|
|
548
|
-
* Such an offer may be filled ONLY by the holder of a LIVE claim (resolve.ts
|
|
550
|
+
* Such an offer may be filled ONLY by the holder of a LIVE claim (`openFillReject`, src/resolve/attest.ts). */
|
|
549
551
|
declare function isOpenClaimLane(offer: OfferState, tip: number): boolean;
|
|
550
|
-
/** Does `me` currently hold a LIVE claim on `offer` at `tip`? Mirrors resolve.ts
|
|
551
|
-
* who===claimedBy check (
|
|
552
|
+
/** Does `me` currently hold a LIVE claim on `offer` at `tip`? Mirrors `claimHeld` (src/resolve/context.ts) + the
|
|
553
|
+
* who===claimedBy check in `openFillReject` (src/resolve/attest.ts). For a pre-V17 open offer, open fills are banned entirely. */
|
|
552
554
|
declare function hasLiveClaim(offer: OfferState, me: string, tip: number): boolean;
|
|
553
555
|
/** v2.8 Correction 1 mirror (§31): the proposal txid a fill of `offer` MUST attest at `tip`. During a live
|
|
554
556
|
* fclaim hold (V28+) the payment must target the FCLAIM txid, not the offer id (an offer-txid fill is
|
|
@@ -590,8 +592,8 @@ declare function fillIsSafe(offer: OfferState, me: string, pay: bigint | string
|
|
|
590
592
|
* as "refuse" hard-blocks every honest token fill - the named B7f trap).
|
|
591
593
|
*
|
|
592
594
|
* `opts.fillTargetId` is the proposal txid your attest will actually target. Pass it whenever you have
|
|
593
|
-
* it (= `fillTargetId(offer, tip)` for an honest builder). The v2.8 Correction-1 clause (
|
|
594
|
-
*
|
|
595
|
+
* it (= `fillTargetId(offer, tip)` for an honest builder). The v2.8 Correction-1 clause (`openFillReject`,
|
|
596
|
+
* src/resolve/attest.ts): during a live fclaim hold an attest on the OFFER txid is rejected while the payment
|
|
595
597
|
* still moves - the exact doomed fill the deprecated fillIsSafe endorses. If the offer carries a live
|
|
596
598
|
* fclaim-hold routing and no target is supplied, the endorsement fails CLOSED with instructions rather
|
|
597
599
|
* than guessing what your builder will attest. */
|
|
@@ -627,7 +629,7 @@ declare function fillEndorsement(offer: OfferState, me: string, pay: bigint | st
|
|
|
627
629
|
* re-fetched) name record — never a cached one — as `nameState` (undefined = 404 / unregistered = loss).
|
|
628
630
|
*
|
|
629
631
|
* Pass `tip` to ALSO gate the finalize WINDOW, both sides, mirroring the resolver's authoritative checks
|
|
630
|
-
* (resolve.ts
|
|
632
|
+
* (`applyNfinalize` in src/resolve/names.ts rejects unless `ev.height > effHeight + REG_COMMIT_MAX_BLOCKS`, and rejects when
|
|
631
633
|
* `ev.height > finalizeBy`) with the client-side FINALIZE_TIP_MARGIN band the site's finalizeReady applies:
|
|
632
634
|
* the tx signs at `tip` but mines at tip+1 or later, so the margin keeps a boundary-signed finalize from
|
|
633
635
|
* mining outside the window (too early: rejected as unfrozen; too late: past the deadline — either way the
|
|
@@ -741,24 +743,30 @@ declare function provenOfferTerms(offerRec: OfferRecord, provenHeight: number):
|
|
|
741
743
|
* `value` is bound only when `t.value` is defined so a token<->token offer (no CSD value) is not spuriously
|
|
742
744
|
* refused; a caller that binds want.value separately (the site does) may still pass it here (redundant-safe).
|
|
743
745
|
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
*
|
|
746
|
+
* The give and wantType legs (REBIND W2 legs + W7) are ON by default. Their third-argument switches opt out
|
|
747
|
+
* explicitly (`false`); omitted or `undefined` keeps a leg on. With a leg on the terms must be MINTED (the
|
|
748
|
+
* brand), because a hand-built terms object leaves the give/wantType fields undefined and would refuse every
|
|
749
|
+
* honest fill (the W2 trap this file documents). A plain ProvenOfferTerms is accepted only with both legs
|
|
750
|
+
* off, which is the pre-B6 predicate exactly (`scripts/seal-differential.mjs` step 5).
|
|
751
|
+
* give - bind give.ticker / give.amount / give.name: EXPLICIT PRESENCE (a served give growing or
|
|
752
|
+
* losing a field mismatches) AND verbatim string equality. Closes the W7 shortchange (a
|
|
753
|
+
* genuine offer served with give.amount inflated a millionfold passes every other leg).
|
|
754
|
+
* wantType - the SYMMETRIC want-type refusal: the served offer's want type (token iff want.ticker is
|
|
755
|
+
* a string, the isTokenWant pivot) must equal the proven type. The value leg already
|
|
756
|
+
* catches proven-CSD-served-as-token (String(undefined) mismatches t.value); this closes
|
|
757
|
+
* the reverse, proven-token-served-as-CSD.
|
|
755
758
|
*/
|
|
756
759
|
interface BindTermsOpts {
|
|
757
760
|
give?: boolean;
|
|
758
761
|
wantType?: boolean;
|
|
759
762
|
}
|
|
760
|
-
|
|
761
|
-
|
|
763
|
+
/** Both legs off: the pre-B6 verdict, for callers that hold hand-built (unminted) terms. */
|
|
764
|
+
type LegacyBindOpts = {
|
|
765
|
+
give: false;
|
|
766
|
+
wantType: false;
|
|
767
|
+
};
|
|
768
|
+
declare function bindOfferTerms(servedOffer: unknown, t: MintedProvenOfferTerms, opts?: BindTermsOpts): boolean;
|
|
769
|
+
declare function bindOfferTerms(servedOffer: unknown, t: ProvenOfferTerms, opts: LegacyBindOpts): boolean;
|
|
762
770
|
declare function bindProvenOffer(offerEv: ProvenPropose): {
|
|
763
771
|
payto: string;
|
|
764
772
|
seller: string;
|
|
@@ -792,4 +800,4 @@ declare function myProvenFillClosedOffer(fill: ProvenEvent | null, fclaim: {
|
|
|
792
800
|
offer: string;
|
|
793
801
|
}, offerEv: ProvenEvent | null, me: string, grantHeight: number): boolean;
|
|
794
802
|
|
|
795
|
-
export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, type BindTermsOpts, type BuiltRecord, CLAIM_ATTACKER_Q, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_MIN_DEPTH, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, COMMIT_REVEAL_MIN_DEPTH, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DEPLOY_KEYS, DOMAIN, type DeployRecord, FCLAIM_KEYS, FCLAIM_MAX_EPOCH_AHEAD, FCLAIM_WINDOW_MIN, FEE_BPS, FEE_BPS_V16, FEE_GATE_MARGIN_BLOCKS, FILL_TIP_MARGIN, FINALIZE_TIP_MARGIN, type FclaimRecord, type FillEndorsement, type FillEntry, type FillOutputPlan, type FillPreview, type FillSafety, type FillSpvIo, type FillVerdict, GAP_NEEDED, type Give, HASH_RE, type HoldReplay, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MINT_KEYS, type MintRecord, type MintedProvenOfferTerms, NAME_FEE_LEN3_V24, NAME_FEE_LEN4_V24, NAME_FEE_LONG_V24, NAME_FEE_MID_V24, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NFINALIZE_KEYS, NPROFILE_KEYS, type NameCommitRecord, type NameFinalizeRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, OFFER_KEYS, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, type ProvenAttest, type ProvenEvent, type ProvenOfferTerms, type ProvenPropose, REBATE_BPS, REBATE_FLAT, REG_COMMIT_MAX_BLOCKS, REG_FINALIZE_GRACE_BLOCKS, RESERVED_NAMES, SALT_RE, SCAN_MARGIN, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, TRANSFER_KEYS, TREASURY_ADDR, type TokenMetaRecord, type TokenState, type TransferRecord, V11_HEIGHT, V12_HEIGHT, V13_HEIGHT, V14_HEIGHT, V15_HEIGHT, V16_HEIGHT, V17_HEIGHT, V18_HEIGHT, V19_HEIGHT, V20_HEIGHT, V21_HEIGHT, V22_HEIGHT, V23_HEIGHT, V24_HEIGHT, V25_HEIGHT, V26_HEIGHT, V27_HEIGHT, V28_HEIGHT, V29_HEIGHT, type Want, ZERO_ADDR, bid, bindOfferTerms, bindProvenOffer, buildFeeHeight, buildRecord, burnedPayment, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy, expiredClaimFee, fclaim, fclaimEpochFor, fclaimHoldEnd, feeBpsAt, fillEndorsement, fillIsSafe, fillOutputPlan, fillTargetId, finalizeWinnerCheck, hasLiveClaim, isName, isNameGive, isOpenClaimLane, isTokenWant, makerRebate, mint, myProvenFillClosedOffer, nameClaim, nameCommit, nameCommitRecord, nameFinalize, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, offerExpiryHeightOf, paidToFromOutputs, parseAmount, parseRecord, pickPrimaryName, previewFill, primaryRankBefore, provenOfferTerms, ptAmt, replayLiveHold, requiredClaimDepth, requiredFillOutputs, resolve, tokenMeta, tradeFee, transfer, unsafeMintProvenOfferTerms, verifyFillSpv };
|
|
803
|
+
export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, type BindTermsOpts, type BuiltRecord, CLAIM_ATTACKER_Q, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_MIN_DEPTH, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, COMMIT_REVEAL_MIN_DEPTH, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DEPLOY_KEYS, DOMAIN, type DeployRecord, FCLAIM_KEYS, FCLAIM_MAX_EPOCH_AHEAD, FCLAIM_WINDOW_MIN, FEE_BPS, FEE_BPS_V16, FEE_GATE_MARGIN_BLOCKS, FILL_TIP_MARGIN, FINALIZE_TIP_MARGIN, type FclaimRecord, type FillEndorsement, type FillEntry, type FillOutputPlan, type FillPreview, type FillSafety, type FillSpvIo, type FillVerdict, GAP_NEEDED, type Give, HASH_RE, type HoldReplay, type LegacyBindOpts, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MINT_KEYS, type MintRecord, type MintedProvenOfferTerms, NAME_FEE_LEN3_V24, NAME_FEE_LEN4_V24, NAME_FEE_LONG_V24, NAME_FEE_MID_V24, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NFINALIZE_KEYS, NPROFILE_KEYS, type NameCommitRecord, type NameFinalizeRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, OFFER_KEYS, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, type ProvenAttest, type ProvenEvent, type ProvenOfferTerms, type ProvenPropose, REBATE_BPS, REBATE_FLAT, REG_COMMIT_MAX_BLOCKS, REG_FINALIZE_GRACE_BLOCKS, RESERVED_NAMES, SALT_RE, SCAN_MARGIN, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, TRANSFER_KEYS, TREASURY_ADDR, type TokenMetaRecord, type TokenState, type TransferRecord, V11_HEIGHT, V12_HEIGHT, V13_HEIGHT, V14_HEIGHT, V15_HEIGHT, V16_HEIGHT, V17_HEIGHT, V18_HEIGHT, V19_HEIGHT, V20_HEIGHT, V21_HEIGHT, V22_HEIGHT, V23_HEIGHT, V24_HEIGHT, V25_HEIGHT, V26_HEIGHT, V27_HEIGHT, V28_HEIGHT, V29_HEIGHT, type Want, ZERO_ADDR, bid, bindOfferTerms, bindProvenOffer, buildFeeHeight, buildRecord, burnedPayment, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy, expiredClaimFee, fclaim, fclaimEpochFor, fclaimHoldEnd, feeBpsAt, fillEndorsement, fillIsSafe, fillOutputPlan, fillTargetId, finalizeWinnerCheck, hasLiveClaim, isName, isNameGive, isOpenClaimLane, isTokenWant, makerRebate, mint, myProvenFillClosedOffer, nameClaim, nameCommit, nameCommitRecord, nameFinalize, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, offerExpiryHeightOf, paidToFromOutputs, parseAmount, parseRecord, pickPrimaryName, previewFill, primaryRankBefore, provenOfferTerms, ptAmt, replayLiveHold, requiredClaimDepth, requiredFillOutputs, resolve, tokenMeta, tradeFee, transfer, unsafeMintProvenOfferTerms, verifyFillSpv };
|
package/dist/index.d.ts
CHANGED
|
@@ -427,6 +427,7 @@ declare const nameProfile: (r: Omit<NameProfileRecord, "v" | "t">) => BuiltRecor
|
|
|
427
427
|
declare const fclaim: (r: Omit<FclaimRecord, "v" | "t">) => BuiltRecord;
|
|
428
428
|
|
|
429
429
|
declare function ptAmt(v: unknown): bigint;
|
|
430
|
+
|
|
430
431
|
declare function resolve(events: ChainEvent[], tipHeight: number): CairnXState;
|
|
431
432
|
/** Canonical serialization of state (FORMAT 2) — byte-identical across honest resolvers.
|
|
432
433
|
* The canonical surface is the DATA ONLY: {tipHeight, tokens, balances, names, offers, bids,
|
|
@@ -477,8 +478,9 @@ interface FillPreview {
|
|
|
477
478
|
/** Preview a fill of `offer` paying `payRaw` CSD base units to the seller. Pure; no I/O. */
|
|
478
479
|
declare function previewFill(offer: OfferState, payRaw: bigint | string | number): FillPreview;
|
|
479
480
|
/** The exact CSD outputs a fill of `offer` paying `payRaw` must carry to clear the resolver's value
|
|
480
|
-
* gate
|
|
481
|
-
*
|
|
481
|
+
* gate: the addr→sum map of `applyFill` (whole: payto + treasury fee + maker rebate) and the payment and
|
|
482
|
+
* fee checks of `applyPartialFill` (partial: clamped payment + fee on the clamped amount, NO rebate), both in
|
|
483
|
+
* src/resolve/attest.ts, as a build-ready output
|
|
482
484
|
* list. Amounts are ACCUMULATED per address (payto === seller is the common case; the resolver checks
|
|
483
485
|
* the per-address SUM, so two merged entries must merge here too), insertion order payto → treasury →
|
|
484
486
|
* seller, zero-value entries omitted (a 0 output is unbuildable and the resolver requires nothing).
|
|
@@ -512,7 +514,7 @@ declare function requiredFillOutputs(offer: OfferState, payRaw: bigint | string
|
|
|
512
514
|
* address). The normal CSD-priced case.
|
|
513
515
|
* "token-settled" - a token-priced offer: there are NO CSD outputs to build, and that is NOT the same
|
|
514
516
|
* as "checked". The fill debits the ATTESTER's want-token balance and the attest MUST
|
|
515
|
-
* carry `confidence` (= CONF_TOKEN_FILL
|
|
517
|
+
* carry `confidence` (= CONF_TOKEN_FILL; `applyTokenFill` in src/resolve/attest.ts requires the explicit marker).
|
|
516
518
|
* Verify your token balance and terms yourself before signing.
|
|
517
519
|
* "undeliverable" - the resolver would reject this payment AFTER the CSD moved; do not sign.
|
|
518
520
|
* ADDITIVE and default-safe: requiredFillOutputs is unchanged in behavior (its `[]` is load-bearing in
|
|
@@ -545,10 +547,10 @@ declare function fillOutputPlan(offer: OfferState, payRaw: bigint | string | num
|
|
|
545
547
|
declare const FEE_GATE_MARGIN_BLOCKS = 5;
|
|
546
548
|
declare const buildFeeHeight: (tip: number) => number;
|
|
547
549
|
/** Is the offer an OPEN (untaken) CSD-priced offer subject to the v1.7 claim-to-fill gate at `tip`?
|
|
548
|
-
* Such an offer may be filled ONLY by the holder of a LIVE claim (resolve.ts
|
|
550
|
+
* Such an offer may be filled ONLY by the holder of a LIVE claim (`openFillReject`, src/resolve/attest.ts). */
|
|
549
551
|
declare function isOpenClaimLane(offer: OfferState, tip: number): boolean;
|
|
550
|
-
/** Does `me` currently hold a LIVE claim on `offer` at `tip`? Mirrors resolve.ts
|
|
551
|
-
* who===claimedBy check (
|
|
552
|
+
/** Does `me` currently hold a LIVE claim on `offer` at `tip`? Mirrors `claimHeld` (src/resolve/context.ts) + the
|
|
553
|
+
* who===claimedBy check in `openFillReject` (src/resolve/attest.ts). For a pre-V17 open offer, open fills are banned entirely. */
|
|
552
554
|
declare function hasLiveClaim(offer: OfferState, me: string, tip: number): boolean;
|
|
553
555
|
/** v2.8 Correction 1 mirror (§31): the proposal txid a fill of `offer` MUST attest at `tip`. During a live
|
|
554
556
|
* fclaim hold (V28+) the payment must target the FCLAIM txid, not the offer id (an offer-txid fill is
|
|
@@ -590,8 +592,8 @@ declare function fillIsSafe(offer: OfferState, me: string, pay: bigint | string
|
|
|
590
592
|
* as "refuse" hard-blocks every honest token fill - the named B7f trap).
|
|
591
593
|
*
|
|
592
594
|
* `opts.fillTargetId` is the proposal txid your attest will actually target. Pass it whenever you have
|
|
593
|
-
* it (= `fillTargetId(offer, tip)` for an honest builder). The v2.8 Correction-1 clause (
|
|
594
|
-
*
|
|
595
|
+
* it (= `fillTargetId(offer, tip)` for an honest builder). The v2.8 Correction-1 clause (`openFillReject`,
|
|
596
|
+
* src/resolve/attest.ts): during a live fclaim hold an attest on the OFFER txid is rejected while the payment
|
|
595
597
|
* still moves - the exact doomed fill the deprecated fillIsSafe endorses. If the offer carries a live
|
|
596
598
|
* fclaim-hold routing and no target is supplied, the endorsement fails CLOSED with instructions rather
|
|
597
599
|
* than guessing what your builder will attest. */
|
|
@@ -627,7 +629,7 @@ declare function fillEndorsement(offer: OfferState, me: string, pay: bigint | st
|
|
|
627
629
|
* re-fetched) name record — never a cached one — as `nameState` (undefined = 404 / unregistered = loss).
|
|
628
630
|
*
|
|
629
631
|
* Pass `tip` to ALSO gate the finalize WINDOW, both sides, mirroring the resolver's authoritative checks
|
|
630
|
-
* (resolve.ts
|
|
632
|
+
* (`applyNfinalize` in src/resolve/names.ts rejects unless `ev.height > effHeight + REG_COMMIT_MAX_BLOCKS`, and rejects when
|
|
631
633
|
* `ev.height > finalizeBy`) with the client-side FINALIZE_TIP_MARGIN band the site's finalizeReady applies:
|
|
632
634
|
* the tx signs at `tip` but mines at tip+1 or later, so the margin keeps a boundary-signed finalize from
|
|
633
635
|
* mining outside the window (too early: rejected as unfrozen; too late: past the deadline — either way the
|
|
@@ -741,24 +743,30 @@ declare function provenOfferTerms(offerRec: OfferRecord, provenHeight: number):
|
|
|
741
743
|
* `value` is bound only when `t.value` is defined so a token<->token offer (no CSD value) is not spuriously
|
|
742
744
|
* refused; a caller that binds want.value separately (the site does) may still pass it here (redundant-safe).
|
|
743
745
|
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
*
|
|
746
|
+
* The give and wantType legs (REBIND W2 legs + W7) are ON by default. Their third-argument switches opt out
|
|
747
|
+
* explicitly (`false`); omitted or `undefined` keeps a leg on. With a leg on the terms must be MINTED (the
|
|
748
|
+
* brand), because a hand-built terms object leaves the give/wantType fields undefined and would refuse every
|
|
749
|
+
* honest fill (the W2 trap this file documents). A plain ProvenOfferTerms is accepted only with both legs
|
|
750
|
+
* off, which is the pre-B6 predicate exactly (`scripts/seal-differential.mjs` step 5).
|
|
751
|
+
* give - bind give.ticker / give.amount / give.name: EXPLICIT PRESENCE (a served give growing or
|
|
752
|
+
* losing a field mismatches) AND verbatim string equality. Closes the W7 shortchange (a
|
|
753
|
+
* genuine offer served with give.amount inflated a millionfold passes every other leg).
|
|
754
|
+
* wantType - the SYMMETRIC want-type refusal: the served offer's want type (token iff want.ticker is
|
|
755
|
+
* a string, the isTokenWant pivot) must equal the proven type. The value leg already
|
|
756
|
+
* catches proven-CSD-served-as-token (String(undefined) mismatches t.value); this closes
|
|
757
|
+
* the reverse, proven-token-served-as-CSD.
|
|
755
758
|
*/
|
|
756
759
|
interface BindTermsOpts {
|
|
757
760
|
give?: boolean;
|
|
758
761
|
wantType?: boolean;
|
|
759
762
|
}
|
|
760
|
-
|
|
761
|
-
|
|
763
|
+
/** Both legs off: the pre-B6 verdict, for callers that hold hand-built (unminted) terms. */
|
|
764
|
+
type LegacyBindOpts = {
|
|
765
|
+
give: false;
|
|
766
|
+
wantType: false;
|
|
767
|
+
};
|
|
768
|
+
declare function bindOfferTerms(servedOffer: unknown, t: MintedProvenOfferTerms, opts?: BindTermsOpts): boolean;
|
|
769
|
+
declare function bindOfferTerms(servedOffer: unknown, t: ProvenOfferTerms, opts: LegacyBindOpts): boolean;
|
|
762
770
|
declare function bindProvenOffer(offerEv: ProvenPropose): {
|
|
763
771
|
payto: string;
|
|
764
772
|
seller: string;
|
|
@@ -792,4 +800,4 @@ declare function myProvenFillClosedOffer(fill: ProvenEvent | null, fclaim: {
|
|
|
792
800
|
offer: string;
|
|
793
801
|
}, offerEv: ProvenEvent | null, me: string, grantHeight: number): boolean;
|
|
794
802
|
|
|
795
|
-
export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, type BindTermsOpts, type BuiltRecord, CLAIM_ATTACKER_Q, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_MIN_DEPTH, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, COMMIT_REVEAL_MIN_DEPTH, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DEPLOY_KEYS, DOMAIN, type DeployRecord, FCLAIM_KEYS, FCLAIM_MAX_EPOCH_AHEAD, FCLAIM_WINDOW_MIN, FEE_BPS, FEE_BPS_V16, FEE_GATE_MARGIN_BLOCKS, FILL_TIP_MARGIN, FINALIZE_TIP_MARGIN, type FclaimRecord, type FillEndorsement, type FillEntry, type FillOutputPlan, type FillPreview, type FillSafety, type FillSpvIo, type FillVerdict, GAP_NEEDED, type Give, HASH_RE, type HoldReplay, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MINT_KEYS, type MintRecord, type MintedProvenOfferTerms, NAME_FEE_LEN3_V24, NAME_FEE_LEN4_V24, NAME_FEE_LONG_V24, NAME_FEE_MID_V24, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NFINALIZE_KEYS, NPROFILE_KEYS, type NameCommitRecord, type NameFinalizeRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, OFFER_KEYS, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, type ProvenAttest, type ProvenEvent, type ProvenOfferTerms, type ProvenPropose, REBATE_BPS, REBATE_FLAT, REG_COMMIT_MAX_BLOCKS, REG_FINALIZE_GRACE_BLOCKS, RESERVED_NAMES, SALT_RE, SCAN_MARGIN, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, TRANSFER_KEYS, TREASURY_ADDR, type TokenMetaRecord, type TokenState, type TransferRecord, V11_HEIGHT, V12_HEIGHT, V13_HEIGHT, V14_HEIGHT, V15_HEIGHT, V16_HEIGHT, V17_HEIGHT, V18_HEIGHT, V19_HEIGHT, V20_HEIGHT, V21_HEIGHT, V22_HEIGHT, V23_HEIGHT, V24_HEIGHT, V25_HEIGHT, V26_HEIGHT, V27_HEIGHT, V28_HEIGHT, V29_HEIGHT, type Want, ZERO_ADDR, bid, bindOfferTerms, bindProvenOffer, buildFeeHeight, buildRecord, burnedPayment, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy, expiredClaimFee, fclaim, fclaimEpochFor, fclaimHoldEnd, feeBpsAt, fillEndorsement, fillIsSafe, fillOutputPlan, fillTargetId, finalizeWinnerCheck, hasLiveClaim, isName, isNameGive, isOpenClaimLane, isTokenWant, makerRebate, mint, myProvenFillClosedOffer, nameClaim, nameCommit, nameCommitRecord, nameFinalize, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, offerExpiryHeightOf, paidToFromOutputs, parseAmount, parseRecord, pickPrimaryName, previewFill, primaryRankBefore, provenOfferTerms, ptAmt, replayLiveHold, requiredClaimDepth, requiredFillOutputs, resolve, tokenMeta, tradeFee, transfer, unsafeMintProvenOfferTerms, verifyFillSpv };
|
|
803
|
+
export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, type BindTermsOpts, type BuiltRecord, CLAIM_ATTACKER_Q, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_MIN_DEPTH, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, COMMIT_REVEAL_MIN_DEPTH, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DEPLOY_KEYS, DOMAIN, type DeployRecord, FCLAIM_KEYS, FCLAIM_MAX_EPOCH_AHEAD, FCLAIM_WINDOW_MIN, FEE_BPS, FEE_BPS_V16, FEE_GATE_MARGIN_BLOCKS, FILL_TIP_MARGIN, FINALIZE_TIP_MARGIN, type FclaimRecord, type FillEndorsement, type FillEntry, type FillOutputPlan, type FillPreview, type FillSafety, type FillSpvIo, type FillVerdict, GAP_NEEDED, type Give, HASH_RE, type HoldReplay, type LegacyBindOpts, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MAX_SCAN, MINT_KEYS, type MintRecord, type MintedProvenOfferTerms, NAME_FEE_LEN3_V24, NAME_FEE_LEN4_V24, NAME_FEE_LONG_V24, NAME_FEE_MID_V24, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NFINALIZE_KEYS, NPROFILE_KEYS, type NameCommitRecord, type NameFinalizeRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, OFFER_KEYS, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, type ProvenAttest, type ProvenEvent, type ProvenOfferTerms, type ProvenPropose, REBATE_BPS, REBATE_FLAT, REG_COMMIT_MAX_BLOCKS, REG_FINALIZE_GRACE_BLOCKS, RESERVED_NAMES, SALT_RE, SCAN_MARGIN, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, TRANSFER_KEYS, TREASURY_ADDR, type TokenMetaRecord, type TokenState, type TransferRecord, V11_HEIGHT, V12_HEIGHT, V13_HEIGHT, V14_HEIGHT, V15_HEIGHT, V16_HEIGHT, V17_HEIGHT, V18_HEIGHT, V19_HEIGHT, V20_HEIGHT, V21_HEIGHT, V22_HEIGHT, V23_HEIGHT, V24_HEIGHT, V25_HEIGHT, V26_HEIGHT, V27_HEIGHT, V28_HEIGHT, V29_HEIGHT, type Want, ZERO_ADDR, bid, bindOfferTerms, bindProvenOffer, buildFeeHeight, buildRecord, burnedPayment, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy, expiredClaimFee, fclaim, fclaimEpochFor, fclaimHoldEnd, feeBpsAt, fillEndorsement, fillIsSafe, fillOutputPlan, fillTargetId, finalizeWinnerCheck, hasLiveClaim, isName, isNameGive, isOpenClaimLane, isTokenWant, makerRebate, mint, myProvenFillClosedOffer, nameClaim, nameCommit, nameCommitRecord, nameFinalize, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, offerExpiryHeightOf, paidToFromOutputs, parseAmount, parseRecord, pickPrimaryName, previewFill, primaryRankBefore, provenOfferTerms, ptAmt, replayLiveHold, requiredClaimDepth, requiredFillOutputs, resolve, tokenMeta, tradeFee, transfer, unsafeMintProvenOfferTerms, verifyFillSpv };
|