@inversealtruism/cairnx-core 0.1.14 → 0.1.15
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 +19 -8
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +16 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,9 @@ __export(index_exports, {
|
|
|
24
24
|
ADDR_RE: () => ADDR_RE,
|
|
25
25
|
AMOUNT_RE: () => AMOUNT_RE,
|
|
26
26
|
CLAIM_COOLDOWN_BLOCKS: () => CLAIM_COOLDOWN_BLOCKS,
|
|
27
|
+
CLAIM_FILL_GRACE_BLOCKS: () => CLAIM_FILL_GRACE_BLOCKS,
|
|
27
28
|
CLAIM_WINDOW_BLOCKS: () => CLAIM_WINDOW_BLOCKS,
|
|
29
|
+
CLAIM_WINDOW_BLOCKS_V20: () => CLAIM_WINDOW_BLOCKS_V20,
|
|
28
30
|
COMMIT_MAX_BLOCKS: () => COMMIT_MAX_BLOCKS,
|
|
29
31
|
CONF_TOKEN_FILL: () => CONF_TOKEN_FILL,
|
|
30
32
|
DEPLOY_FEE: () => DEPLOY_FEE,
|
|
@@ -64,6 +66,7 @@ __export(index_exports, {
|
|
|
64
66
|
V17_HEIGHT: () => V17_HEIGHT,
|
|
65
67
|
V18_HEIGHT: () => V18_HEIGHT,
|
|
66
68
|
V19_HEIGHT: () => V19_HEIGHT,
|
|
69
|
+
V20_HEIGHT: () => V20_HEIGHT,
|
|
67
70
|
bid: () => bid,
|
|
68
71
|
buildRecord: () => buildRecord,
|
|
69
72
|
canonicalState: () => canonicalState,
|
|
@@ -122,6 +125,8 @@ var SCORE_FILL = 100;
|
|
|
122
125
|
var SCORE_CANCEL = 0;
|
|
123
126
|
var SCORE_CLAIM = 50;
|
|
124
127
|
var CLAIM_WINDOW_BLOCKS = 15;
|
|
128
|
+
var CLAIM_WINDOW_BLOCKS_V20 = 40;
|
|
129
|
+
var CLAIM_FILL_GRACE_BLOCKS = 5;
|
|
125
130
|
var MAX_ACTIVE_CLAIMS = 3;
|
|
126
131
|
var CLAIM_COOLDOWN_BLOCKS = 15;
|
|
127
132
|
var CONF_TOKEN_FILL = 1e6;
|
|
@@ -135,6 +140,7 @@ var V18_HEIGHT = 4e4;
|
|
|
135
140
|
var NAME_FEE_SHORT_V18 = 670000000n;
|
|
136
141
|
var NAME_FEE_V18 = 300000000n;
|
|
137
142
|
var V19_HEIGHT = 36700;
|
|
143
|
+
var V20_HEIGHT = 38400;
|
|
138
144
|
var PKEY = /^[a-z0-9](?:[a-z0-9.-]{0,30}[a-z0-9])?$/;
|
|
139
145
|
var PROFILE_MAX_KEYS = 16;
|
|
140
146
|
var PROFILE_MAX_VALUE_BYTES = 256;
|
|
@@ -453,7 +459,9 @@ function resolve(events, tipHeight) {
|
|
|
453
459
|
const b = bids.get(o.bid);
|
|
454
460
|
if (b && b.status === "open" && b.bidder === buyer) b.status = "done";
|
|
455
461
|
};
|
|
456
|
-
const
|
|
462
|
+
const claimGrace = (o) => o.claimUntilHeight !== void 0 && o.claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_FILL_GRACE_BLOCKS : 0;
|
|
463
|
+
const claimHeld = (o, height) => o.claimedBy !== void 0 && o.claimUntilHeight !== void 0 && height < o.claimUntilHeight + claimGrace(o);
|
|
464
|
+
const claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
|
|
457
465
|
for (const ev of ordered) {
|
|
458
466
|
if (ev.height < ACTIVATION_HEIGHT) continue;
|
|
459
467
|
if (ev.height !== pendingBlock) {
|
|
@@ -935,7 +943,7 @@ function resolve(events, tipHeight) {
|
|
|
935
943
|
note(ev, ev.txid, "fill", false, "v1.3: open CSD-quoted fills disabled (offer must be taker-bound)");
|
|
936
944
|
continue;
|
|
937
945
|
}
|
|
938
|
-
if (!(
|
|
946
|
+
if (!(claimHeld(o, ev.height) && who === o.claimedBy)) {
|
|
939
947
|
note(ev, ev.txid, "fill", false, "v1.7: open offer \u2014 claim it first (no live claim by you)");
|
|
940
948
|
continue;
|
|
941
949
|
}
|
|
@@ -1000,7 +1008,7 @@ function resolve(events, tipHeight) {
|
|
|
1000
1008
|
note(ev, ev.txid, "fill", false, "v1.3: open CSD-quoted fills disabled (offer must be taker-bound)");
|
|
1001
1009
|
continue;
|
|
1002
1010
|
}
|
|
1003
|
-
if (!(
|
|
1011
|
+
if (!(claimHeld(o, ev.height) && who === o.claimedBy)) {
|
|
1004
1012
|
note(ev, ev.txid, "fill", false, "v1.7: open offer \u2014 claim it first (no live claim by you)");
|
|
1005
1013
|
continue;
|
|
1006
1014
|
}
|
|
@@ -1070,22 +1078,22 @@ function resolve(events, tipHeight) {
|
|
|
1070
1078
|
note(ev, ev.txid, "claim", false, "claims are for CSD-priced offers (token offers are no-op-safe)");
|
|
1071
1079
|
continue;
|
|
1072
1080
|
}
|
|
1073
|
-
if (
|
|
1074
|
-
note(ev, ev.txid, "claim", false, "offer already claimed (
|
|
1081
|
+
if (claimHeld(o, ev.height)) {
|
|
1082
|
+
note(ev, ev.txid, "claim", false, "offer already claimed (hold live)");
|
|
1075
1083
|
continue;
|
|
1076
1084
|
}
|
|
1077
|
-
if (o.claimedBy === who && o.claimUntilHeight !== void 0 && ev.height < o.claimUntilHeight + CLAIM_COOLDOWN_BLOCKS) {
|
|
1085
|
+
if (o.claimedBy === who && o.claimUntilHeight !== void 0 && ev.height < o.claimUntilHeight + claimGrace(o) + CLAIM_COOLDOWN_BLOCKS) {
|
|
1078
1086
|
note(ev, ev.txid, "claim", false, "claim cooldown (you just held this offer)");
|
|
1079
1087
|
continue;
|
|
1080
1088
|
}
|
|
1081
1089
|
let liveN = 0;
|
|
1082
|
-
for (const x of offers.values()) if (x.claimedBy === who && x
|
|
1090
|
+
for (const x of offers.values()) if (x.claimedBy === who && claimHeld(x, ev.height)) liveN++;
|
|
1083
1091
|
if (liveN >= MAX_ACTIVE_CLAIMS) {
|
|
1084
1092
|
note(ev, ev.txid, "claim", false, `max ${MAX_ACTIVE_CLAIMS} live claims per address`);
|
|
1085
1093
|
continue;
|
|
1086
1094
|
}
|
|
1087
1095
|
o.claimedBy = who;
|
|
1088
|
-
o.claimUntilHeight = ev.height +
|
|
1096
|
+
o.claimUntilHeight = ev.height + claimWindowAt(ev.height);
|
|
1089
1097
|
note(ev, ev.txid, "claim", true);
|
|
1090
1098
|
}
|
|
1091
1099
|
}
|
|
@@ -1147,7 +1155,9 @@ function canonicalState(s) {
|
|
|
1147
1155
|
ADDR_RE,
|
|
1148
1156
|
AMOUNT_RE,
|
|
1149
1157
|
CLAIM_COOLDOWN_BLOCKS,
|
|
1158
|
+
CLAIM_FILL_GRACE_BLOCKS,
|
|
1150
1159
|
CLAIM_WINDOW_BLOCKS,
|
|
1160
|
+
CLAIM_WINDOW_BLOCKS_V20,
|
|
1151
1161
|
COMMIT_MAX_BLOCKS,
|
|
1152
1162
|
CONF_TOKEN_FILL,
|
|
1153
1163
|
DEPLOY_FEE,
|
|
@@ -1187,6 +1197,7 @@ function canonicalState(s) {
|
|
|
1187
1197
|
V17_HEIGHT,
|
|
1188
1198
|
V18_HEIGHT,
|
|
1189
1199
|
V19_HEIGHT,
|
|
1200
|
+
V20_HEIGHT,
|
|
1190
1201
|
bid,
|
|
1191
1202
|
buildRecord,
|
|
1192
1203
|
canonicalState,
|
package/dist/index.d.cts
CHANGED
|
@@ -23,6 +23,8 @@ declare const SCORE_FILL = 100;
|
|
|
23
23
|
declare const SCORE_CANCEL = 0;
|
|
24
24
|
declare const SCORE_CLAIM = 50;
|
|
25
25
|
declare const CLAIM_WINDOW_BLOCKS = 15;
|
|
26
|
+
declare const CLAIM_WINDOW_BLOCKS_V20 = 40;
|
|
27
|
+
declare const CLAIM_FILL_GRACE_BLOCKS = 5;
|
|
26
28
|
declare const MAX_ACTIVE_CLAIMS = 3;
|
|
27
29
|
declare const CLAIM_COOLDOWN_BLOCKS = 15;
|
|
28
30
|
declare const CONF_TOKEN_FILL = 1000000;
|
|
@@ -36,6 +38,7 @@ declare const V18_HEIGHT = 40000;
|
|
|
36
38
|
declare const NAME_FEE_SHORT_V18 = 670000000n;
|
|
37
39
|
declare const NAME_FEE_V18 = 300000000n;
|
|
38
40
|
declare const V19_HEIGHT = 36700;
|
|
41
|
+
declare const V20_HEIGHT = 38400;
|
|
39
42
|
declare const PKEY: RegExp;
|
|
40
43
|
declare const PROFILE_MAX_KEYS = 16;
|
|
41
44
|
declare const PROFILE_MAX_VALUE_BYTES = 256;
|
|
@@ -357,4 +360,4 @@ declare function resolve(events: ChainEvent[], tipHeight: number): CairnXState;
|
|
|
357
360
|
* history.) Keys sort in ordinal (code-unit) order at every depth. */
|
|
358
361
|
declare function canonicalState(s: CairnXState): string;
|
|
359
362
|
|
|
360
|
-
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_WINDOW_BLOCKS, 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_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, 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 };
|
|
363
|
+
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_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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ declare const SCORE_FILL = 100;
|
|
|
23
23
|
declare const SCORE_CANCEL = 0;
|
|
24
24
|
declare const SCORE_CLAIM = 50;
|
|
25
25
|
declare const CLAIM_WINDOW_BLOCKS = 15;
|
|
26
|
+
declare const CLAIM_WINDOW_BLOCKS_V20 = 40;
|
|
27
|
+
declare const CLAIM_FILL_GRACE_BLOCKS = 5;
|
|
26
28
|
declare const MAX_ACTIVE_CLAIMS = 3;
|
|
27
29
|
declare const CLAIM_COOLDOWN_BLOCKS = 15;
|
|
28
30
|
declare const CONF_TOKEN_FILL = 1000000;
|
|
@@ -36,6 +38,7 @@ declare const V18_HEIGHT = 40000;
|
|
|
36
38
|
declare const NAME_FEE_SHORT_V18 = 670000000n;
|
|
37
39
|
declare const NAME_FEE_V18 = 300000000n;
|
|
38
40
|
declare const V19_HEIGHT = 36700;
|
|
41
|
+
declare const V20_HEIGHT = 38400;
|
|
39
42
|
declare const PKEY: RegExp;
|
|
40
43
|
declare const PROFILE_MAX_KEYS = 16;
|
|
41
44
|
declare const PROFILE_MAX_VALUE_BYTES = 256;
|
|
@@ -357,4 +360,4 @@ declare function resolve(events: ChainEvent[], tipHeight: number): CairnXState;
|
|
|
357
360
|
* history.) Keys sort in ordinal (code-unit) order at every depth. */
|
|
358
361
|
declare function canonicalState(s: CairnXState): string;
|
|
359
362
|
|
|
360
|
-
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_WINDOW_BLOCKS, 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_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, 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 };
|
|
363
|
+
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_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, 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 };
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,8 @@ var SCORE_FILL = 100;
|
|
|
26
26
|
var SCORE_CANCEL = 0;
|
|
27
27
|
var SCORE_CLAIM = 50;
|
|
28
28
|
var CLAIM_WINDOW_BLOCKS = 15;
|
|
29
|
+
var CLAIM_WINDOW_BLOCKS_V20 = 40;
|
|
30
|
+
var CLAIM_FILL_GRACE_BLOCKS = 5;
|
|
29
31
|
var MAX_ACTIVE_CLAIMS = 3;
|
|
30
32
|
var CLAIM_COOLDOWN_BLOCKS = 15;
|
|
31
33
|
var CONF_TOKEN_FILL = 1e6;
|
|
@@ -39,6 +41,7 @@ var V18_HEIGHT = 4e4;
|
|
|
39
41
|
var NAME_FEE_SHORT_V18 = 670000000n;
|
|
40
42
|
var NAME_FEE_V18 = 300000000n;
|
|
41
43
|
var V19_HEIGHT = 36700;
|
|
44
|
+
var V20_HEIGHT = 38400;
|
|
42
45
|
var PKEY = /^[a-z0-9](?:[a-z0-9.-]{0,30}[a-z0-9])?$/;
|
|
43
46
|
var PROFILE_MAX_KEYS = 16;
|
|
44
47
|
var PROFILE_MAX_VALUE_BYTES = 256;
|
|
@@ -357,7 +360,9 @@ function resolve(events, tipHeight) {
|
|
|
357
360
|
const b = bids.get(o.bid);
|
|
358
361
|
if (b && b.status === "open" && b.bidder === buyer) b.status = "done";
|
|
359
362
|
};
|
|
360
|
-
const
|
|
363
|
+
const claimGrace = (o) => o.claimUntilHeight !== void 0 && o.claimUntilHeight - CLAIM_WINDOW_BLOCKS_V20 >= V20_HEIGHT ? CLAIM_FILL_GRACE_BLOCKS : 0;
|
|
364
|
+
const claimHeld = (o, height) => o.claimedBy !== void 0 && o.claimUntilHeight !== void 0 && height < o.claimUntilHeight + claimGrace(o);
|
|
365
|
+
const claimWindowAt = (height) => height >= V20_HEIGHT ? CLAIM_WINDOW_BLOCKS_V20 : CLAIM_WINDOW_BLOCKS;
|
|
361
366
|
for (const ev of ordered) {
|
|
362
367
|
if (ev.height < ACTIVATION_HEIGHT) continue;
|
|
363
368
|
if (ev.height !== pendingBlock) {
|
|
@@ -839,7 +844,7 @@ function resolve(events, tipHeight) {
|
|
|
839
844
|
note(ev, ev.txid, "fill", false, "v1.3: open CSD-quoted fills disabled (offer must be taker-bound)");
|
|
840
845
|
continue;
|
|
841
846
|
}
|
|
842
|
-
if (!(
|
|
847
|
+
if (!(claimHeld(o, ev.height) && who === o.claimedBy)) {
|
|
843
848
|
note(ev, ev.txid, "fill", false, "v1.7: open offer \u2014 claim it first (no live claim by you)");
|
|
844
849
|
continue;
|
|
845
850
|
}
|
|
@@ -904,7 +909,7 @@ function resolve(events, tipHeight) {
|
|
|
904
909
|
note(ev, ev.txid, "fill", false, "v1.3: open CSD-quoted fills disabled (offer must be taker-bound)");
|
|
905
910
|
continue;
|
|
906
911
|
}
|
|
907
|
-
if (!(
|
|
912
|
+
if (!(claimHeld(o, ev.height) && who === o.claimedBy)) {
|
|
908
913
|
note(ev, ev.txid, "fill", false, "v1.7: open offer \u2014 claim it first (no live claim by you)");
|
|
909
914
|
continue;
|
|
910
915
|
}
|
|
@@ -974,22 +979,22 @@ function resolve(events, tipHeight) {
|
|
|
974
979
|
note(ev, ev.txid, "claim", false, "claims are for CSD-priced offers (token offers are no-op-safe)");
|
|
975
980
|
continue;
|
|
976
981
|
}
|
|
977
|
-
if (
|
|
978
|
-
note(ev, ev.txid, "claim", false, "offer already claimed (
|
|
982
|
+
if (claimHeld(o, ev.height)) {
|
|
983
|
+
note(ev, ev.txid, "claim", false, "offer already claimed (hold live)");
|
|
979
984
|
continue;
|
|
980
985
|
}
|
|
981
|
-
if (o.claimedBy === who && o.claimUntilHeight !== void 0 && ev.height < o.claimUntilHeight + CLAIM_COOLDOWN_BLOCKS) {
|
|
986
|
+
if (o.claimedBy === who && o.claimUntilHeight !== void 0 && ev.height < o.claimUntilHeight + claimGrace(o) + CLAIM_COOLDOWN_BLOCKS) {
|
|
982
987
|
note(ev, ev.txid, "claim", false, "claim cooldown (you just held this offer)");
|
|
983
988
|
continue;
|
|
984
989
|
}
|
|
985
990
|
let liveN = 0;
|
|
986
|
-
for (const x of offers.values()) if (x.claimedBy === who && x
|
|
991
|
+
for (const x of offers.values()) if (x.claimedBy === who && claimHeld(x, ev.height)) liveN++;
|
|
987
992
|
if (liveN >= MAX_ACTIVE_CLAIMS) {
|
|
988
993
|
note(ev, ev.txid, "claim", false, `max ${MAX_ACTIVE_CLAIMS} live claims per address`);
|
|
989
994
|
continue;
|
|
990
995
|
}
|
|
991
996
|
o.claimedBy = who;
|
|
992
|
-
o.claimUntilHeight = ev.height +
|
|
997
|
+
o.claimUntilHeight = ev.height + claimWindowAt(ev.height);
|
|
993
998
|
note(ev, ev.txid, "claim", true);
|
|
994
999
|
}
|
|
995
1000
|
}
|
|
@@ -1050,7 +1055,9 @@ export {
|
|
|
1050
1055
|
ADDR_RE,
|
|
1051
1056
|
AMOUNT_RE,
|
|
1052
1057
|
CLAIM_COOLDOWN_BLOCKS,
|
|
1058
|
+
CLAIM_FILL_GRACE_BLOCKS,
|
|
1053
1059
|
CLAIM_WINDOW_BLOCKS,
|
|
1060
|
+
CLAIM_WINDOW_BLOCKS_V20,
|
|
1054
1061
|
COMMIT_MAX_BLOCKS,
|
|
1055
1062
|
CONF_TOKEN_FILL,
|
|
1056
1063
|
DEPLOY_FEE,
|
|
@@ -1090,6 +1097,7 @@ export {
|
|
|
1090
1097
|
V17_HEIGHT,
|
|
1091
1098
|
V18_HEIGHT,
|
|
1092
1099
|
V19_HEIGHT,
|
|
1100
|
+
V20_HEIGHT,
|
|
1093
1101
|
bid,
|
|
1094
1102
|
buildRecord,
|
|
1095
1103
|
canonicalState,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inversealtruism/cairnx-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
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",
|