@inversealtruism/cairnx-core 0.1.9 → 0.1.11
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 +18 -8
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +15 -8
- package/package.json +8 -8
- package/test/vectors/cases.json +248 -0
package/dist/index.cjs
CHANGED
|
@@ -36,6 +36,8 @@ __export(index_exports, {
|
|
|
36
36
|
MAX_ACTIVE_CLAIMS: () => MAX_ACTIVE_CLAIMS,
|
|
37
37
|
MAX_AMOUNT: () => MAX_AMOUNT,
|
|
38
38
|
MAX_RECORD_BYTES: () => MAX_RECORD_BYTES,
|
|
39
|
+
NAME_FEE_SHORT_V18: () => NAME_FEE_SHORT_V18,
|
|
40
|
+
NAME_FEE_V18: () => NAME_FEE_V18,
|
|
39
41
|
NAME_GRACE_EPOCHS: () => NAME_GRACE_EPOCHS,
|
|
40
42
|
NAME_PREMIUM_DECAY_EPOCHS: () => NAME_PREMIUM_DECAY_EPOCHS,
|
|
41
43
|
NAME_PREMIUM_START: () => NAME_PREMIUM_START,
|
|
@@ -56,6 +58,7 @@ __export(index_exports, {
|
|
|
56
58
|
V15_HEIGHT: () => V15_HEIGHT,
|
|
57
59
|
V16_HEIGHT: () => V16_HEIGHT,
|
|
58
60
|
V17_HEIGHT: () => V17_HEIGHT,
|
|
61
|
+
V18_HEIGHT: () => V18_HEIGHT,
|
|
59
62
|
bid: () => bid,
|
|
60
63
|
buildRecord: () => buildRecord,
|
|
61
64
|
canonicalState: () => canonicalState,
|
|
@@ -100,8 +103,8 @@ var NAME_TERM_EPOCHS = 8760;
|
|
|
100
103
|
var NAME_GRACE_EPOCHS = 720;
|
|
101
104
|
var NAME_PREMIUM_START = 20n;
|
|
102
105
|
var NAME_PREMIUM_DECAY_EPOCHS = 720;
|
|
103
|
-
function expiredClaimFee(name, epochsPastGraceEnd) {
|
|
104
|
-
const base = nameRegFee(name);
|
|
106
|
+
function expiredClaimFee(name, epochsPastGraceEnd, height) {
|
|
107
|
+
const base = nameRegFee(name, height);
|
|
105
108
|
if (epochsPastGraceEnd >= NAME_PREMIUM_DECAY_EPOCHS) return base;
|
|
106
109
|
const left = BigInt(NAME_PREMIUM_DECAY_EPOCHS - epochsPastGraceEnd);
|
|
107
110
|
const mult = 1n + (NAME_PREMIUM_START - 1n) * left / BigInt(NAME_PREMIUM_DECAY_EPOCHS);
|
|
@@ -122,7 +125,11 @@ var FEE_BPS_V16 = 150;
|
|
|
122
125
|
var REBATE_FLAT = 25000000n;
|
|
123
126
|
var REBATE_BPS = 50;
|
|
124
127
|
var DEPLOY_FEE = 1e8;
|
|
125
|
-
|
|
128
|
+
var V18_HEIGHT = 4e4;
|
|
129
|
+
var NAME_FEE_SHORT_V18 = 670000000n;
|
|
130
|
+
var NAME_FEE_V18 = 300000000n;
|
|
131
|
+
function nameRegFee(name, height) {
|
|
132
|
+
if (height >= V18_HEIGHT) return name.length <= 4 ? NAME_FEE_SHORT_V18 : NAME_FEE_V18;
|
|
126
133
|
const n = name.length;
|
|
127
134
|
if (n <= 3) return 500000000n;
|
|
128
135
|
if (n === 4) return 200000000n;
|
|
@@ -528,7 +535,7 @@ function resolve(events, tipHeight) {
|
|
|
528
535
|
const cur = names.get(rec.name);
|
|
529
536
|
const epClaim = epochOf(ev.height);
|
|
530
537
|
if (cur && v15 && lapsed(cur, epClaim)) {
|
|
531
|
-
const fee = expiredClaimFee(rec.name, epClaim - (paidThrough(cur) + NAME_GRACE_EPOCHS));
|
|
538
|
+
const fee = expiredClaimFee(rec.name, epClaim - (paidThrough(cur) + NAME_GRACE_EPOCHS), ev.height);
|
|
532
539
|
if (feeToTreasury < fee) {
|
|
533
540
|
note(ev, ev.id, "name", false, "lapsed-name claim fee unpaid (decaying premium)");
|
|
534
541
|
continue;
|
|
@@ -542,7 +549,7 @@ function resolve(events, tipHeight) {
|
|
|
542
549
|
note(ev, ev.id, "name", true, "lapsed lease re-claimed (premium)");
|
|
543
550
|
continue;
|
|
544
551
|
}
|
|
545
|
-
if (feeToTreasury < nameRegFee(rec.name)) {
|
|
552
|
+
if (feeToTreasury < nameRegFee(rec.name, ev.height)) {
|
|
546
553
|
note(ev, ev.id, "name", false, "name registration fee unpaid");
|
|
547
554
|
continue;
|
|
548
555
|
}
|
|
@@ -567,7 +574,7 @@ function resolve(events, tipHeight) {
|
|
|
567
574
|
}
|
|
568
575
|
}
|
|
569
576
|
names.set(rec.name, cand);
|
|
570
|
-
feesPaid += nameRegFee(rec.name);
|
|
577
|
+
feesPaid += nameRegFee(rec.name, ev.height);
|
|
571
578
|
note(ev, ev.id, "name", true, cur ? "displaced prior holder" : void 0);
|
|
572
579
|
} else if (rec.t === "nxfer") {
|
|
573
580
|
const n = names.get(rec.name);
|
|
@@ -745,12 +752,12 @@ function resolve(events, tipHeight) {
|
|
|
745
752
|
note(ev, ev.id, "nrenew", false, "grace period: only the owner may renew");
|
|
746
753
|
continue;
|
|
747
754
|
}
|
|
748
|
-
if (feeToTreasury < nameRegFee(rec.name)) {
|
|
755
|
+
if (feeToTreasury < nameRegFee(rec.name, ev.height)) {
|
|
749
756
|
note(ev, ev.id, "nrenew", false, "renewal fee unpaid");
|
|
750
757
|
continue;
|
|
751
758
|
}
|
|
752
759
|
n.paidThroughEpoch = paidThrough(n) + NAME_TERM_EPOCHS;
|
|
753
|
-
feesPaid += nameRegFee(rec.name);
|
|
760
|
+
feesPaid += nameRegFee(rec.name, ev.height);
|
|
754
761
|
note(ev, ev.id, "nrenew", true, `paid through epoch ${n.paidThroughEpoch}`);
|
|
755
762
|
} else if (rec.t === "tmeta") {
|
|
756
763
|
if (!v15) {
|
|
@@ -1100,6 +1107,8 @@ function canonicalState(s) {
|
|
|
1100
1107
|
MAX_ACTIVE_CLAIMS,
|
|
1101
1108
|
MAX_AMOUNT,
|
|
1102
1109
|
MAX_RECORD_BYTES,
|
|
1110
|
+
NAME_FEE_SHORT_V18,
|
|
1111
|
+
NAME_FEE_V18,
|
|
1103
1112
|
NAME_GRACE_EPOCHS,
|
|
1104
1113
|
NAME_PREMIUM_DECAY_EPOCHS,
|
|
1105
1114
|
NAME_PREMIUM_START,
|
|
@@ -1120,6 +1129,7 @@ function canonicalState(s) {
|
|
|
1120
1129
|
V15_HEIGHT,
|
|
1121
1130
|
V16_HEIGHT,
|
|
1122
1131
|
V17_HEIGHT,
|
|
1132
|
+
V18_HEIGHT,
|
|
1123
1133
|
bid,
|
|
1124
1134
|
buildRecord,
|
|
1125
1135
|
canonicalState,
|
package/dist/index.d.cts
CHANGED
|
@@ -14,7 +14,7 @@ declare const NAME_PREMIUM_START = 20n;
|
|
|
14
14
|
declare const NAME_PREMIUM_DECAY_EPOCHS = 720;
|
|
15
15
|
/** Fee to claim a name whose lease lapsed (grace over): nameRegFee × a linearly-decaying
|
|
16
16
|
* premium. Pure in (name, epochsPastGraceEnd) — deterministic for every resolver. */
|
|
17
|
-
declare function expiredClaimFee(name: string, epochsPastGraceEnd: number): bigint;
|
|
17
|
+
declare function expiredClaimFee(name: string, epochsPastGraceEnd: number, height: number): bigint;
|
|
18
18
|
declare const MAX_RECORD_BYTES = 512;
|
|
19
19
|
declare const MAX_AMOUNT: bigint;
|
|
20
20
|
declare const SCORE_FILL = 100;
|
|
@@ -30,7 +30,10 @@ declare const FEE_BPS_V16 = 150;
|
|
|
30
30
|
declare const REBATE_FLAT = 25000000n;
|
|
31
31
|
declare const REBATE_BPS = 50;
|
|
32
32
|
declare const DEPLOY_FEE = 100000000;
|
|
33
|
-
declare
|
|
33
|
+
declare const V18_HEIGHT = 40000;
|
|
34
|
+
declare const NAME_FEE_SHORT_V18 = 670000000n;
|
|
35
|
+
declare const NAME_FEE_V18 = 300000000n;
|
|
36
|
+
declare function nameRegFee(name: string, height: number): bigint;
|
|
34
37
|
declare const tradeFee: (want: bigint, bps?: number) => bigint;
|
|
35
38
|
declare const makerRebate: (value: bigint) => bigint;
|
|
36
39
|
declare const TICKER_RE: RegExp;
|
|
@@ -336,4 +339,4 @@ declare function resolve(events: ChainEvent[], tipHeight: number): CairnXState;
|
|
|
336
339
|
* history.) Keys sort in ordinal (code-unit) order at every depth. */
|
|
337
340
|
declare function canonicalState(s: CairnXState): string;
|
|
338
341
|
|
|
339
|
-
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, EPOCH_LEN, FEE_BPS, FEE_BPS_V16, type FillEntry, type Give, HASH_RE, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_RECORD_BYTES, type MintRecord, NAME_GRACE_EPOCHS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, type NameCommitRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, type ProposeEvent, REBATE_BPS, REBATE_FLAT, RESERVED_NAMES, 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, type Want, bid, buildRecord, canonicalState, deploy, epochOf, expiredClaimFee, isName, isNameGive, isTokenWant, makerRebate, mint, nameClaim, nameCommit, nameCommitRecord, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, parseAmount, parseRecord, resolve, tokenMeta, tradeFee, transfer };
|
|
342
|
+
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, EPOCH_LEN, 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 NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, type ProposeEvent, REBATE_BPS, REBATE_FLAT, RESERVED_NAMES, 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, type Want, bid, buildRecord, canonicalState, deploy, epochOf, expiredClaimFee, isName, isNameGive, isTokenWant, makerRebate, mint, nameClaim, nameCommit, nameCommitRecord, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, parseAmount, parseRecord, resolve, tokenMeta, tradeFee, transfer };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare const NAME_PREMIUM_START = 20n;
|
|
|
14
14
|
declare const NAME_PREMIUM_DECAY_EPOCHS = 720;
|
|
15
15
|
/** Fee to claim a name whose lease lapsed (grace over): nameRegFee × a linearly-decaying
|
|
16
16
|
* premium. Pure in (name, epochsPastGraceEnd) — deterministic for every resolver. */
|
|
17
|
-
declare function expiredClaimFee(name: string, epochsPastGraceEnd: number): bigint;
|
|
17
|
+
declare function expiredClaimFee(name: string, epochsPastGraceEnd: number, height: number): bigint;
|
|
18
18
|
declare const MAX_RECORD_BYTES = 512;
|
|
19
19
|
declare const MAX_AMOUNT: bigint;
|
|
20
20
|
declare const SCORE_FILL = 100;
|
|
@@ -30,7 +30,10 @@ declare const FEE_BPS_V16 = 150;
|
|
|
30
30
|
declare const REBATE_FLAT = 25000000n;
|
|
31
31
|
declare const REBATE_BPS = 50;
|
|
32
32
|
declare const DEPLOY_FEE = 100000000;
|
|
33
|
-
declare
|
|
33
|
+
declare const V18_HEIGHT = 40000;
|
|
34
|
+
declare const NAME_FEE_SHORT_V18 = 670000000n;
|
|
35
|
+
declare const NAME_FEE_V18 = 300000000n;
|
|
36
|
+
declare function nameRegFee(name: string, height: number): bigint;
|
|
34
37
|
declare const tradeFee: (want: bigint, bps?: number) => bigint;
|
|
35
38
|
declare const makerRebate: (value: bigint) => bigint;
|
|
36
39
|
declare const TICKER_RE: RegExp;
|
|
@@ -336,4 +339,4 @@ declare function resolve(events: ChainEvent[], tipHeight: number): CairnXState;
|
|
|
336
339
|
* history.) Keys sort in ordinal (code-unit) order at every depth. */
|
|
337
340
|
declare function canonicalState(s: CairnXState): string;
|
|
338
341
|
|
|
339
|
-
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, EPOCH_LEN, FEE_BPS, FEE_BPS_V16, type FillEntry, type Give, HASH_RE, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_RECORD_BYTES, type MintRecord, NAME_GRACE_EPOCHS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, type NameCommitRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, type ProposeEvent, REBATE_BPS, REBATE_FLAT, RESERVED_NAMES, 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, type Want, bid, buildRecord, canonicalState, deploy, epochOf, expiredClaimFee, isName, isNameGive, isTokenWant, makerRebate, mint, nameClaim, nameCommit, nameCommitRecord, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, parseAmount, parseRecord, resolve, tokenMeta, tradeFee, transfer };
|
|
342
|
+
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, EPOCH_LEN, 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 NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, type ProposeEvent, REBATE_BPS, REBATE_FLAT, RESERVED_NAMES, 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, type Want, bid, buildRecord, canonicalState, deploy, epochOf, expiredClaimFee, isName, isNameGive, isTokenWant, makerRebate, mint, nameClaim, nameCommit, nameCommitRecord, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, parseAmount, parseRecord, resolve, tokenMeta, tradeFee, transfer };
|
package/dist/index.js
CHANGED
|
@@ -13,8 +13,8 @@ var NAME_TERM_EPOCHS = 8760;
|
|
|
13
13
|
var NAME_GRACE_EPOCHS = 720;
|
|
14
14
|
var NAME_PREMIUM_START = 20n;
|
|
15
15
|
var NAME_PREMIUM_DECAY_EPOCHS = 720;
|
|
16
|
-
function expiredClaimFee(name, epochsPastGraceEnd) {
|
|
17
|
-
const base = nameRegFee(name);
|
|
16
|
+
function expiredClaimFee(name, epochsPastGraceEnd, height) {
|
|
17
|
+
const base = nameRegFee(name, height);
|
|
18
18
|
if (epochsPastGraceEnd >= NAME_PREMIUM_DECAY_EPOCHS) return base;
|
|
19
19
|
const left = BigInt(NAME_PREMIUM_DECAY_EPOCHS - epochsPastGraceEnd);
|
|
20
20
|
const mult = 1n + (NAME_PREMIUM_START - 1n) * left / BigInt(NAME_PREMIUM_DECAY_EPOCHS);
|
|
@@ -35,7 +35,11 @@ var FEE_BPS_V16 = 150;
|
|
|
35
35
|
var REBATE_FLAT = 25000000n;
|
|
36
36
|
var REBATE_BPS = 50;
|
|
37
37
|
var DEPLOY_FEE = 1e8;
|
|
38
|
-
|
|
38
|
+
var V18_HEIGHT = 4e4;
|
|
39
|
+
var NAME_FEE_SHORT_V18 = 670000000n;
|
|
40
|
+
var NAME_FEE_V18 = 300000000n;
|
|
41
|
+
function nameRegFee(name, height) {
|
|
42
|
+
if (height >= V18_HEIGHT) return name.length <= 4 ? NAME_FEE_SHORT_V18 : NAME_FEE_V18;
|
|
39
43
|
const n = name.length;
|
|
40
44
|
if (n <= 3) return 500000000n;
|
|
41
45
|
if (n === 4) return 200000000n;
|
|
@@ -441,7 +445,7 @@ function resolve(events, tipHeight) {
|
|
|
441
445
|
const cur = names.get(rec.name);
|
|
442
446
|
const epClaim = epochOf(ev.height);
|
|
443
447
|
if (cur && v15 && lapsed(cur, epClaim)) {
|
|
444
|
-
const fee = expiredClaimFee(rec.name, epClaim - (paidThrough(cur) + NAME_GRACE_EPOCHS));
|
|
448
|
+
const fee = expiredClaimFee(rec.name, epClaim - (paidThrough(cur) + NAME_GRACE_EPOCHS), ev.height);
|
|
445
449
|
if (feeToTreasury < fee) {
|
|
446
450
|
note(ev, ev.id, "name", false, "lapsed-name claim fee unpaid (decaying premium)");
|
|
447
451
|
continue;
|
|
@@ -455,7 +459,7 @@ function resolve(events, tipHeight) {
|
|
|
455
459
|
note(ev, ev.id, "name", true, "lapsed lease re-claimed (premium)");
|
|
456
460
|
continue;
|
|
457
461
|
}
|
|
458
|
-
if (feeToTreasury < nameRegFee(rec.name)) {
|
|
462
|
+
if (feeToTreasury < nameRegFee(rec.name, ev.height)) {
|
|
459
463
|
note(ev, ev.id, "name", false, "name registration fee unpaid");
|
|
460
464
|
continue;
|
|
461
465
|
}
|
|
@@ -480,7 +484,7 @@ function resolve(events, tipHeight) {
|
|
|
480
484
|
}
|
|
481
485
|
}
|
|
482
486
|
names.set(rec.name, cand);
|
|
483
|
-
feesPaid += nameRegFee(rec.name);
|
|
487
|
+
feesPaid += nameRegFee(rec.name, ev.height);
|
|
484
488
|
note(ev, ev.id, "name", true, cur ? "displaced prior holder" : void 0);
|
|
485
489
|
} else if (rec.t === "nxfer") {
|
|
486
490
|
const n = names.get(rec.name);
|
|
@@ -658,12 +662,12 @@ function resolve(events, tipHeight) {
|
|
|
658
662
|
note(ev, ev.id, "nrenew", false, "grace period: only the owner may renew");
|
|
659
663
|
continue;
|
|
660
664
|
}
|
|
661
|
-
if (feeToTreasury < nameRegFee(rec.name)) {
|
|
665
|
+
if (feeToTreasury < nameRegFee(rec.name, ev.height)) {
|
|
662
666
|
note(ev, ev.id, "nrenew", false, "renewal fee unpaid");
|
|
663
667
|
continue;
|
|
664
668
|
}
|
|
665
669
|
n.paidThroughEpoch = paidThrough(n) + NAME_TERM_EPOCHS;
|
|
666
|
-
feesPaid += nameRegFee(rec.name);
|
|
670
|
+
feesPaid += nameRegFee(rec.name, ev.height);
|
|
667
671
|
note(ev, ev.id, "nrenew", true, `paid through epoch ${n.paidThroughEpoch}`);
|
|
668
672
|
} else if (rec.t === "tmeta") {
|
|
669
673
|
if (!v15) {
|
|
@@ -1012,6 +1016,8 @@ export {
|
|
|
1012
1016
|
MAX_ACTIVE_CLAIMS,
|
|
1013
1017
|
MAX_AMOUNT,
|
|
1014
1018
|
MAX_RECORD_BYTES,
|
|
1019
|
+
NAME_FEE_SHORT_V18,
|
|
1020
|
+
NAME_FEE_V18,
|
|
1015
1021
|
NAME_GRACE_EPOCHS,
|
|
1016
1022
|
NAME_PREMIUM_DECAY_EPOCHS,
|
|
1017
1023
|
NAME_PREMIUM_START,
|
|
@@ -1032,6 +1038,7 @@ export {
|
|
|
1032
1038
|
V15_HEIGHT,
|
|
1033
1039
|
V16_HEIGHT,
|
|
1034
1040
|
V17_HEIGHT,
|
|
1041
|
+
V18_HEIGHT,
|
|
1035
1042
|
bid,
|
|
1036
1043
|
buildRecord,
|
|
1037
1044
|
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.11",
|
|
4
4
|
"description": "CairnX — tokens, atomic DvP trades and leased .csd names on Compute Substrate, as a pure deterministic convention library (Ordinals/Runes class). Ships the normative CONVENTION.md and the conformance vectors.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -21,12 +21,8 @@
|
|
|
21
21
|
"MAKERS.md",
|
|
22
22
|
"test/vectors"
|
|
23
23
|
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
26
|
-
"test": "tsx test/vectors.test.ts && tsx test/name-decoy.test.ts"
|
|
27
|
-
},
|
|
28
24
|
"dependencies": {
|
|
29
|
-
"@inversealtruism/csd-codec": "
|
|
25
|
+
"@inversealtruism/csd-codec": "0.1.11"
|
|
30
26
|
},
|
|
31
27
|
"license": "MIT",
|
|
32
28
|
"sideEffects": false,
|
|
@@ -38,5 +34,9 @@
|
|
|
38
34
|
"url": "git+https://github.com/InverseAltruism/csd-sdk.git",
|
|
39
35
|
"directory": "packages/cairnx"
|
|
40
36
|
},
|
|
41
|
-
"homepage": "https://cairn-substrate.com/trade"
|
|
42
|
-
|
|
37
|
+
"homepage": "https://cairn-substrate.com/trade",
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
40
|
+
"test": "tsx test/vectors.test.ts && tsx test/name-decoy.test.ts"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/test/vectors/cases.json
CHANGED
|
@@ -4165,6 +4165,254 @@
|
|
|
4165
4165
|
}
|
|
4166
4166
|
}
|
|
4167
4167
|
}
|
|
4168
|
+
},
|
|
4169
|
+
{
|
|
4170
|
+
"name": "v18-short-name-premium-fee",
|
|
4171
|
+
"events": [
|
|
4172
|
+
{
|
|
4173
|
+
"kind": "propose",
|
|
4174
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f1800000",
|
|
4175
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4176
|
+
"uri": "{\"commit\":\"0xe9172ed8a29abd81a346e20476e8ec74c1fef0173dc1b3bcbd9fb09ac6686a17\",\"t\":\"ncommit\",\"v\":1}",
|
|
4177
|
+
"payloadHash": "0x721ebb06e32ea9a6e3a4f7b90fa002af7f9e51a626fced5fc82fc1d715594a61",
|
|
4178
|
+
"height": 40005,
|
|
4179
|
+
"pos": 1,
|
|
4180
|
+
"expiresEpoch": 5000,
|
|
4181
|
+
"paidTo": {}
|
|
4182
|
+
},
|
|
4183
|
+
{
|
|
4184
|
+
"kind": "propose",
|
|
4185
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f1800001",
|
|
4186
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4187
|
+
"uri": "{\"name\":\"abcd\",\"salt\":\"00ffee1122334455\",\"t\":\"name\",\"v\":1}",
|
|
4188
|
+
"payloadHash": "0xcb76f8a543e51c988e858ebba46f7f036042813879e9bf22045b04a58e7bfd9f",
|
|
4189
|
+
"height": 40007,
|
|
4190
|
+
"pos": 1,
|
|
4191
|
+
"expiresEpoch": 5000,
|
|
4192
|
+
"paidTo": {
|
|
4193
|
+
"0x6b09ce74e6070ebc982ab0fb793a211c4d24f016": "670000000"
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
],
|
|
4197
|
+
"tipHeight": 40010,
|
|
4198
|
+
"expectedState": {
|
|
4199
|
+
"balances": {},
|
|
4200
|
+
"bids": {},
|
|
4201
|
+
"feesPaid": "670000000",
|
|
4202
|
+
"names": {
|
|
4203
|
+
"abcd": {
|
|
4204
|
+
"claimId": "0x00000000000000000000000000000000000000000000000000000000f1800001",
|
|
4205
|
+
"effectiveHeight": 40005,
|
|
4206
|
+
"height": 40007,
|
|
4207
|
+
"locked": false,
|
|
4208
|
+
"name": "abcd",
|
|
4209
|
+
"owner": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4210
|
+
"paidThroughEpoch": 10093
|
|
4211
|
+
}
|
|
4212
|
+
},
|
|
4213
|
+
"offers": {},
|
|
4214
|
+
"tipHeight": 40010,
|
|
4215
|
+
"tokens": {}
|
|
4216
|
+
}
|
|
4217
|
+
},
|
|
4218
|
+
{
|
|
4219
|
+
"name": "v18-normal-name-flat-fee",
|
|
4220
|
+
"events": [
|
|
4221
|
+
{
|
|
4222
|
+
"kind": "propose",
|
|
4223
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f1800002",
|
|
4224
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4225
|
+
"uri": "{\"commit\":\"0xbb1d7e6d0e8f78e7882eca8879b3216354041ffa4e7c8d9eb4a0b07d0a8162ab\",\"t\":\"ncommit\",\"v\":1}",
|
|
4226
|
+
"payloadHash": "0x9f8abb7ac2c902a9e59fe2ae43c62812906de4e0f16edb6da58fac5be655c03d",
|
|
4227
|
+
"height": 40005,
|
|
4228
|
+
"pos": 1,
|
|
4229
|
+
"expiresEpoch": 5000,
|
|
4230
|
+
"paidTo": {}
|
|
4231
|
+
},
|
|
4232
|
+
{
|
|
4233
|
+
"kind": "propose",
|
|
4234
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f1800003",
|
|
4235
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4236
|
+
"uri": "{\"name\":\"alice\",\"salt\":\"00ffee1122334455\",\"t\":\"name\",\"v\":1}",
|
|
4237
|
+
"payloadHash": "0xa444df439fb371a52bac3918fdb2079c0b0e8aebdb5511d5941a4be923420c5f",
|
|
4238
|
+
"height": 40007,
|
|
4239
|
+
"pos": 1,
|
|
4240
|
+
"expiresEpoch": 5000,
|
|
4241
|
+
"paidTo": {
|
|
4242
|
+
"0x6b09ce74e6070ebc982ab0fb793a211c4d24f016": "300000000"
|
|
4243
|
+
}
|
|
4244
|
+
}
|
|
4245
|
+
],
|
|
4246
|
+
"tipHeight": 40010,
|
|
4247
|
+
"expectedState": {
|
|
4248
|
+
"balances": {},
|
|
4249
|
+
"bids": {},
|
|
4250
|
+
"feesPaid": "300000000",
|
|
4251
|
+
"names": {
|
|
4252
|
+
"alice": {
|
|
4253
|
+
"claimId": "0x00000000000000000000000000000000000000000000000000000000f1800003",
|
|
4254
|
+
"effectiveHeight": 40005,
|
|
4255
|
+
"height": 40007,
|
|
4256
|
+
"locked": false,
|
|
4257
|
+
"name": "alice",
|
|
4258
|
+
"owner": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4259
|
+
"paidThroughEpoch": 10093
|
|
4260
|
+
}
|
|
4261
|
+
},
|
|
4262
|
+
"offers": {},
|
|
4263
|
+
"tipHeight": 40010,
|
|
4264
|
+
"tokens": {}
|
|
4265
|
+
}
|
|
4266
|
+
},
|
|
4267
|
+
{
|
|
4268
|
+
"name": "v18-old-fee-underpaid-rejected",
|
|
4269
|
+
"events": [
|
|
4270
|
+
{
|
|
4271
|
+
"kind": "propose",
|
|
4272
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f1800004",
|
|
4273
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4274
|
+
"uri": "{\"commit\":\"0xbb1d7e6d0e8f78e7882eca8879b3216354041ffa4e7c8d9eb4a0b07d0a8162ab\",\"t\":\"ncommit\",\"v\":1}",
|
|
4275
|
+
"payloadHash": "0x9f8abb7ac2c902a9e59fe2ae43c62812906de4e0f16edb6da58fac5be655c03d",
|
|
4276
|
+
"height": 40005,
|
|
4277
|
+
"pos": 1,
|
|
4278
|
+
"expiresEpoch": 5000,
|
|
4279
|
+
"paidTo": {}
|
|
4280
|
+
},
|
|
4281
|
+
{
|
|
4282
|
+
"kind": "propose",
|
|
4283
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f1800005",
|
|
4284
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4285
|
+
"uri": "{\"name\":\"alice\",\"salt\":\"00ffee1122334455\",\"t\":\"name\",\"v\":1}",
|
|
4286
|
+
"payloadHash": "0xa444df439fb371a52bac3918fdb2079c0b0e8aebdb5511d5941a4be923420c5f",
|
|
4287
|
+
"height": 40007,
|
|
4288
|
+
"pos": 1,
|
|
4289
|
+
"expiresEpoch": 5000,
|
|
4290
|
+
"paidTo": {
|
|
4291
|
+
"0x6b09ce74e6070ebc982ab0fb793a211c4d24f016": "50000000"
|
|
4292
|
+
}
|
|
4293
|
+
}
|
|
4294
|
+
],
|
|
4295
|
+
"tipHeight": 40010,
|
|
4296
|
+
"expectedState": {
|
|
4297
|
+
"balances": {},
|
|
4298
|
+
"bids": {},
|
|
4299
|
+
"feesPaid": "0",
|
|
4300
|
+
"names": {},
|
|
4301
|
+
"offers": {},
|
|
4302
|
+
"tipHeight": 40010,
|
|
4303
|
+
"tokens": {}
|
|
4304
|
+
}
|
|
4305
|
+
},
|
|
4306
|
+
{
|
|
4307
|
+
"name": "v18-below-gate-uses-old-curve",
|
|
4308
|
+
"events": [
|
|
4309
|
+
{
|
|
4310
|
+
"kind": "propose",
|
|
4311
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f1800006",
|
|
4312
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4313
|
+
"uri": "{\"commit\":\"0xbb1d7e6d0e8f78e7882eca8879b3216354041ffa4e7c8d9eb4a0b07d0a8162ab\",\"t\":\"ncommit\",\"v\":1}",
|
|
4314
|
+
"payloadHash": "0x9f8abb7ac2c902a9e59fe2ae43c62812906de4e0f16edb6da58fac5be655c03d",
|
|
4315
|
+
"height": 39988,
|
|
4316
|
+
"pos": 1,
|
|
4317
|
+
"expiresEpoch": 5000,
|
|
4318
|
+
"paidTo": {}
|
|
4319
|
+
},
|
|
4320
|
+
{
|
|
4321
|
+
"kind": "propose",
|
|
4322
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f1800007",
|
|
4323
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4324
|
+
"uri": "{\"name\":\"alice\",\"salt\":\"00ffee1122334455\",\"t\":\"name\",\"v\":1}",
|
|
4325
|
+
"payloadHash": "0xa444df439fb371a52bac3918fdb2079c0b0e8aebdb5511d5941a4be923420c5f",
|
|
4326
|
+
"height": 39990,
|
|
4327
|
+
"pos": 1,
|
|
4328
|
+
"expiresEpoch": 5000,
|
|
4329
|
+
"paidTo": {
|
|
4330
|
+
"0x6b09ce74e6070ebc982ab0fb793a211c4d24f016": "100000000"
|
|
4331
|
+
}
|
|
4332
|
+
}
|
|
4333
|
+
],
|
|
4334
|
+
"tipHeight": 39995,
|
|
4335
|
+
"expectedState": {
|
|
4336
|
+
"balances": {},
|
|
4337
|
+
"bids": {},
|
|
4338
|
+
"feesPaid": "100000000",
|
|
4339
|
+
"names": {
|
|
4340
|
+
"alice": {
|
|
4341
|
+
"claimId": "0x00000000000000000000000000000000000000000000000000000000f1800007",
|
|
4342
|
+
"effectiveHeight": 39988,
|
|
4343
|
+
"height": 39990,
|
|
4344
|
+
"locked": false,
|
|
4345
|
+
"name": "alice",
|
|
4346
|
+
"owner": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4347
|
+
"paidThroughEpoch": 10093
|
|
4348
|
+
}
|
|
4349
|
+
},
|
|
4350
|
+
"offers": {},
|
|
4351
|
+
"tipHeight": 39995,
|
|
4352
|
+
"tokens": {}
|
|
4353
|
+
}
|
|
4354
|
+
},
|
|
4355
|
+
{
|
|
4356
|
+
"name": "v18-renewal-pays-new-fee",
|
|
4357
|
+
"events": [
|
|
4358
|
+
{
|
|
4359
|
+
"kind": "propose",
|
|
4360
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f1800008",
|
|
4361
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4362
|
+
"uri": "{\"commit\":\"0xbb1d7e6d0e8f78e7882eca8879b3216354041ffa4e7c8d9eb4a0b07d0a8162ab\",\"t\":\"ncommit\",\"v\":1}",
|
|
4363
|
+
"payloadHash": "0x9f8abb7ac2c902a9e59fe2ae43c62812906de4e0f16edb6da58fac5be655c03d",
|
|
4364
|
+
"height": 40005,
|
|
4365
|
+
"pos": 1,
|
|
4366
|
+
"expiresEpoch": 5000,
|
|
4367
|
+
"paidTo": {}
|
|
4368
|
+
},
|
|
4369
|
+
{
|
|
4370
|
+
"kind": "propose",
|
|
4371
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f1800009",
|
|
4372
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4373
|
+
"uri": "{\"name\":\"alice\",\"salt\":\"00ffee1122334455\",\"t\":\"name\",\"v\":1}",
|
|
4374
|
+
"payloadHash": "0xa444df439fb371a52bac3918fdb2079c0b0e8aebdb5511d5941a4be923420c5f",
|
|
4375
|
+
"height": 40007,
|
|
4376
|
+
"pos": 1,
|
|
4377
|
+
"expiresEpoch": 5000,
|
|
4378
|
+
"paidTo": {
|
|
4379
|
+
"0x6b09ce74e6070ebc982ab0fb793a211c4d24f016": "300000000"
|
|
4380
|
+
}
|
|
4381
|
+
},
|
|
4382
|
+
{
|
|
4383
|
+
"kind": "propose",
|
|
4384
|
+
"id": "0x00000000000000000000000000000000000000000000000000000000f180000a",
|
|
4385
|
+
"proposer": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4386
|
+
"uri": "{\"name\":\"alice\",\"t\":\"nrenew\",\"v\":1}",
|
|
4387
|
+
"payloadHash": "0xf354141593382a062fc2fc197d2a2eb0882088860e31688495ec7102460fcff2",
|
|
4388
|
+
"height": 40009,
|
|
4389
|
+
"pos": 1,
|
|
4390
|
+
"expiresEpoch": 5000,
|
|
4391
|
+
"paidTo": {
|
|
4392
|
+
"0x6b09ce74e6070ebc982ab0fb793a211c4d24f016": "300000000"
|
|
4393
|
+
}
|
|
4394
|
+
}
|
|
4395
|
+
],
|
|
4396
|
+
"tipHeight": 40012,
|
|
4397
|
+
"expectedState": {
|
|
4398
|
+
"balances": {},
|
|
4399
|
+
"bids": {},
|
|
4400
|
+
"feesPaid": "600000000",
|
|
4401
|
+
"names": {
|
|
4402
|
+
"alice": {
|
|
4403
|
+
"claimId": "0x00000000000000000000000000000000000000000000000000000000f1800009",
|
|
4404
|
+
"effectiveHeight": 40005,
|
|
4405
|
+
"height": 40007,
|
|
4406
|
+
"locked": false,
|
|
4407
|
+
"name": "alice",
|
|
4408
|
+
"owner": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",
|
|
4409
|
+
"paidThroughEpoch": 18853
|
|
4410
|
+
}
|
|
4411
|
+
},
|
|
4412
|
+
"offers": {},
|
|
4413
|
+
"tipHeight": 40012,
|
|
4414
|
+
"tokens": {}
|
|
4415
|
+
}
|
|
4168
4416
|
}
|
|
4169
4417
|
]
|
|
4170
4418
|
}
|