@ensnode/ensnode-sdk 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -10
- package/dist/index.cjs +858 -501
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +621 -253
- package/dist/index.d.ts +621 -253
- package/dist/index.js +783 -424
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { prettifyError as prettifyError2, ZodError } from "zod/v4";
|
|
3
3
|
|
|
4
4
|
// src/ensapi/config/zod-schemas.ts
|
|
5
|
-
import { z as
|
|
5
|
+
import { z as z4 } from "zod/v4";
|
|
6
6
|
|
|
7
7
|
// src/ensindexer/config/zod-schemas.ts
|
|
8
|
-
import z2 from "zod/v4";
|
|
8
|
+
import { z as z2 } from "zod/v4";
|
|
9
9
|
|
|
10
10
|
// src/shared/account-id.ts
|
|
11
11
|
import { isAddressEqual } from "viem";
|
|
@@ -77,7 +77,7 @@ import { prettifyError } from "zod/v4";
|
|
|
77
77
|
// src/shared/zod-schemas.ts
|
|
78
78
|
import { AccountId as CaipAccountId } from "caip";
|
|
79
79
|
import { isAddress as isAddress2, isHex as isHex2, size } from "viem";
|
|
80
|
-
import z from "zod/v4";
|
|
80
|
+
import { z } from "zod/v4";
|
|
81
81
|
|
|
82
82
|
// src/ens/index.ts
|
|
83
83
|
import { getENSRootChainId } from "@ensnode/datasources";
|
|
@@ -106,12 +106,14 @@ var bigintToCoinType = (value) => {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
// src/ens/constants.ts
|
|
109
|
-
import { namehash } from "viem";
|
|
109
|
+
import { namehash, zeroHash } from "viem";
|
|
110
110
|
var ROOT_NODE = namehash("");
|
|
111
111
|
var ETH_NODE = namehash("eth");
|
|
112
112
|
var BASENAMES_NODE = namehash("base.eth");
|
|
113
113
|
var LINEANAMES_NODE = namehash("linea.eth");
|
|
114
114
|
var ADDR_REVERSE_NODE = namehash("addr.reverse");
|
|
115
|
+
var NODE_ANY = zeroHash;
|
|
116
|
+
var ROOT_RESOURCE = 0n;
|
|
115
117
|
|
|
116
118
|
// src/ens/dns-encoded-name.ts
|
|
117
119
|
import { bytesToString, hexToBytes } from "viem";
|
|
@@ -160,6 +162,10 @@ function isEncodedLabelHash(maybeEncodedLabelHash) {
|
|
|
160
162
|
return expectedFormatting && includesLabelHash;
|
|
161
163
|
}
|
|
162
164
|
|
|
165
|
+
// src/ens/fuses.ts
|
|
166
|
+
var PARENT_CANNOT_CONTROL = 65536;
|
|
167
|
+
var isPccFuseSet = (fuses) => (fuses & PARENT_CANNOT_CONTROL) === PARENT_CANNOT_CONTROL;
|
|
168
|
+
|
|
163
169
|
// src/ens/is-normalized.ts
|
|
164
170
|
import { normalize } from "viem/ens";
|
|
165
171
|
function isNormalizedName(name) {
|
|
@@ -330,7 +336,7 @@ function addPrices(...prices) {
|
|
|
330
336
|
);
|
|
331
337
|
}
|
|
332
338
|
|
|
333
|
-
// src/shared/reinterpretation.ts
|
|
339
|
+
// src/shared/interpretation/reinterpretation.ts
|
|
334
340
|
import { labelhash as labelToLabelHash } from "viem";
|
|
335
341
|
function reinterpretLabel(label) {
|
|
336
342
|
if (label === "") {
|
|
@@ -576,181 +582,65 @@ function addDuration(timestamp, duration) {
|
|
|
576
582
|
return deserializeUnixTimestamp(timestamp + duration, "UnixTimestamp");
|
|
577
583
|
}
|
|
578
584
|
|
|
579
|
-
// src/shared/cache/
|
|
580
|
-
var
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
schedule(config) {
|
|
589
|
-
const { revalidate, interval, initialDelay = 0, onError } = config;
|
|
590
|
-
if (this.activeSchedules.has(revalidate)) {
|
|
591
|
-
return revalidate;
|
|
585
|
+
// src/shared/cache/swr-cache.ts
|
|
586
|
+
var SWRCache = class {
|
|
587
|
+
constructor(options) {
|
|
588
|
+
this.options = options;
|
|
589
|
+
if (options.proactiveRevalidationInterval) {
|
|
590
|
+
this.backgroundInterval = setInterval(
|
|
591
|
+
() => this.revalidate(),
|
|
592
|
+
secondsToMilliseconds(options.proactiveRevalidationInterval)
|
|
593
|
+
);
|
|
592
594
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
metadata.timeoutId = setTimeout(() => {
|
|
613
|
-
if (this.activeSchedules.has(revalidate)) {
|
|
614
|
-
executeRevalidation().then(() => scheduleNext());
|
|
615
|
-
}
|
|
616
|
-
}, interval);
|
|
617
|
-
};
|
|
618
|
-
if (initialDelay > 0) {
|
|
619
|
-
metadata.timeoutId = setTimeout(() => {
|
|
620
|
-
if (this.activeSchedules.has(revalidate)) {
|
|
621
|
-
executeRevalidation().then(() => scheduleNext());
|
|
595
|
+
if (options.proactivelyInitialize) this.revalidate();
|
|
596
|
+
}
|
|
597
|
+
cache = null;
|
|
598
|
+
inProgressRevalidate = null;
|
|
599
|
+
backgroundInterval = null;
|
|
600
|
+
async revalidate() {
|
|
601
|
+
if (!this.inProgressRevalidate) {
|
|
602
|
+
this.inProgressRevalidate = this.options.fn().then((result) => {
|
|
603
|
+
this.cache = {
|
|
604
|
+
result,
|
|
605
|
+
updatedAt: getUnixTime(/* @__PURE__ */ new Date())
|
|
606
|
+
};
|
|
607
|
+
}).catch((error) => {
|
|
608
|
+
if (!this.cache) {
|
|
609
|
+
this.cache = {
|
|
610
|
+
// ensure thrown value is always an Error instance
|
|
611
|
+
result: error instanceof Error ? error : new Error(String(error)),
|
|
612
|
+
updatedAt: getUnixTime(/* @__PURE__ */ new Date())
|
|
613
|
+
};
|
|
622
614
|
}
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
|
|
615
|
+
}).finally(() => {
|
|
616
|
+
this.inProgressRevalidate = null;
|
|
617
|
+
});
|
|
626
618
|
}
|
|
627
|
-
return
|
|
619
|
+
return this.inProgressRevalidate;
|
|
628
620
|
}
|
|
629
621
|
/**
|
|
630
|
-
*
|
|
622
|
+
* Read the most recently cached result from the `SWRCache`.
|
|
631
623
|
*
|
|
632
|
-
* @
|
|
624
|
+
* @returns a `ValueType` that was most recently successfully returned by `fn` or `Error` if `fn`
|
|
625
|
+
* has never successfully returned.
|
|
633
626
|
*/
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
if (!
|
|
637
|
-
if (
|
|
638
|
-
|
|
627
|
+
async read() {
|
|
628
|
+
if (!this.cache) await this.revalidate();
|
|
629
|
+
if (!this.cache) throw new Error("never");
|
|
630
|
+
if (durationBetween(this.cache.updatedAt, getUnixTime(/* @__PURE__ */ new Date())) > this.options.ttl) {
|
|
631
|
+
this.revalidate();
|
|
639
632
|
}
|
|
640
|
-
this.
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Cancel all active schedules.
|
|
644
|
-
*/
|
|
645
|
-
cancelAll() {
|
|
646
|
-
for (const [, metadata] of this.activeSchedules) {
|
|
647
|
-
if (metadata.timeoutId !== null) {
|
|
648
|
-
clearTimeout(metadata.timeoutId);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
this.activeSchedules.clear();
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Get the count of active schedules.
|
|
655
|
-
* Useful for debugging and monitoring.
|
|
656
|
-
*
|
|
657
|
-
* @returns The number of currently active schedules
|
|
658
|
-
*/
|
|
659
|
-
getActiveScheduleCount() {
|
|
660
|
-
return this.activeSchedules.size;
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
|
|
664
|
-
// src/shared/cache/swr-cache.ts
|
|
665
|
-
var bgRevalidationScheduler = new BackgroundRevalidationScheduler();
|
|
666
|
-
var SWRCache = class _SWRCache {
|
|
667
|
-
options;
|
|
668
|
-
cache;
|
|
669
|
-
/**
|
|
670
|
-
* Optional promise of the current in-progress attempt to revalidate the `cache`.
|
|
671
|
-
*
|
|
672
|
-
* If null, no revalidation attempt is currently in progress.
|
|
673
|
-
* If not null, identifies the revalidation attempt that is currently in progress.
|
|
674
|
-
*
|
|
675
|
-
* Used to enforce no concurrent revalidation attempts.
|
|
676
|
-
*/
|
|
677
|
-
inProgressRevalidate;
|
|
678
|
-
/**
|
|
679
|
-
* The callback function being managed by `BackgroundRevalidationScheduler`.
|
|
680
|
-
*
|
|
681
|
-
* If null, no background revalidation is scheduled.
|
|
682
|
-
* If not null, identifies the background revalidation that is currently scheduled.
|
|
683
|
-
*
|
|
684
|
-
* Used to enforce no concurrent background revalidation attempts.
|
|
685
|
-
*/
|
|
686
|
-
scheduledBackgroundRevalidate;
|
|
687
|
-
constructor(options) {
|
|
688
|
-
this.cache = null;
|
|
689
|
-
this.inProgressRevalidate = null;
|
|
690
|
-
this.scheduledBackgroundRevalidate = null;
|
|
691
|
-
this.options = options;
|
|
633
|
+
return this.cache.result;
|
|
692
634
|
}
|
|
693
635
|
/**
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
* @param options - The {@link SWRCacheOptions} for the SWR cache.
|
|
697
|
-
* @returns a new `SWRCache` instance.
|
|
636
|
+
* Destroys the background revalidation interval, if exists.
|
|
698
637
|
*/
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
638
|
+
destroy() {
|
|
639
|
+
if (this.backgroundInterval) {
|
|
640
|
+
clearInterval(this.backgroundInterval);
|
|
641
|
+
this.backgroundInterval = null;
|
|
703
642
|
}
|
|
704
|
-
return cache;
|
|
705
643
|
}
|
|
706
|
-
revalidate = async () => {
|
|
707
|
-
if (this.inProgressRevalidate) {
|
|
708
|
-
return this.inProgressRevalidate;
|
|
709
|
-
}
|
|
710
|
-
return this.options.fn().then((value) => {
|
|
711
|
-
this.cache = {
|
|
712
|
-
value,
|
|
713
|
-
updatedAt: getUnixTime(/* @__PURE__ */ new Date())
|
|
714
|
-
};
|
|
715
|
-
return this.cache;
|
|
716
|
-
}).catch(() => {
|
|
717
|
-
return null;
|
|
718
|
-
}).finally(() => {
|
|
719
|
-
this.inProgressRevalidate = null;
|
|
720
|
-
if (this.options.revalidationInterval === void 0) {
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
|
-
if (this.scheduledBackgroundRevalidate) {
|
|
724
|
-
bgRevalidationScheduler.cancel(this.scheduledBackgroundRevalidate);
|
|
725
|
-
}
|
|
726
|
-
const backgroundRevalidate = async () => {
|
|
727
|
-
this.revalidate();
|
|
728
|
-
};
|
|
729
|
-
this.scheduledBackgroundRevalidate = bgRevalidationScheduler.schedule({
|
|
730
|
-
revalidate: backgroundRevalidate,
|
|
731
|
-
interval: secondsToMilliseconds(this.options.revalidationInterval)
|
|
732
|
-
});
|
|
733
|
-
});
|
|
734
|
-
};
|
|
735
|
-
/**
|
|
736
|
-
* Read the most recently cached `CachedValue` from the `SWRCache`.
|
|
737
|
-
*
|
|
738
|
-
* @returns a `CachedValue` holding a `value` of `ValueType` that was most recently successfully returned by `fn`
|
|
739
|
-
* or `null` if `fn` has never successfully returned and has always thrown an error,
|
|
740
|
-
*/
|
|
741
|
-
readCache = async () => {
|
|
742
|
-
if (!this.cache) {
|
|
743
|
-
this.inProgressRevalidate = this.revalidate();
|
|
744
|
-
return this.inProgressRevalidate;
|
|
745
|
-
}
|
|
746
|
-
if (durationBetween(this.cache.updatedAt, getUnixTime(/* @__PURE__ */ new Date())) <= this.options.ttl) {
|
|
747
|
-
return this.cache;
|
|
748
|
-
}
|
|
749
|
-
if (!this.inProgressRevalidate) {
|
|
750
|
-
this.inProgressRevalidate = this.revalidate();
|
|
751
|
-
}
|
|
752
|
-
return this.cache;
|
|
753
|
-
};
|
|
754
644
|
};
|
|
755
645
|
|
|
756
646
|
// src/shared/cache/ttl-cache.ts
|
|
@@ -822,7 +712,9 @@ var TtlCache = class {
|
|
|
822
712
|
var uniq = (arr) => [...new Set(arr)];
|
|
823
713
|
|
|
824
714
|
// src/shared/datasource-contract.ts
|
|
825
|
-
import {
|
|
715
|
+
import {
|
|
716
|
+
maybeGetDatasource
|
|
717
|
+
} from "@ensnode/datasources";
|
|
826
718
|
var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
827
719
|
const datasource = maybeGetDatasource(namespaceId, datasourceName);
|
|
828
720
|
if (!datasource) return void 0;
|
|
@@ -842,12 +734,60 @@ var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
|
842
734
|
}
|
|
843
735
|
return contract;
|
|
844
736
|
};
|
|
737
|
+
var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
738
|
+
const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
|
|
739
|
+
return a && accountIdEqual(a, b);
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
// src/shared/interpretation/interpret-address.ts
|
|
743
|
+
import { isAddressEqual as isAddressEqual2, zeroAddress } from "viem";
|
|
744
|
+
var interpretAddress = (owner) => isAddressEqual2(zeroAddress, owner) ? null : owner;
|
|
745
|
+
|
|
746
|
+
// src/shared/interpretation/interpret-record-values.ts
|
|
747
|
+
import { isAddress as isAddress3, isAddressEqual as isAddressEqual3, zeroAddress as zeroAddress2 } from "viem";
|
|
748
|
+
|
|
749
|
+
// src/shared/null-bytes.ts
|
|
750
|
+
var hasNullByte = (value) => value.indexOf("\0") !== -1;
|
|
751
|
+
var stripNullBytes = (value) => value.replaceAll("\0", "");
|
|
752
|
+
|
|
753
|
+
// src/shared/interpretation/interpret-record-values.ts
|
|
754
|
+
function interpretNameRecordValue(value) {
|
|
755
|
+
if (value === "") return null;
|
|
756
|
+
if (!isNormalizedName(value)) return null;
|
|
757
|
+
return value;
|
|
758
|
+
}
|
|
759
|
+
function interpretAddressRecordValue(value) {
|
|
760
|
+
if (hasNullByte(value)) return null;
|
|
761
|
+
if (value === "") return null;
|
|
762
|
+
if (value === "0x") return null;
|
|
763
|
+
if (!isAddress3(value)) return value;
|
|
764
|
+
if (isAddressEqual3(value, zeroAddress2)) return null;
|
|
765
|
+
return asLowerCaseAddress(value);
|
|
766
|
+
}
|
|
767
|
+
function interpretTextRecordKey(key) {
|
|
768
|
+
if (hasNullByte(key)) return null;
|
|
769
|
+
if (key === "") return null;
|
|
770
|
+
return key;
|
|
771
|
+
}
|
|
772
|
+
function interpretTextRecordValue(value) {
|
|
773
|
+
if (hasNullByte(value)) return null;
|
|
774
|
+
if (value === "") return null;
|
|
775
|
+
return value;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// src/shared/interpretation/interpret-tokenid.ts
|
|
779
|
+
var interpretTokenIdAsLabelHash = (tokenId) => uint256ToHex32(tokenId);
|
|
780
|
+
var interpretTokenIdAsNode = (tokenId) => uint256ToHex32(tokenId);
|
|
781
|
+
|
|
782
|
+
// src/shared/interpretation/interpreted-names-and-labels.ts
|
|
783
|
+
import { isHex as isHex3 } from "viem";
|
|
784
|
+
import { labelhash } from "viem/ens";
|
|
845
785
|
|
|
846
786
|
// src/shared/labelhash.ts
|
|
847
787
|
import { keccak256 as keccak2562, stringToBytes } from "viem";
|
|
848
788
|
var labelhashLiteralLabel = (label) => keccak2562(stringToBytes(label));
|
|
849
789
|
|
|
850
|
-
// src/shared/interpretation.ts
|
|
790
|
+
// src/shared/interpretation/interpreted-names-and-labels.ts
|
|
851
791
|
function literalLabelToInterpretedLabel(label) {
|
|
852
792
|
if (isNormalizedLabel(label)) return label;
|
|
853
793
|
return encodeLabelHash(labelhashLiteralLabel(label));
|
|
@@ -861,10 +801,39 @@ function interpretedLabelsToInterpretedName(labels) {
|
|
|
861
801
|
function literalLabelsToLiteralName(labels) {
|
|
862
802
|
return labels.join(".");
|
|
863
803
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
804
|
+
function interpretedNameToInterpretedLabels(name) {
|
|
805
|
+
return name.split(".");
|
|
806
|
+
}
|
|
807
|
+
function encodedLabelToLabelhash(label) {
|
|
808
|
+
if (label.length !== 66) return null;
|
|
809
|
+
if (label.indexOf("[") !== 0) return null;
|
|
810
|
+
if (label.indexOf("]") !== 65) return null;
|
|
811
|
+
const hash = `0x${label.slice(1, 65)}`;
|
|
812
|
+
if (!isHex3(hash)) return null;
|
|
813
|
+
return hash;
|
|
814
|
+
}
|
|
815
|
+
function isInterpetedLabel(label) {
|
|
816
|
+
if (label.startsWith("[")) {
|
|
817
|
+
const labelHash = encodedLabelToLabelhash(label);
|
|
818
|
+
if (labelHash === null) return false;
|
|
819
|
+
}
|
|
820
|
+
return isNormalizedLabel(label);
|
|
821
|
+
}
|
|
822
|
+
function isInterpretedName(name) {
|
|
823
|
+
return name.split(".").every(isInterpetedLabel);
|
|
824
|
+
}
|
|
825
|
+
function interpretedNameToLabelHashPath(name) {
|
|
826
|
+
return interpretedNameToInterpretedLabels(name).map((label) => {
|
|
827
|
+
if (!isInterpetedLabel(label)) {
|
|
828
|
+
throw new Error(
|
|
829
|
+
`Invariant(interpretedNameToLabelHashPath): Expected InterpretedLabel, received '${label}'.`
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
const maybeLabelHash = encodedLabelToLabelhash(label);
|
|
833
|
+
if (maybeLabelHash !== null) return maybeLabelHash;
|
|
834
|
+
return labelhash(label);
|
|
835
|
+
}).toReversed();
|
|
836
|
+
}
|
|
868
837
|
|
|
869
838
|
// src/shared/numbers.ts
|
|
870
839
|
function bigIntToNumber(n) {
|
|
@@ -881,8 +850,16 @@ function bigIntToNumber(n) {
|
|
|
881
850
|
return Number(n);
|
|
882
851
|
}
|
|
883
852
|
|
|
853
|
+
// src/shared/root-registry.ts
|
|
854
|
+
import { DatasourceNames } from "@ensnode/datasources";
|
|
855
|
+
var getENSv1Registry = (namespace) => getDatasourceContract(namespace, DatasourceNames.ENSRoot, "ENSv1Registry");
|
|
856
|
+
var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(namespace), contract);
|
|
857
|
+
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace, DatasourceNames.ENSRoot, "RootRegistry");
|
|
858
|
+
var getENSv2RootRegistryId = (namespace) => makeRegistryId(getENSv2RootRegistry(namespace));
|
|
859
|
+
var isENSv2RootRegistry = (namespace, contract) => accountIdEqual(getENSv2RootRegistry(namespace), contract);
|
|
860
|
+
|
|
884
861
|
// src/shared/serialize.ts
|
|
885
|
-
import { AccountId as CaipAccountId2 } from "caip";
|
|
862
|
+
import { AccountId as CaipAccountId2, AssetId as CaipAssetId } from "caip";
|
|
886
863
|
function serializeChainId(chainId) {
|
|
887
864
|
return chainId.toString();
|
|
888
865
|
}
|
|
@@ -907,6 +884,23 @@ function formatAccountId(accountId) {
|
|
|
907
884
|
address: accountId.address
|
|
908
885
|
}).toLowerCase();
|
|
909
886
|
}
|
|
887
|
+
function formatAssetId({
|
|
888
|
+
assetNamespace,
|
|
889
|
+
contract: { chainId, address },
|
|
890
|
+
tokenId
|
|
891
|
+
}) {
|
|
892
|
+
return CaipAssetId.format({
|
|
893
|
+
chainId: { namespace: "eip155", reference: chainId.toString() },
|
|
894
|
+
assetName: { namespace: assetNamespace, reference: address },
|
|
895
|
+
tokenId: uint256ToHex32(tokenId)
|
|
896
|
+
}).toLowerCase();
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
// src/shared/types.ts
|
|
900
|
+
var AssetNamespaces = {
|
|
901
|
+
ERC721: "erc721",
|
|
902
|
+
ERC1155: "erc1155"
|
|
903
|
+
};
|
|
910
904
|
|
|
911
905
|
// src/shared/url.ts
|
|
912
906
|
function isHttpProtocol(url) {
|
|
@@ -928,6 +922,7 @@ var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
|
928
922
|
PluginName2["ProtocolAcceleration"] = "protocol-acceleration";
|
|
929
923
|
PluginName2["Registrars"] = "registrars";
|
|
930
924
|
PluginName2["TokenScope"] = "tokenscope";
|
|
925
|
+
PluginName2["ENSv2"] = "ensv2";
|
|
931
926
|
return PluginName2;
|
|
932
927
|
})(PluginName || {});
|
|
933
928
|
|
|
@@ -1024,20 +1019,29 @@ var makeENSIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") =
|
|
|
1024
1019
|
versionInfo: makeENSIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
|
|
1025
1020
|
}).check(invariant_isSubgraphCompatibleRequirements);
|
|
1026
1021
|
|
|
1027
|
-
// src/
|
|
1022
|
+
// src/shared/config/thegraph.ts
|
|
1023
|
+
import { z as z3 } from "zod/v4";
|
|
1028
1024
|
var TheGraphCannotFallbackReasonSchema = z3.enum({
|
|
1029
1025
|
NotSubgraphCompatible: "not-subgraph-compatible",
|
|
1030
1026
|
NoApiKey: "no-api-key",
|
|
1031
1027
|
NoSubgraphUrl: "no-subgraph-url"
|
|
1032
1028
|
});
|
|
1033
|
-
var TheGraphFallbackSchema = z3.
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1029
|
+
var TheGraphFallbackSchema = z3.discriminatedUnion("canFallback", [
|
|
1030
|
+
z3.strictObject({
|
|
1031
|
+
canFallback: z3.literal(true),
|
|
1032
|
+
url: z3.string()
|
|
1033
|
+
}),
|
|
1034
|
+
z3.strictObject({
|
|
1035
|
+
canFallback: z3.literal(false),
|
|
1036
|
+
reason: TheGraphCannotFallbackReasonSchema
|
|
1037
|
+
})
|
|
1038
|
+
]);
|
|
1039
|
+
|
|
1040
|
+
// src/ensapi/config/zod-schemas.ts
|
|
1037
1041
|
function makeENSApiPublicConfigSchema(valueLabel) {
|
|
1038
1042
|
const label = valueLabel ?? "ENSApiPublicConfig";
|
|
1039
|
-
return
|
|
1040
|
-
version:
|
|
1043
|
+
return z4.strictObject({
|
|
1044
|
+
version: z4.string().min(1, `${label}.version must be a non-empty string`),
|
|
1041
1045
|
theGraphFallback: TheGraphFallbackSchema,
|
|
1042
1046
|
ensIndexerPublicConfig: makeENSIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`)
|
|
1043
1047
|
});
|
|
@@ -1180,7 +1184,7 @@ function serializeENSIndexerPublicConfig(config) {
|
|
|
1180
1184
|
import { prettifyError as prettifyError4 } from "zod/v4";
|
|
1181
1185
|
|
|
1182
1186
|
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1183
|
-
import
|
|
1187
|
+
import { z as z5 } from "zod/v4";
|
|
1184
1188
|
|
|
1185
1189
|
// src/ensindexer/indexing-status/types.ts
|
|
1186
1190
|
var ChainIndexingConfigTypeIds = {
|
|
@@ -1606,7 +1610,7 @@ function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
|
1606
1610
|
ctx.issues.push({
|
|
1607
1611
|
code: "custom",
|
|
1608
1612
|
input: ctx.value,
|
|
1609
|
-
message: `'snapshotTime' must be greater than or equal to
|
|
1613
|
+
message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
|
|
1610
1614
|
});
|
|
1611
1615
|
}
|
|
1612
1616
|
}
|
|
@@ -1636,52 +1640,52 @@ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ct
|
|
|
1636
1640
|
}
|
|
1637
1641
|
|
|
1638
1642
|
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1639
|
-
var makeChainIndexingConfigSchema = (valueLabel = "Value") =>
|
|
1640
|
-
|
|
1641
|
-
configType:
|
|
1643
|
+
var makeChainIndexingConfigSchema = (valueLabel = "Value") => z5.discriminatedUnion("configType", [
|
|
1644
|
+
z5.strictObject({
|
|
1645
|
+
configType: z5.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1642
1646
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1643
1647
|
}),
|
|
1644
|
-
|
|
1645
|
-
configType:
|
|
1648
|
+
z5.strictObject({
|
|
1649
|
+
configType: z5.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1646
1650
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1647
1651
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1648
1652
|
})
|
|
1649
1653
|
]);
|
|
1650
|
-
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") =>
|
|
1651
|
-
chainStatus:
|
|
1654
|
+
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => z5.strictObject({
|
|
1655
|
+
chainStatus: z5.literal(ChainIndexingStatusIds.Queued),
|
|
1652
1656
|
config: makeChainIndexingConfigSchema(valueLabel)
|
|
1653
1657
|
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1654
|
-
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") =>
|
|
1655
|
-
chainStatus:
|
|
1658
|
+
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => z5.strictObject({
|
|
1659
|
+
chainStatus: z5.literal(ChainIndexingStatusIds.Backfill),
|
|
1656
1660
|
config: makeChainIndexingConfigSchema(valueLabel),
|
|
1657
1661
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1658
1662
|
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1659
1663
|
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1660
|
-
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") =>
|
|
1661
|
-
chainStatus:
|
|
1662
|
-
config:
|
|
1663
|
-
configType:
|
|
1664
|
+
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => z5.strictObject({
|
|
1665
|
+
chainStatus: z5.literal(ChainIndexingStatusIds.Completed),
|
|
1666
|
+
config: z5.strictObject({
|
|
1667
|
+
configType: z5.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1664
1668
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1665
1669
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1666
1670
|
}),
|
|
1667
1671
|
latestIndexedBlock: makeBlockRefSchema(valueLabel)
|
|
1668
1672
|
}).check(invariant_chainSnapshotCompletedBlocks);
|
|
1669
|
-
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") =>
|
|
1670
|
-
chainStatus:
|
|
1671
|
-
config:
|
|
1672
|
-
configType:
|
|
1673
|
+
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => z5.strictObject({
|
|
1674
|
+
chainStatus: z5.literal(ChainIndexingStatusIds.Following),
|
|
1675
|
+
config: z5.strictObject({
|
|
1676
|
+
configType: z5.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1673
1677
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1674
1678
|
}),
|
|
1675
1679
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1676
1680
|
latestKnownBlock: makeBlockRefSchema(valueLabel)
|
|
1677
1681
|
}).check(invariant_chainSnapshotFollowingBlocks);
|
|
1678
|
-
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") =>
|
|
1682
|
+
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => z5.discriminatedUnion("chainStatus", [
|
|
1679
1683
|
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1680
1684
|
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1681
1685
|
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1682
1686
|
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1683
1687
|
]);
|
|
1684
|
-
var makeChainIndexingStatusesSchema = (valueLabel = "Value") =>
|
|
1688
|
+
var makeChainIndexingStatusesSchema = (valueLabel = "Value") => z5.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
|
|
1685
1689
|
error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
|
|
1686
1690
|
}).transform((serializedChainsIndexingStatus) => {
|
|
1687
1691
|
const chainsIndexingStatus = /* @__PURE__ */ new Map();
|
|
@@ -1690,29 +1694,29 @@ var makeChainIndexingStatusesSchema = (valueLabel = "Value") => z4.record(makeCh
|
|
|
1690
1694
|
}
|
|
1691
1695
|
return chainsIndexingStatus;
|
|
1692
1696
|
});
|
|
1693
|
-
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) =>
|
|
1694
|
-
omnichainStatus:
|
|
1697
|
+
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => z5.strictObject({
|
|
1698
|
+
omnichainStatus: z5.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1695
1699
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainSnapshotUnstartedHasValidChains).transform((chains) => chains),
|
|
1696
1700
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1697
1701
|
});
|
|
1698
|
-
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =>
|
|
1699
|
-
omnichainStatus:
|
|
1702
|
+
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => z5.strictObject({
|
|
1703
|
+
omnichainStatus: z5.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1700
1704
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotBackfillHasValidChains).transform(
|
|
1701
1705
|
(chains) => chains
|
|
1702
1706
|
),
|
|
1703
1707
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1704
1708
|
});
|
|
1705
|
-
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) =>
|
|
1706
|
-
omnichainStatus:
|
|
1709
|
+
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => z5.strictObject({
|
|
1710
|
+
omnichainStatus: z5.literal(OmnichainIndexingStatusIds.Completed),
|
|
1707
1711
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotCompletedHasValidChains).transform((chains) => chains),
|
|
1708
1712
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1709
1713
|
});
|
|
1710
|
-
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) =>
|
|
1711
|
-
omnichainStatus:
|
|
1714
|
+
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => z5.strictObject({
|
|
1715
|
+
omnichainStatus: z5.literal(OmnichainIndexingStatusIds.Following),
|
|
1712
1716
|
chains: makeChainIndexingStatusesSchema(valueLabel),
|
|
1713
1717
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1714
1718
|
});
|
|
1715
|
-
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") =>
|
|
1719
|
+
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => z5.discriminatedUnion("omnichainStatus", [
|
|
1716
1720
|
makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1717
1721
|
makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1718
1722
|
makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1720,16 +1724,16 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1720
1724
|
]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
|
|
1721
1725
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1722
1726
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1723
|
-
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") =>
|
|
1724
|
-
strategy:
|
|
1727
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => z5.strictObject({
|
|
1728
|
+
strategy: z5.literal(CrossChainIndexingStrategyIds.Omnichain),
|
|
1725
1729
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1726
1730
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1727
1731
|
omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1728
1732
|
}).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
|
|
1729
|
-
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") =>
|
|
1733
|
+
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => z5.discriminatedUnion("strategy", [
|
|
1730
1734
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1731
1735
|
]);
|
|
1732
|
-
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") =>
|
|
1736
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => z5.strictObject({
|
|
1733
1737
|
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1734
1738
|
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1735
1739
|
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
@@ -1877,7 +1881,7 @@ function serializeConfigResponse(response) {
|
|
|
1877
1881
|
import { prettifyError as prettifyError5 } from "zod/v4";
|
|
1878
1882
|
|
|
1879
1883
|
// src/api/indexing-status/zod-schemas.ts
|
|
1880
|
-
import
|
|
1884
|
+
import z6 from "zod/v4";
|
|
1881
1885
|
|
|
1882
1886
|
// src/api/indexing-status/response.ts
|
|
1883
1887
|
var IndexingStatusResponseCodes = {
|
|
@@ -1892,14 +1896,14 @@ var IndexingStatusResponseCodes = {
|
|
|
1892
1896
|
};
|
|
1893
1897
|
|
|
1894
1898
|
// src/api/indexing-status/zod-schemas.ts
|
|
1895
|
-
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") =>
|
|
1896
|
-
responseCode:
|
|
1899
|
+
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z6.strictObject({
|
|
1900
|
+
responseCode: z6.literal(IndexingStatusResponseCodes.Ok),
|
|
1897
1901
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1898
1902
|
});
|
|
1899
|
-
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") =>
|
|
1900
|
-
responseCode:
|
|
1903
|
+
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z6.strictObject({
|
|
1904
|
+
responseCode: z6.literal(IndexingStatusResponseCodes.Error)
|
|
1901
1905
|
});
|
|
1902
|
-
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") =>
|
|
1906
|
+
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z6.discriminatedUnion("responseCode", [
|
|
1903
1907
|
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
1904
1908
|
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
1905
1909
|
]);
|
|
@@ -1933,21 +1937,20 @@ import { prettifyError as prettifyError7 } from "zod/v4";
|
|
|
1933
1937
|
|
|
1934
1938
|
// src/api/name-tokens/zod-schemas.ts
|
|
1935
1939
|
import { namehash as namehash2 } from "viem";
|
|
1936
|
-
import
|
|
1940
|
+
import z9 from "zod/v4";
|
|
1937
1941
|
|
|
1938
1942
|
// src/tokenscope/assets.ts
|
|
1939
|
-
import {
|
|
1940
|
-
import { isAddressEqual as isAddressEqual3, zeroAddress as zeroAddress3 } from "viem";
|
|
1943
|
+
import { isAddressEqual as isAddressEqual5, zeroAddress as zeroAddress5 } from "viem";
|
|
1941
1944
|
import { prettifyError as prettifyError6 } from "zod/v4";
|
|
1942
1945
|
|
|
1943
1946
|
// src/tokenscope/zod-schemas.ts
|
|
1944
|
-
import { AssetId as
|
|
1945
|
-
import { zeroAddress as
|
|
1946
|
-
import
|
|
1947
|
+
import { AssetId as CaipAssetId2 } from "caip";
|
|
1948
|
+
import { zeroAddress as zeroAddress4 } from "viem";
|
|
1949
|
+
import z7 from "zod/v4";
|
|
1947
1950
|
|
|
1948
1951
|
// src/tokenscope/name-token.ts
|
|
1949
|
-
import { isAddressEqual as
|
|
1950
|
-
import { DatasourceNames } from "@ensnode/datasources";
|
|
1952
|
+
import { isAddressEqual as isAddressEqual4, zeroAddress as zeroAddress3 } from "viem";
|
|
1953
|
+
import { DatasourceNames as DatasourceNames2 } from "@ensnode/datasources";
|
|
1951
1954
|
var NameTokenOwnershipTypes = {
|
|
1952
1955
|
/**
|
|
1953
1956
|
* Name Token is owned by NameWrapper account.
|
|
@@ -1978,12 +1981,12 @@ function serializeNameToken(nameToken) {
|
|
|
1978
1981
|
function getNameWrapperAccounts(namespaceId) {
|
|
1979
1982
|
const ethnamesNameWrapperAccount = getDatasourceContract(
|
|
1980
1983
|
namespaceId,
|
|
1981
|
-
|
|
1984
|
+
DatasourceNames2.ENSRoot,
|
|
1982
1985
|
"NameWrapper"
|
|
1983
1986
|
);
|
|
1984
1987
|
const lineanamesNameWrapperAccount = maybeGetDatasourceContract(
|
|
1985
1988
|
namespaceId,
|
|
1986
|
-
|
|
1989
|
+
DatasourceNames2.Lineanames,
|
|
1987
1990
|
"NameWrapper"
|
|
1988
1991
|
);
|
|
1989
1992
|
const nameWrapperAccounts = [
|
|
@@ -2006,7 +2009,7 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2006
2009
|
owner
|
|
2007
2010
|
};
|
|
2008
2011
|
}
|
|
2009
|
-
if (
|
|
2012
|
+
if (isAddressEqual4(owner.address, zeroAddress3)) {
|
|
2010
2013
|
return {
|
|
2011
2014
|
ownershipType: NameTokenOwnershipTypes.Burned,
|
|
2012
2015
|
owner
|
|
@@ -2026,14 +2029,28 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2026
2029
|
}
|
|
2027
2030
|
|
|
2028
2031
|
// src/tokenscope/zod-schemas.ts
|
|
2029
|
-
var
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2032
|
+
var tokenIdSchemaSerializable = z7.string();
|
|
2033
|
+
var tokenIdSchemaNative = z7.preprocess(
|
|
2034
|
+
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2035
|
+
z7.bigint().positive()
|
|
2036
|
+
);
|
|
2037
|
+
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2038
|
+
if (serializable) {
|
|
2039
|
+
return tokenIdSchemaSerializable;
|
|
2040
|
+
} else {
|
|
2041
|
+
return tokenIdSchemaNative;
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2045
|
+
return z7.object({
|
|
2046
|
+
assetNamespace: z7.enum(AssetNamespaces),
|
|
2047
|
+
contract: makeAccountIdSchema(valueLabel),
|
|
2048
|
+
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2049
|
+
});
|
|
2050
|
+
};
|
|
2051
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => z7.preprocess((v) => {
|
|
2035
2052
|
if (typeof v === "string") {
|
|
2036
|
-
const result = new
|
|
2053
|
+
const result = new CaipAssetId2(v);
|
|
2037
2054
|
return {
|
|
2038
2055
|
assetNamespace: result.assetName.namespace,
|
|
2039
2056
|
contract: {
|
|
@@ -2047,7 +2064,7 @@ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => z6.prep
|
|
|
2047
2064
|
}, makeAssetIdSchema(valueLabel));
|
|
2048
2065
|
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
2049
2066
|
const ownership = ctx.value;
|
|
2050
|
-
if (ctx.value.owner.address ===
|
|
2067
|
+
if (ctx.value.owner.address === zeroAddress4) {
|
|
2051
2068
|
ctx.issues.push({
|
|
2052
2069
|
code: "custom",
|
|
2053
2070
|
input: ctx.value,
|
|
@@ -2055,25 +2072,25 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
|
2055
2072
|
});
|
|
2056
2073
|
}
|
|
2057
2074
|
}
|
|
2058
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") =>
|
|
2059
|
-
ownershipType:
|
|
2075
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => z7.object({
|
|
2076
|
+
ownershipType: z7.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2060
2077
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2061
2078
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2062
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") =>
|
|
2063
|
-
ownershipType:
|
|
2079
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => z7.object({
|
|
2080
|
+
ownershipType: z7.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2064
2081
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2065
2082
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2066
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") =>
|
|
2067
|
-
ownershipType:
|
|
2083
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => z7.object({
|
|
2084
|
+
ownershipType: z7.literal(NameTokenOwnershipTypes.Burned),
|
|
2068
2085
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2069
2086
|
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2070
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") =>
|
|
2071
|
-
ownershipType:
|
|
2087
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => z7.object({
|
|
2088
|
+
ownershipType: z7.literal(NameTokenOwnershipTypes.Unknown),
|
|
2072
2089
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2073
2090
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2074
2091
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
2075
2092
|
const ownership = ctx.value;
|
|
2076
|
-
if (ctx.value.owner.address !==
|
|
2093
|
+
if (ctx.value.owner.address !== zeroAddress4) {
|
|
2077
2094
|
ctx.issues.push({
|
|
2078
2095
|
code: "custom",
|
|
2079
2096
|
input: ctx.value,
|
|
@@ -2081,23 +2098,19 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
2081
2098
|
});
|
|
2082
2099
|
}
|
|
2083
2100
|
}
|
|
2084
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
2101
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => z7.discriminatedUnion("ownershipType", [
|
|
2085
2102
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2086
2103
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2087
2104
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2088
2105
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2089
2106
|
]);
|
|
2090
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema") =>
|
|
2091
|
-
token: makeAssetIdSchema(`${valueLabel}.token
|
|
2107
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => z7.object({
|
|
2108
|
+
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2092
2109
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2093
|
-
mintStatus:
|
|
2110
|
+
mintStatus: z7.enum(NFTMintStatuses)
|
|
2094
2111
|
});
|
|
2095
2112
|
|
|
2096
2113
|
// src/tokenscope/assets.ts
|
|
2097
|
-
var AssetNamespaces = {
|
|
2098
|
-
ERC721: "erc721",
|
|
2099
|
-
ERC1155: "erc1155"
|
|
2100
|
-
};
|
|
2101
2114
|
function serializeAssetId(assetId) {
|
|
2102
2115
|
return {
|
|
2103
2116
|
assetNamespace: assetId.assetNamespace,
|
|
@@ -2115,14 +2128,6 @@ ${prettifyError6(parsed.error)}
|
|
|
2115
2128
|
}
|
|
2116
2129
|
return parsed.data;
|
|
2117
2130
|
}
|
|
2118
|
-
function formatAssetId(assetId) {
|
|
2119
|
-
const { assetNamespace, contract, tokenId } = serializeAssetId(assetId);
|
|
2120
|
-
return CaipAssetId2.format({
|
|
2121
|
-
chainId: { namespace: "eip155", reference: contract.chainId.toString() },
|
|
2122
|
-
assetName: { namespace: assetNamespace, reference: contract.address },
|
|
2123
|
-
tokenId
|
|
2124
|
-
}).toLowerCase();
|
|
2125
|
-
}
|
|
2126
2131
|
function parseAssetId(maybeAssetId, valueLabel) {
|
|
2127
2132
|
const schema = makeAssetIdStringSchema(valueLabel);
|
|
2128
2133
|
const parsed = schema.safeParse(maybeAssetId);
|
|
@@ -2151,13 +2156,13 @@ var NFTMintStatuses = {
|
|
|
2151
2156
|
Burned: "burned"
|
|
2152
2157
|
};
|
|
2153
2158
|
var formatNFTTransferEventMetadata = (metadata) => {
|
|
2154
|
-
const
|
|
2159
|
+
const assetIdString = formatAssetId(metadata.nft);
|
|
2155
2160
|
return [
|
|
2156
2161
|
`Event: ${metadata.eventHandlerName}`,
|
|
2157
2162
|
`Chain ID: ${metadata.chainId}`,
|
|
2158
2163
|
`Block Number: ${metadata.blockNumber}`,
|
|
2159
2164
|
`Transaction Hash: ${metadata.transactionHash}`,
|
|
2160
|
-
`NFT: ${
|
|
2165
|
+
`NFT: ${assetIdString}`
|
|
2161
2166
|
].map((line) => ` - ${line}`).join("\n");
|
|
2162
2167
|
};
|
|
2163
2168
|
var NFTTransferTypes = {
|
|
@@ -2263,11 +2268,11 @@ var NFTTransferTypes = {
|
|
|
2263
2268
|
};
|
|
2264
2269
|
var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
|
|
2265
2270
|
const isIndexed = currentlyIndexedOwner !== void 0;
|
|
2266
|
-
const isIndexedAsMinted = isIndexed && !
|
|
2267
|
-
const isMint =
|
|
2268
|
-
const isBurn =
|
|
2269
|
-
const isSelfTransfer =
|
|
2270
|
-
if (isIndexed && !
|
|
2271
|
+
const isIndexedAsMinted = isIndexed && !isAddressEqual5(currentlyIndexedOwner, zeroAddress5);
|
|
2272
|
+
const isMint = isAddressEqual5(from, zeroAddress5);
|
|
2273
|
+
const isBurn = isAddressEqual5(to, zeroAddress5);
|
|
2274
|
+
const isSelfTransfer = isAddressEqual5(from, to);
|
|
2275
|
+
if (isIndexed && !isAddressEqual5(currentlyIndexedOwner, from)) {
|
|
2271
2276
|
if (isMint && allowMintedRemint) {
|
|
2272
2277
|
} else {
|
|
2273
2278
|
throw new Error(
|
|
@@ -2350,10 +2355,10 @@ ${formatNFTTransferEventMetadata(metadata)}`
|
|
|
2350
2355
|
};
|
|
2351
2356
|
|
|
2352
2357
|
// src/api/shared/errors/zod-schemas.ts
|
|
2353
|
-
import
|
|
2354
|
-
var ErrorResponseSchema =
|
|
2355
|
-
message:
|
|
2356
|
-
details:
|
|
2358
|
+
import z8 from "zod/v4";
|
|
2359
|
+
var ErrorResponseSchema = z8.object({
|
|
2360
|
+
message: z8.string(),
|
|
2361
|
+
details: z8.optional(z8.unknown())
|
|
2357
2362
|
});
|
|
2358
2363
|
|
|
2359
2364
|
// src/api/name-tokens/response.ts
|
|
@@ -2392,7 +2397,13 @@ var NameTokensResponseErrorCodes = {
|
|
|
2392
2397
|
};
|
|
2393
2398
|
|
|
2394
2399
|
// src/api/name-tokens/zod-schemas.ts
|
|
2395
|
-
|
|
2400
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => z9.object({
|
|
2401
|
+
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2402
|
+
name: makeReinterpretedNameSchema(valueLabel),
|
|
2403
|
+
tokens: z9.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2404
|
+
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2405
|
+
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2406
|
+
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
2396
2407
|
const { name, domainId } = ctx.value;
|
|
2397
2408
|
if (namehash2(name) !== domainId) {
|
|
2398
2409
|
ctx.issues.push({
|
|
@@ -2401,24 +2412,24 @@ function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
|
2401
2412
|
message: `'name' must be associated with 'domainId': ${domainId}`
|
|
2402
2413
|
});
|
|
2403
2414
|
}
|
|
2404
|
-
}
|
|
2405
|
-
function invariant_nameTokensOwnershipTypeNameWrapperRequiresOwnershipTypeFullyOnchainOrUnknown(ctx) {
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2415
|
+
}).check(
|
|
2416
|
+
function invariant_nameTokensOwnershipTypeNameWrapperRequiresOwnershipTypeFullyOnchainOrUnknown(ctx) {
|
|
2417
|
+
const { tokens } = ctx.value;
|
|
2418
|
+
const containsOwnershipNameWrapper = tokens.some(
|
|
2419
|
+
(t) => t.ownership.ownershipType === NameTokenOwnershipTypes.NameWrapper
|
|
2420
|
+
);
|
|
2421
|
+
const containsOwnershipFullyOnchainOrUnknown = tokens.some(
|
|
2422
|
+
(t) => t.ownership.ownershipType === NameTokenOwnershipTypes.FullyOnchain || t.ownership.ownershipType === NameTokenOwnershipTypes.Unknown
|
|
2423
|
+
);
|
|
2424
|
+
if (containsOwnershipNameWrapper && !containsOwnershipFullyOnchainOrUnknown) {
|
|
2425
|
+
ctx.issues.push({
|
|
2426
|
+
code: "custom",
|
|
2427
|
+
input: ctx.value,
|
|
2428
|
+
message: `'tokens' must contain name token with ownership type 'fully-onchain' or 'unknown' when name token with ownership type 'namewrapper' in listed`
|
|
2429
|
+
});
|
|
2430
|
+
}
|
|
2419
2431
|
}
|
|
2420
|
-
|
|
2421
|
-
function invariant_nameTokensContainAtMostOneWithOwnershipTypeEffective(ctx) {
|
|
2432
|
+
).check(function invariant_nameTokensContainAtMostOneWithOwnershipTypeEffective(ctx) {
|
|
2422
2433
|
const { tokens } = ctx.value;
|
|
2423
2434
|
const tokensCountWithOwnershipFullyOnchain = tokens.filter(
|
|
2424
2435
|
(t) => t.ownership.ownershipType === NameTokenOwnershipTypes.FullyOnchain
|
|
@@ -2430,46 +2441,43 @@ function invariant_nameTokensContainAtMostOneWithOwnershipTypeEffective(ctx) {
|
|
|
2430
2441
|
message: `'tokens' must contain at most one name token with ownership type 'fully-onchain', current count: ${tokensCountWithOwnershipFullyOnchain}`
|
|
2431
2442
|
});
|
|
2432
2443
|
}
|
|
2433
|
-
}
|
|
2434
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token") => z8.object({
|
|
2435
|
-
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2436
|
-
name: makeReinterpretedNameSchema(valueLabel),
|
|
2437
|
-
tokens: z8.array(makeNameTokenSchema(`${valueLabel}.tokens`)).nonempty(),
|
|
2438
|
-
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2439
|
-
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2440
|
-
}).check(invariant_nameIsAssociatedWithDomainId).check(invariant_nameTokensContainAtMostOneWithOwnershipTypeEffective).check(invariant_nameTokensOwnershipTypeNameWrapperRequiresOwnershipTypeFullyOnchainOrUnknown);
|
|
2441
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK") => z8.strictObject({
|
|
2442
|
-
responseCode: z8.literal(NameTokensResponseCodes.Ok),
|
|
2443
|
-
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`)
|
|
2444
2444
|
});
|
|
2445
|
-
var
|
|
2446
|
-
responseCode:
|
|
2447
|
-
|
|
2445
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => z9.strictObject({
|
|
2446
|
+
responseCode: z9.literal(NameTokensResponseCodes.Ok),
|
|
2447
|
+
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2448
|
+
});
|
|
2449
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => z9.strictObject({
|
|
2450
|
+
responseCode: z9.literal(NameTokensResponseCodes.Error),
|
|
2451
|
+
errorCode: z9.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2448
2452
|
error: ErrorResponseSchema
|
|
2449
2453
|
});
|
|
2450
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2451
|
-
responseCode:
|
|
2452
|
-
errorCode:
|
|
2454
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => z9.strictObject({
|
|
2455
|
+
responseCode: z9.literal(NameTokensResponseCodes.Error),
|
|
2456
|
+
errorCode: z9.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2453
2457
|
error: ErrorResponseSchema
|
|
2454
2458
|
});
|
|
2455
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2456
|
-
responseCode:
|
|
2457
|
-
errorCode:
|
|
2459
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => z9.strictObject({
|
|
2460
|
+
responseCode: z9.literal(NameTokensResponseCodes.Error),
|
|
2461
|
+
errorCode: z9.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2458
2462
|
error: ErrorResponseSchema
|
|
2459
2463
|
});
|
|
2460
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2464
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => z9.discriminatedUnion("errorCode", [
|
|
2461
2465
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2462
2466
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2463
2467
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2464
2468
|
]);
|
|
2465
|
-
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response") =>
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
+
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2470
|
+
return z9.discriminatedUnion("responseCode", [
|
|
2471
|
+
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2472
|
+
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2473
|
+
]);
|
|
2474
|
+
};
|
|
2469
2475
|
|
|
2470
2476
|
// src/api/name-tokens/deserialize.ts
|
|
2471
2477
|
function deserializedNameTokensResponse(maybeResponse) {
|
|
2472
|
-
const parsed = makeNameTokensResponseSchema().safeParse(
|
|
2478
|
+
const parsed = makeNameTokensResponseSchema("Name Tokens Response", false).safeParse(
|
|
2479
|
+
maybeResponse
|
|
2480
|
+
);
|
|
2473
2481
|
if (parsed.error) {
|
|
2474
2482
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2475
2483
|
${prettifyError7(parsed.error)}
|
|
@@ -2550,13 +2558,13 @@ import { prettifyError as prettifyError8 } from "zod/v4";
|
|
|
2550
2558
|
|
|
2551
2559
|
// src/api/registrar-actions/zod-schemas.ts
|
|
2552
2560
|
import { namehash as namehash3 } from "viem/ens";
|
|
2553
|
-
import
|
|
2561
|
+
import z12 from "zod/v4";
|
|
2554
2562
|
|
|
2555
2563
|
// ../ens-referrals/src/address.ts
|
|
2556
|
-
import { isAddress as
|
|
2564
|
+
import { isAddress as isAddress4 } from "viem";
|
|
2557
2565
|
|
|
2558
2566
|
// ../ens-referrals/src/encoding.ts
|
|
2559
|
-
import { getAddress, pad, size as size2, slice, zeroAddress as
|
|
2567
|
+
import { getAddress, pad, size as size2, slice, zeroAddress as zeroAddress6 } from "viem";
|
|
2560
2568
|
var ENCODED_REFERRER_BYTE_OFFSET = 12;
|
|
2561
2569
|
var ENCODED_REFERRER_BYTE_LENGTH = 32;
|
|
2562
2570
|
var EXPECTED_ENCODED_REFERRER_PADDING = pad("0x", {
|
|
@@ -2575,7 +2583,7 @@ function decodeEncodedReferrer(encodedReferrer) {
|
|
|
2575
2583
|
}
|
|
2576
2584
|
const padding = slice(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2577
2585
|
if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) {
|
|
2578
|
-
return
|
|
2586
|
+
return zeroAddress6;
|
|
2579
2587
|
}
|
|
2580
2588
|
const decodedReferrer = slice(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2581
2589
|
try {
|
|
@@ -2604,7 +2612,7 @@ var ReferrerDetailTypeIds = {
|
|
|
2604
2612
|
};
|
|
2605
2613
|
|
|
2606
2614
|
// src/registrars/zod-schemas.ts
|
|
2607
|
-
import
|
|
2615
|
+
import { z as z10 } from "zod/v4";
|
|
2608
2616
|
|
|
2609
2617
|
// src/registrars/registrar-action.ts
|
|
2610
2618
|
var RegistrarActionTypes = {
|
|
@@ -2645,11 +2653,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2645
2653
|
}
|
|
2646
2654
|
|
|
2647
2655
|
// src/registrars/zod-schemas.ts
|
|
2648
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2656
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => z10.object({
|
|
2649
2657
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2650
2658
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2651
2659
|
});
|
|
2652
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2660
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => z10.object({
|
|
2653
2661
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2654
2662
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2655
2663
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2665,18 +2673,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2665
2673
|
});
|
|
2666
2674
|
}
|
|
2667
2675
|
}
|
|
2668
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2676
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => z10.union([
|
|
2669
2677
|
// pricing available
|
|
2670
|
-
|
|
2678
|
+
z10.object({
|
|
2671
2679
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2672
2680
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2673
2681
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2674
2682
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2675
2683
|
// pricing unknown
|
|
2676
|
-
|
|
2677
|
-
baseCost:
|
|
2678
|
-
premium:
|
|
2679
|
-
total:
|
|
2684
|
+
z10.object({
|
|
2685
|
+
baseCost: z10.null(),
|
|
2686
|
+
premium: z10.null(),
|
|
2687
|
+
total: z10.null()
|
|
2680
2688
|
}).transform((v) => v)
|
|
2681
2689
|
]);
|
|
2682
2690
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2699,9 +2707,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2699
2707
|
});
|
|
2700
2708
|
}
|
|
2701
2709
|
}
|
|
2702
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2710
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => z10.union([
|
|
2703
2711
|
// referral available
|
|
2704
|
-
|
|
2712
|
+
z10.object({
|
|
2705
2713
|
encodedReferrer: makeHexStringSchema(
|
|
2706
2714
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2707
2715
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2709,9 +2717,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2709
2717
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2710
2718
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2711
2719
|
// referral not applicable
|
|
2712
|
-
|
|
2713
|
-
encodedReferrer:
|
|
2714
|
-
decodedReferrer:
|
|
2720
|
+
z10.object({
|
|
2721
|
+
encodedReferrer: z10.null(),
|
|
2722
|
+
decodedReferrer: z10.null()
|
|
2715
2723
|
})
|
|
2716
2724
|
]);
|
|
2717
2725
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2724,9 +2732,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2724
2732
|
});
|
|
2725
2733
|
}
|
|
2726
2734
|
}
|
|
2727
|
-
var EventIdSchema =
|
|
2728
|
-
var EventIdsSchema =
|
|
2729
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2735
|
+
var EventIdSchema = z10.string().nonempty();
|
|
2736
|
+
var EventIdsSchema = z10.array(EventIdSchema).min(1).transform((v) => v);
|
|
2737
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => z10.object({
|
|
2730
2738
|
id: EventIdSchema,
|
|
2731
2739
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2732
2740
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2740,38 +2748,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => z9
|
|
|
2740
2748
|
eventIds: EventIdsSchema
|
|
2741
2749
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2742
2750
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2743
|
-
type:
|
|
2751
|
+
type: z10.literal(RegistrarActionTypes.Registration)
|
|
2744
2752
|
});
|
|
2745
2753
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2746
|
-
type:
|
|
2754
|
+
type: z10.literal(RegistrarActionTypes.Renewal)
|
|
2747
2755
|
});
|
|
2748
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
2756
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => z10.discriminatedUnion("type", [
|
|
2749
2757
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2750
2758
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2751
2759
|
]);
|
|
2752
2760
|
|
|
2753
2761
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2754
|
-
import
|
|
2762
|
+
import z11 from "zod/v4";
|
|
2755
2763
|
|
|
2756
2764
|
// src/api/shared/pagination/request.ts
|
|
2757
2765
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2758
2766
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2759
2767
|
|
|
2760
2768
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2761
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
2769
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => z11.object({
|
|
2762
2770
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2763
2771
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2764
2772
|
RECORDS_PER_PAGE_MAX,
|
|
2765
2773
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2766
2774
|
)
|
|
2767
2775
|
});
|
|
2768
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2769
|
-
totalRecords:
|
|
2770
|
-
totalPages:
|
|
2771
|
-
hasNext:
|
|
2772
|
-
hasPrev:
|
|
2773
|
-
startIndex:
|
|
2774
|
-
endIndex:
|
|
2776
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => z11.object({
|
|
2777
|
+
totalRecords: z11.literal(0),
|
|
2778
|
+
totalPages: z11.literal(1),
|
|
2779
|
+
hasNext: z11.literal(false),
|
|
2780
|
+
hasPrev: z11.literal(false),
|
|
2781
|
+
startIndex: z11.undefined(),
|
|
2782
|
+
endIndex: z11.undefined()
|
|
2775
2783
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2776
2784
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2777
2785
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2806,15 +2814,15 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2806
2814
|
});
|
|
2807
2815
|
}
|
|
2808
2816
|
}
|
|
2809
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
2817
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => z11.object({
|
|
2810
2818
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2811
2819
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2812
|
-
hasNext:
|
|
2813
|
-
hasPrev:
|
|
2820
|
+
hasNext: z11.boolean(),
|
|
2821
|
+
hasPrev: z11.boolean(),
|
|
2814
2822
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2815
2823
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2816
2824
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2817
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
2825
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => z11.union([
|
|
2818
2826
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2819
2827
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2820
2828
|
]);
|
|
@@ -2844,20 +2852,21 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2844
2852
|
});
|
|
2845
2853
|
}
|
|
2846
2854
|
}
|
|
2847
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
2855
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => z12.object({
|
|
2848
2856
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2849
2857
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2850
2858
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2851
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2852
|
-
responseCode:
|
|
2853
|
-
registrarActions:
|
|
2854
|
-
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`)
|
|
2859
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => z12.object({
|
|
2860
|
+
responseCode: z12.literal(RegistrarActionsResponseCodes.Ok),
|
|
2861
|
+
registrarActions: z12.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
2862
|
+
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
2863
|
+
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
|
|
2855
2864
|
});
|
|
2856
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2857
|
-
responseCode:
|
|
2865
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => z12.strictObject({
|
|
2866
|
+
responseCode: z12.literal(RegistrarActionsResponseCodes.Error),
|
|
2858
2867
|
error: ErrorResponseSchema
|
|
2859
2868
|
});
|
|
2860
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
2869
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => z12.discriminatedUnion("responseCode", [
|
|
2861
2870
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2862
2871
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2863
2872
|
]);
|
|
@@ -2879,7 +2888,9 @@ ${prettifyError8(parsed.error)}
|
|
|
2879
2888
|
var RegistrarActionsFilterTypes = {
|
|
2880
2889
|
BySubregistryNode: "bySubregistryNode",
|
|
2881
2890
|
WithEncodedReferral: "withEncodedReferral",
|
|
2882
|
-
ByDecodedReferrer: "byDecodedReferrer"
|
|
2891
|
+
ByDecodedReferrer: "byDecodedReferrer",
|
|
2892
|
+
BeginTimestamp: "beginTimestamp",
|
|
2893
|
+
EndTimestamp: "endTimestamp"
|
|
2883
2894
|
};
|
|
2884
2895
|
var RegistrarActionsOrders = {
|
|
2885
2896
|
LatestRegistrarActions: "orderBy[timestamp]=desc"
|
|
@@ -2912,10 +2923,30 @@ function byDecodedReferrer(decodedReferrer) {
|
|
|
2912
2923
|
value: decodedReferrer
|
|
2913
2924
|
};
|
|
2914
2925
|
}
|
|
2926
|
+
function beginTimestamp(timestamp) {
|
|
2927
|
+
if (typeof timestamp === "undefined") {
|
|
2928
|
+
return void 0;
|
|
2929
|
+
}
|
|
2930
|
+
return {
|
|
2931
|
+
filterType: RegistrarActionsFilterTypes.BeginTimestamp,
|
|
2932
|
+
value: timestamp
|
|
2933
|
+
};
|
|
2934
|
+
}
|
|
2935
|
+
function endTimestamp(timestamp) {
|
|
2936
|
+
if (typeof timestamp === "undefined") {
|
|
2937
|
+
return void 0;
|
|
2938
|
+
}
|
|
2939
|
+
return {
|
|
2940
|
+
filterType: RegistrarActionsFilterTypes.EndTimestamp,
|
|
2941
|
+
value: timestamp
|
|
2942
|
+
};
|
|
2943
|
+
}
|
|
2915
2944
|
var registrarActionsFilter = {
|
|
2916
2945
|
byParentNode,
|
|
2917
2946
|
withReferral,
|
|
2918
|
-
byDecodedReferrer
|
|
2947
|
+
byDecodedReferrer,
|
|
2948
|
+
beginTimestamp,
|
|
2949
|
+
endTimestamp
|
|
2919
2950
|
};
|
|
2920
2951
|
|
|
2921
2952
|
// src/api/registrar-actions/prerequisites.ts
|
|
@@ -2970,14 +3001,14 @@ var registrarActionsPrerequisites = Object.freeze({
|
|
|
2970
3001
|
|
|
2971
3002
|
// src/registrars/basenames-subregistry.ts
|
|
2972
3003
|
import {
|
|
2973
|
-
DatasourceNames as
|
|
3004
|
+
DatasourceNames as DatasourceNames3,
|
|
2974
3005
|
ENSNamespaceIds as ENSNamespaceIds3,
|
|
2975
3006
|
maybeGetDatasource as maybeGetDatasource2
|
|
2976
3007
|
} from "@ensnode/datasources";
|
|
2977
3008
|
function getBasenamesSubregistryId(namespace) {
|
|
2978
|
-
const datasource = maybeGetDatasource2(namespace,
|
|
3009
|
+
const datasource = maybeGetDatasource2(namespace, DatasourceNames3.Basenames);
|
|
2979
3010
|
if (!datasource) {
|
|
2980
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
3011
|
+
throw new Error(`Datasource not found for ${namespace} ${DatasourceNames3.Basenames}`);
|
|
2981
3012
|
}
|
|
2982
3013
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
2983
3014
|
if (address === void 0 || Array.isArray(address)) {
|
|
@@ -2994,7 +3025,6 @@ function getBasenamesSubregistryManagedName(namespaceId) {
|
|
|
2994
3025
|
return "base.eth";
|
|
2995
3026
|
case ENSNamespaceIds3.Sepolia:
|
|
2996
3027
|
return "basetest.eth";
|
|
2997
|
-
case ENSNamespaceIds3.Holesky:
|
|
2998
3028
|
case ENSNamespaceIds3.EnsTestEnv:
|
|
2999
3029
|
throw new Error(
|
|
3000
3030
|
`No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
|
|
@@ -3004,14 +3034,14 @@ function getBasenamesSubregistryManagedName(namespaceId) {
|
|
|
3004
3034
|
|
|
3005
3035
|
// src/registrars/ethnames-subregistry.ts
|
|
3006
3036
|
import {
|
|
3007
|
-
DatasourceNames as
|
|
3037
|
+
DatasourceNames as DatasourceNames4,
|
|
3008
3038
|
ENSNamespaceIds as ENSNamespaceIds4,
|
|
3009
3039
|
maybeGetDatasource as maybeGetDatasource3
|
|
3010
3040
|
} from "@ensnode/datasources";
|
|
3011
3041
|
function getEthnamesSubregistryId(namespace) {
|
|
3012
|
-
const datasource = maybeGetDatasource3(namespace,
|
|
3042
|
+
const datasource = maybeGetDatasource3(namespace, DatasourceNames4.ENSRoot);
|
|
3013
3043
|
if (!datasource) {
|
|
3014
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
3044
|
+
throw new Error(`Datasource not found for ${namespace} ${DatasourceNames4.ENSRoot}`);
|
|
3015
3045
|
}
|
|
3016
3046
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3017
3047
|
if (address === void 0 || Array.isArray(address)) {
|
|
@@ -3026,7 +3056,6 @@ function getEthnamesSubregistryManagedName(namespaceId) {
|
|
|
3026
3056
|
switch (namespaceId) {
|
|
3027
3057
|
case ENSNamespaceIds4.Mainnet:
|
|
3028
3058
|
case ENSNamespaceIds4.Sepolia:
|
|
3029
|
-
case ENSNamespaceIds4.Holesky:
|
|
3030
3059
|
case ENSNamespaceIds4.EnsTestEnv:
|
|
3031
3060
|
return "eth";
|
|
3032
3061
|
}
|
|
@@ -3034,14 +3063,14 @@ function getEthnamesSubregistryManagedName(namespaceId) {
|
|
|
3034
3063
|
|
|
3035
3064
|
// src/registrars/lineanames-subregistry.ts
|
|
3036
3065
|
import {
|
|
3037
|
-
DatasourceNames as
|
|
3066
|
+
DatasourceNames as DatasourceNames5,
|
|
3038
3067
|
ENSNamespaceIds as ENSNamespaceIds5,
|
|
3039
3068
|
maybeGetDatasource as maybeGetDatasource4
|
|
3040
3069
|
} from "@ensnode/datasources";
|
|
3041
3070
|
function getLineanamesSubregistryId(namespace) {
|
|
3042
|
-
const datasource = maybeGetDatasource4(namespace,
|
|
3071
|
+
const datasource = maybeGetDatasource4(namespace, DatasourceNames5.Lineanames);
|
|
3043
3072
|
if (!datasource) {
|
|
3044
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
3073
|
+
throw new Error(`Datasource not found for ${namespace} ${DatasourceNames5.Lineanames}`);
|
|
3045
3074
|
}
|
|
3046
3075
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3047
3076
|
if (address === void 0 || Array.isArray(address)) {
|
|
@@ -3058,7 +3087,6 @@ function getLineanamesSubregistryManagedName(namespaceId) {
|
|
|
3058
3087
|
return "linea.eth";
|
|
3059
3088
|
case ENSNamespaceIds5.Sepolia:
|
|
3060
3089
|
return "linea-sepolia.eth";
|
|
3061
|
-
case ENSNamespaceIds5.Holesky:
|
|
3062
3090
|
case ENSNamespaceIds5.EnsTestEnv:
|
|
3063
3091
|
throw new Error(
|
|
3064
3092
|
`No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
|
|
@@ -3066,6 +3094,21 @@ function getLineanamesSubregistryManagedName(namespaceId) {
|
|
|
3066
3094
|
}
|
|
3067
3095
|
}
|
|
3068
3096
|
|
|
3097
|
+
// src/registrars/registration-expiration.ts
|
|
3098
|
+
function isRegistrationExpired(info, now) {
|
|
3099
|
+
if (info.expiry == null) return false;
|
|
3100
|
+
return info.expiry <= now;
|
|
3101
|
+
}
|
|
3102
|
+
function isRegistrationFullyExpired(info, now) {
|
|
3103
|
+
if (info.expiry == null) return false;
|
|
3104
|
+
return now >= info.expiry + (info.gracePeriod ?? 0n);
|
|
3105
|
+
}
|
|
3106
|
+
function isRegistrationInGracePeriod(info, now) {
|
|
3107
|
+
if (info.expiry == null) return false;
|
|
3108
|
+
if (info.gracePeriod == null) return false;
|
|
3109
|
+
return info.expiry <= now && info.expiry + info.gracePeriod > now;
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3069
3112
|
// src/api/registrar-actions/serialize.ts
|
|
3070
3113
|
function serializeNamedRegistrarAction({
|
|
3071
3114
|
action,
|
|
@@ -3082,7 +3125,8 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3082
3125
|
return {
|
|
3083
3126
|
responseCode: response.responseCode,
|
|
3084
3127
|
registrarActions: response.registrarActions.map(serializeNamedRegistrarAction),
|
|
3085
|
-
pageContext: response.pageContext
|
|
3128
|
+
pageContext: response.pageContext,
|
|
3129
|
+
accurateAsOf: response.accurateAsOf
|
|
3086
3130
|
};
|
|
3087
3131
|
case RegistrarActionsResponseCodes.Error:
|
|
3088
3132
|
return response;
|
|
@@ -3153,7 +3197,7 @@ var ClientError = class _ClientError extends Error {
|
|
|
3153
3197
|
import { prettifyError as prettifyError10 } from "zod/v4";
|
|
3154
3198
|
|
|
3155
3199
|
// src/ensanalytics/zod-schemas.ts
|
|
3156
|
-
import
|
|
3200
|
+
import z13 from "zod/v4";
|
|
3157
3201
|
|
|
3158
3202
|
// src/ensanalytics/types.ts
|
|
3159
3203
|
var ReferrerLeaderboardPageResponseCodes = {
|
|
@@ -3178,20 +3222,28 @@ var ReferrerDetailResponseCodes = {
|
|
|
3178
3222
|
};
|
|
3179
3223
|
|
|
3180
3224
|
// src/ensanalytics/zod-schemas.ts
|
|
3181
|
-
var
|
|
3225
|
+
var makeRevenueContributionSchema = (valueLabel = "RevenueContribution") => z13.coerce.bigint({
|
|
3226
|
+
error: `${valueLabel} must represent a bigint.`
|
|
3227
|
+
}).nonnegative({
|
|
3228
|
+
error: `${valueLabel} must not be negative.`
|
|
3229
|
+
});
|
|
3230
|
+
var makeReferralProgramRulesSchema = (valueLabel = "ReferralProgramRules") => z13.object({
|
|
3182
3231
|
totalAwardPoolValue: makeFiniteNonNegativeNumberSchema(`${valueLabel}.totalAwardPoolValue`),
|
|
3183
3232
|
maxQualifiedReferrers: makeNonNegativeIntegerSchema(`${valueLabel}.maxQualifiedReferrers`),
|
|
3184
3233
|
startTime: makeUnixTimestampSchema(`${valueLabel}.startTime`),
|
|
3185
3234
|
endTime: makeUnixTimestampSchema(`${valueLabel}.endTime`),
|
|
3186
3235
|
subregistryId: makeAccountIdSchema(`${valueLabel}.subregistryId`)
|
|
3187
3236
|
});
|
|
3188
|
-
var makeAwardedReferrerMetricsSchema = (valueLabel = "AwardedReferrerMetrics") =>
|
|
3237
|
+
var makeAwardedReferrerMetricsSchema = (valueLabel = "AwardedReferrerMetrics") => z13.object({
|
|
3189
3238
|
referrer: makeLowercaseAddressSchema(`${valueLabel}.referrer`),
|
|
3190
3239
|
totalReferrals: makeNonNegativeIntegerSchema(`${valueLabel}.totalReferrals`),
|
|
3191
3240
|
totalIncrementalDuration: makeDurationSchema(`${valueLabel}.totalIncrementalDuration`),
|
|
3241
|
+
totalRevenueContribution: makeRevenueContributionSchema(
|
|
3242
|
+
`${valueLabel}.totalRevenueContribution`
|
|
3243
|
+
),
|
|
3192
3244
|
score: makeFiniteNonNegativeNumberSchema(`${valueLabel}.score`),
|
|
3193
3245
|
rank: makePositiveIntegerSchema(`${valueLabel}.rank`),
|
|
3194
|
-
isQualified:
|
|
3246
|
+
isQualified: z13.boolean(),
|
|
3195
3247
|
finalScoreBoost: makeFiniteNonNegativeNumberSchema(`${valueLabel}.finalScoreBoost`).max(
|
|
3196
3248
|
1,
|
|
3197
3249
|
`${valueLabel}.finalScoreBoost must be <= 1`
|
|
@@ -3203,13 +3255,16 @@ var makeAwardedReferrerMetricsSchema = (valueLabel = "AwardedReferrerMetrics") =
|
|
|
3203
3255
|
),
|
|
3204
3256
|
awardPoolApproxValue: makeFiniteNonNegativeNumberSchema(`${valueLabel}.awardPoolApproxValue`)
|
|
3205
3257
|
});
|
|
3206
|
-
var makeUnrankedReferrerMetricsSchema = (valueLabel = "UnrankedReferrerMetrics") =>
|
|
3258
|
+
var makeUnrankedReferrerMetricsSchema = (valueLabel = "UnrankedReferrerMetrics") => z13.object({
|
|
3207
3259
|
referrer: makeLowercaseAddressSchema(`${valueLabel}.referrer`),
|
|
3208
3260
|
totalReferrals: makeNonNegativeIntegerSchema(`${valueLabel}.totalReferrals`),
|
|
3209
3261
|
totalIncrementalDuration: makeDurationSchema(`${valueLabel}.totalIncrementalDuration`),
|
|
3262
|
+
totalRevenueContribution: makeRevenueContributionSchema(
|
|
3263
|
+
`${valueLabel}.totalRevenueContribution`
|
|
3264
|
+
),
|
|
3210
3265
|
score: makeFiniteNonNegativeNumberSchema(`${valueLabel}.score`),
|
|
3211
|
-
rank:
|
|
3212
|
-
isQualified:
|
|
3266
|
+
rank: z13.null(),
|
|
3267
|
+
isQualified: z13.literal(false),
|
|
3213
3268
|
finalScoreBoost: makeFiniteNonNegativeNumberSchema(`${valueLabel}.finalScoreBoost`).max(
|
|
3214
3269
|
1,
|
|
3215
3270
|
`${valueLabel}.finalScoreBoost must be <= 1`
|
|
@@ -3221,11 +3276,14 @@ var makeUnrankedReferrerMetricsSchema = (valueLabel = "UnrankedReferrerMetrics")
|
|
|
3221
3276
|
),
|
|
3222
3277
|
awardPoolApproxValue: makeFiniteNonNegativeNumberSchema(`${valueLabel}.awardPoolApproxValue`)
|
|
3223
3278
|
});
|
|
3224
|
-
var makeAggregatedReferrerMetricsSchema = (valueLabel = "AggregatedReferrerMetrics") =>
|
|
3279
|
+
var makeAggregatedReferrerMetricsSchema = (valueLabel = "AggregatedReferrerMetrics") => z13.object({
|
|
3225
3280
|
grandTotalReferrals: makeNonNegativeIntegerSchema(`${valueLabel}.grandTotalReferrals`),
|
|
3226
3281
|
grandTotalIncrementalDuration: makeDurationSchema(
|
|
3227
3282
|
`${valueLabel}.grandTotalIncrementalDuration`
|
|
3228
3283
|
),
|
|
3284
|
+
grandTotalRevenueContribution: makeRevenueContributionSchema(
|
|
3285
|
+
`${valueLabel}.grandTotalRevenueContribution`
|
|
3286
|
+
),
|
|
3229
3287
|
grandTotalQualifiedReferrersFinalScore: makeFiniteNonNegativeNumberSchema(
|
|
3230
3288
|
`${valueLabel}.grandTotalQualifiedReferrersFinalScore`
|
|
3231
3289
|
),
|
|
@@ -3233,7 +3291,7 @@ var makeAggregatedReferrerMetricsSchema = (valueLabel = "AggregatedReferrerMetri
|
|
|
3233
3291
|
`${valueLabel}.minFinalScoreToQualify`
|
|
3234
3292
|
)
|
|
3235
3293
|
});
|
|
3236
|
-
var makeReferrerLeaderboardPageContextSchema = (valueLabel = "ReferrerLeaderboardPageContext") =>
|
|
3294
|
+
var makeReferrerLeaderboardPageContextSchema = (valueLabel = "ReferrerLeaderboardPageContext") => z13.object({
|
|
3237
3295
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
3238
3296
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
3239
3297
|
REFERRERS_PER_LEADERBOARD_PAGE_MAX,
|
|
@@ -3241,66 +3299,153 @@ var makeReferrerLeaderboardPageContextSchema = (valueLabel = "ReferrerLeaderboar
|
|
|
3241
3299
|
),
|
|
3242
3300
|
totalRecords: makeNonNegativeIntegerSchema(`${valueLabel}.totalRecords`),
|
|
3243
3301
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
3244
|
-
hasNext:
|
|
3245
|
-
hasPrev:
|
|
3246
|
-
startIndex:
|
|
3247
|
-
endIndex:
|
|
3302
|
+
hasNext: z13.boolean(),
|
|
3303
|
+
hasPrev: z13.boolean(),
|
|
3304
|
+
startIndex: z13.optional(makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`)),
|
|
3305
|
+
endIndex: z13.optional(makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`))
|
|
3248
3306
|
});
|
|
3249
|
-
var makeReferrerLeaderboardPageSchema = (valueLabel = "ReferrerLeaderboardPage") =>
|
|
3307
|
+
var makeReferrerLeaderboardPageSchema = (valueLabel = "ReferrerLeaderboardPage") => z13.object({
|
|
3250
3308
|
rules: makeReferralProgramRulesSchema(`${valueLabel}.rules`),
|
|
3251
|
-
referrers:
|
|
3309
|
+
referrers: z13.array(makeAwardedReferrerMetricsSchema(`${valueLabel}.referrers[record]`)),
|
|
3252
3310
|
aggregatedMetrics: makeAggregatedReferrerMetricsSchema(`${valueLabel}.aggregatedMetrics`),
|
|
3253
3311
|
pageContext: makeReferrerLeaderboardPageContextSchema(`${valueLabel}.pageContext`),
|
|
3254
3312
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
3255
3313
|
});
|
|
3256
|
-
var makeReferrerLeaderboardPageResponseOkSchema = (valueLabel = "ReferrerLeaderboardPageResponseOk") =>
|
|
3257
|
-
responseCode:
|
|
3314
|
+
var makeReferrerLeaderboardPageResponseOkSchema = (valueLabel = "ReferrerLeaderboardPageResponseOk") => z13.object({
|
|
3315
|
+
responseCode: z13.literal(ReferrerLeaderboardPageResponseCodes.Ok),
|
|
3258
3316
|
data: makeReferrerLeaderboardPageSchema(`${valueLabel}.data`)
|
|
3259
3317
|
});
|
|
3260
|
-
var makeReferrerLeaderboardPageResponseErrorSchema = (_valueLabel = "ReferrerLeaderboardPageResponseError") =>
|
|
3261
|
-
responseCode:
|
|
3262
|
-
error:
|
|
3263
|
-
errorMessage:
|
|
3318
|
+
var makeReferrerLeaderboardPageResponseErrorSchema = (_valueLabel = "ReferrerLeaderboardPageResponseError") => z13.object({
|
|
3319
|
+
responseCode: z13.literal(ReferrerLeaderboardPageResponseCodes.Error),
|
|
3320
|
+
error: z13.string(),
|
|
3321
|
+
errorMessage: z13.string()
|
|
3264
3322
|
});
|
|
3265
|
-
var makeReferrerLeaderboardPageResponseSchema = (valueLabel = "ReferrerLeaderboardPageResponse") =>
|
|
3323
|
+
var makeReferrerLeaderboardPageResponseSchema = (valueLabel = "ReferrerLeaderboardPageResponse") => z13.union([
|
|
3266
3324
|
makeReferrerLeaderboardPageResponseOkSchema(valueLabel),
|
|
3267
3325
|
makeReferrerLeaderboardPageResponseErrorSchema(valueLabel)
|
|
3268
3326
|
]);
|
|
3269
|
-
var makeReferrerDetailRankedSchema = (valueLabel = "ReferrerDetailRanked") =>
|
|
3270
|
-
type:
|
|
3327
|
+
var makeReferrerDetailRankedSchema = (valueLabel = "ReferrerDetailRanked") => z13.object({
|
|
3328
|
+
type: z13.literal(ReferrerDetailTypeIds.Ranked),
|
|
3271
3329
|
rules: makeReferralProgramRulesSchema(`${valueLabel}.rules`),
|
|
3272
3330
|
referrer: makeAwardedReferrerMetricsSchema(`${valueLabel}.referrer`),
|
|
3273
3331
|
aggregatedMetrics: makeAggregatedReferrerMetricsSchema(`${valueLabel}.aggregatedMetrics`),
|
|
3274
3332
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
3275
3333
|
});
|
|
3276
|
-
var makeReferrerDetailUnrankedSchema = (valueLabel = "ReferrerDetailUnranked") =>
|
|
3277
|
-
type:
|
|
3334
|
+
var makeReferrerDetailUnrankedSchema = (valueLabel = "ReferrerDetailUnranked") => z13.object({
|
|
3335
|
+
type: z13.literal(ReferrerDetailTypeIds.Unranked),
|
|
3278
3336
|
rules: makeReferralProgramRulesSchema(`${valueLabel}.rules`),
|
|
3279
3337
|
referrer: makeUnrankedReferrerMetricsSchema(`${valueLabel}.referrer`),
|
|
3280
3338
|
aggregatedMetrics: makeAggregatedReferrerMetricsSchema(`${valueLabel}.aggregatedMetrics`),
|
|
3281
3339
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
3282
3340
|
});
|
|
3283
|
-
var makeReferrerDetailResponseOkSchema = (valueLabel = "ReferrerDetailResponse") =>
|
|
3284
|
-
responseCode:
|
|
3285
|
-
data:
|
|
3341
|
+
var makeReferrerDetailResponseOkSchema = (valueLabel = "ReferrerDetailResponse") => z13.object({
|
|
3342
|
+
responseCode: z13.literal(ReferrerDetailResponseCodes.Ok),
|
|
3343
|
+
data: z13.union([
|
|
3286
3344
|
makeReferrerDetailRankedSchema(`${valueLabel}.data`),
|
|
3287
3345
|
makeReferrerDetailUnrankedSchema(`${valueLabel}.data`)
|
|
3288
3346
|
])
|
|
3289
3347
|
});
|
|
3290
|
-
var makeReferrerDetailResponseErrorSchema = (_valueLabel = "ReferrerDetailResponse") =>
|
|
3291
|
-
responseCode:
|
|
3292
|
-
error:
|
|
3293
|
-
errorMessage:
|
|
3348
|
+
var makeReferrerDetailResponseErrorSchema = (_valueLabel = "ReferrerDetailResponse") => z13.object({
|
|
3349
|
+
responseCode: z13.literal(ReferrerDetailResponseCodes.Error),
|
|
3350
|
+
error: z13.string(),
|
|
3351
|
+
errorMessage: z13.string()
|
|
3294
3352
|
});
|
|
3295
|
-
var makeReferrerDetailResponseSchema = (valueLabel = "ReferrerDetailResponse") =>
|
|
3353
|
+
var makeReferrerDetailResponseSchema = (valueLabel = "ReferrerDetailResponse") => z13.union([
|
|
3296
3354
|
makeReferrerDetailResponseOkSchema(valueLabel),
|
|
3297
3355
|
makeReferrerDetailResponseErrorSchema(valueLabel)
|
|
3298
3356
|
]);
|
|
3299
3357
|
|
|
3300
3358
|
// src/ensanalytics/deserialize.ts
|
|
3359
|
+
function deserializeRevenueContribution(value) {
|
|
3360
|
+
return BigInt(value);
|
|
3361
|
+
}
|
|
3362
|
+
function deserializeReferralProgramRules(rules) {
|
|
3363
|
+
return rules;
|
|
3364
|
+
}
|
|
3365
|
+
function deserializeAwardedReferrerMetrics(metrics) {
|
|
3366
|
+
return {
|
|
3367
|
+
referrer: metrics.referrer,
|
|
3368
|
+
totalReferrals: metrics.totalReferrals,
|
|
3369
|
+
totalIncrementalDuration: metrics.totalIncrementalDuration,
|
|
3370
|
+
totalRevenueContribution: deserializeRevenueContribution(metrics.totalRevenueContribution),
|
|
3371
|
+
score: metrics.score,
|
|
3372
|
+
rank: metrics.rank,
|
|
3373
|
+
isQualified: metrics.isQualified,
|
|
3374
|
+
finalScoreBoost: metrics.finalScoreBoost,
|
|
3375
|
+
finalScore: metrics.finalScore,
|
|
3376
|
+
awardPoolShare: metrics.awardPoolShare,
|
|
3377
|
+
awardPoolApproxValue: metrics.awardPoolApproxValue
|
|
3378
|
+
};
|
|
3379
|
+
}
|
|
3380
|
+
function deserializeUnrankedReferrerMetrics(metrics) {
|
|
3381
|
+
return {
|
|
3382
|
+
referrer: metrics.referrer,
|
|
3383
|
+
totalReferrals: metrics.totalReferrals,
|
|
3384
|
+
totalIncrementalDuration: metrics.totalIncrementalDuration,
|
|
3385
|
+
totalRevenueContribution: deserializeRevenueContribution(metrics.totalRevenueContribution),
|
|
3386
|
+
score: metrics.score,
|
|
3387
|
+
rank: metrics.rank,
|
|
3388
|
+
isQualified: metrics.isQualified,
|
|
3389
|
+
finalScoreBoost: metrics.finalScoreBoost,
|
|
3390
|
+
finalScore: metrics.finalScore,
|
|
3391
|
+
awardPoolShare: metrics.awardPoolShare,
|
|
3392
|
+
awardPoolApproxValue: metrics.awardPoolApproxValue
|
|
3393
|
+
};
|
|
3394
|
+
}
|
|
3395
|
+
function deserializeAggregatedReferrerMetrics(metrics) {
|
|
3396
|
+
return {
|
|
3397
|
+
grandTotalReferrals: metrics.grandTotalReferrals,
|
|
3398
|
+
grandTotalIncrementalDuration: metrics.grandTotalIncrementalDuration,
|
|
3399
|
+
grandTotalRevenueContribution: deserializeRevenueContribution(
|
|
3400
|
+
metrics.grandTotalRevenueContribution
|
|
3401
|
+
),
|
|
3402
|
+
grandTotalQualifiedReferrersFinalScore: metrics.grandTotalQualifiedReferrersFinalScore,
|
|
3403
|
+
minFinalScoreToQualify: metrics.minFinalScoreToQualify
|
|
3404
|
+
};
|
|
3405
|
+
}
|
|
3406
|
+
function deserializeReferrerLeaderboardPage(page) {
|
|
3407
|
+
return {
|
|
3408
|
+
rules: deserializeReferralProgramRules(page.rules),
|
|
3409
|
+
referrers: page.referrers.map(deserializeAwardedReferrerMetrics),
|
|
3410
|
+
aggregatedMetrics: deserializeAggregatedReferrerMetrics(page.aggregatedMetrics),
|
|
3411
|
+
pageContext: page.pageContext,
|
|
3412
|
+
accurateAsOf: page.accurateAsOf
|
|
3413
|
+
};
|
|
3414
|
+
}
|
|
3415
|
+
function deserializeReferrerDetailRanked(detail) {
|
|
3416
|
+
return {
|
|
3417
|
+
type: detail.type,
|
|
3418
|
+
rules: deserializeReferralProgramRules(detail.rules),
|
|
3419
|
+
referrer: deserializeAwardedReferrerMetrics(detail.referrer),
|
|
3420
|
+
aggregatedMetrics: deserializeAggregatedReferrerMetrics(detail.aggregatedMetrics),
|
|
3421
|
+
accurateAsOf: detail.accurateAsOf
|
|
3422
|
+
};
|
|
3423
|
+
}
|
|
3424
|
+
function deserializeReferrerDetailUnranked(detail) {
|
|
3425
|
+
return {
|
|
3426
|
+
type: detail.type,
|
|
3427
|
+
rules: deserializeReferralProgramRules(detail.rules),
|
|
3428
|
+
referrer: deserializeUnrankedReferrerMetrics(detail.referrer),
|
|
3429
|
+
aggregatedMetrics: deserializeAggregatedReferrerMetrics(detail.aggregatedMetrics),
|
|
3430
|
+
accurateAsOf: detail.accurateAsOf
|
|
3431
|
+
};
|
|
3432
|
+
}
|
|
3301
3433
|
function deserializeReferrerLeaderboardPageResponse(maybeResponse, valueLabel) {
|
|
3434
|
+
let deserialized;
|
|
3435
|
+
switch (maybeResponse.responseCode) {
|
|
3436
|
+
case "ok": {
|
|
3437
|
+
deserialized = {
|
|
3438
|
+
responseCode: maybeResponse.responseCode,
|
|
3439
|
+
data: deserializeReferrerLeaderboardPage(maybeResponse.data)
|
|
3440
|
+
};
|
|
3441
|
+
break;
|
|
3442
|
+
}
|
|
3443
|
+
case "error":
|
|
3444
|
+
deserialized = maybeResponse;
|
|
3445
|
+
break;
|
|
3446
|
+
}
|
|
3302
3447
|
const schema = makeReferrerLeaderboardPageResponseSchema(valueLabel);
|
|
3303
|
-
const parsed = schema.safeParse(
|
|
3448
|
+
const parsed = schema.safeParse(deserialized);
|
|
3304
3449
|
if (parsed.error) {
|
|
3305
3450
|
throw new Error(
|
|
3306
3451
|
`Cannot deserialize SerializedReferrerLeaderboardPageResponse:
|
|
@@ -3311,8 +3456,31 @@ ${prettifyError10(parsed.error)}
|
|
|
3311
3456
|
return parsed.data;
|
|
3312
3457
|
}
|
|
3313
3458
|
function deserializeReferrerDetailResponse(maybeResponse, valueLabel) {
|
|
3459
|
+
let deserialized;
|
|
3460
|
+
switch (maybeResponse.responseCode) {
|
|
3461
|
+
case "ok": {
|
|
3462
|
+
switch (maybeResponse.data.type) {
|
|
3463
|
+
case "ranked":
|
|
3464
|
+
deserialized = {
|
|
3465
|
+
responseCode: maybeResponse.responseCode,
|
|
3466
|
+
data: deserializeReferrerDetailRanked(maybeResponse.data)
|
|
3467
|
+
};
|
|
3468
|
+
break;
|
|
3469
|
+
case "unranked":
|
|
3470
|
+
deserialized = {
|
|
3471
|
+
responseCode: maybeResponse.responseCode,
|
|
3472
|
+
data: deserializeReferrerDetailUnranked(maybeResponse.data)
|
|
3473
|
+
};
|
|
3474
|
+
break;
|
|
3475
|
+
}
|
|
3476
|
+
break;
|
|
3477
|
+
}
|
|
3478
|
+
case "error":
|
|
3479
|
+
deserialized = maybeResponse;
|
|
3480
|
+
break;
|
|
3481
|
+
}
|
|
3314
3482
|
const schema = makeReferrerDetailResponseSchema(valueLabel);
|
|
3315
|
-
const parsed = schema.safeParse(
|
|
3483
|
+
const parsed = schema.safeParse(deserialized);
|
|
3316
3484
|
if (parsed.error) {
|
|
3317
3485
|
throw new Error(`Cannot deserialize ReferrerDetailResponse:
|
|
3318
3486
|
${prettifyError10(parsed.error)}
|
|
@@ -3322,10 +3490,87 @@ ${prettifyError10(parsed.error)}
|
|
|
3322
3490
|
}
|
|
3323
3491
|
|
|
3324
3492
|
// src/ensanalytics/serialize.ts
|
|
3493
|
+
function serializeRevenueContribution(revenueContribution) {
|
|
3494
|
+
return revenueContribution.toString();
|
|
3495
|
+
}
|
|
3496
|
+
function serializeReferralProgramRules(rules) {
|
|
3497
|
+
return rules;
|
|
3498
|
+
}
|
|
3499
|
+
function serializeAwardedReferrerMetrics(metrics) {
|
|
3500
|
+
return {
|
|
3501
|
+
referrer: metrics.referrer,
|
|
3502
|
+
totalReferrals: metrics.totalReferrals,
|
|
3503
|
+
totalIncrementalDuration: metrics.totalIncrementalDuration,
|
|
3504
|
+
totalRevenueContribution: serializeRevenueContribution(metrics.totalRevenueContribution),
|
|
3505
|
+
score: metrics.score,
|
|
3506
|
+
rank: metrics.rank,
|
|
3507
|
+
isQualified: metrics.isQualified,
|
|
3508
|
+
finalScoreBoost: metrics.finalScoreBoost,
|
|
3509
|
+
finalScore: metrics.finalScore,
|
|
3510
|
+
awardPoolShare: metrics.awardPoolShare,
|
|
3511
|
+
awardPoolApproxValue: metrics.awardPoolApproxValue
|
|
3512
|
+
};
|
|
3513
|
+
}
|
|
3514
|
+
function serializeUnrankedReferrerMetrics(metrics) {
|
|
3515
|
+
return {
|
|
3516
|
+
referrer: metrics.referrer,
|
|
3517
|
+
totalReferrals: metrics.totalReferrals,
|
|
3518
|
+
totalIncrementalDuration: metrics.totalIncrementalDuration,
|
|
3519
|
+
totalRevenueContribution: serializeRevenueContribution(metrics.totalRevenueContribution),
|
|
3520
|
+
score: metrics.score,
|
|
3521
|
+
rank: metrics.rank,
|
|
3522
|
+
isQualified: metrics.isQualified,
|
|
3523
|
+
finalScoreBoost: metrics.finalScoreBoost,
|
|
3524
|
+
finalScore: metrics.finalScore,
|
|
3525
|
+
awardPoolShare: metrics.awardPoolShare,
|
|
3526
|
+
awardPoolApproxValue: metrics.awardPoolApproxValue
|
|
3527
|
+
};
|
|
3528
|
+
}
|
|
3529
|
+
function serializeAggregatedReferrerMetrics(metrics) {
|
|
3530
|
+
return {
|
|
3531
|
+
grandTotalReferrals: metrics.grandTotalReferrals,
|
|
3532
|
+
grandTotalIncrementalDuration: metrics.grandTotalIncrementalDuration,
|
|
3533
|
+
grandTotalRevenueContribution: serializeRevenueContribution(
|
|
3534
|
+
metrics.grandTotalRevenueContribution
|
|
3535
|
+
),
|
|
3536
|
+
grandTotalQualifiedReferrersFinalScore: metrics.grandTotalQualifiedReferrersFinalScore,
|
|
3537
|
+
minFinalScoreToQualify: metrics.minFinalScoreToQualify
|
|
3538
|
+
};
|
|
3539
|
+
}
|
|
3540
|
+
function serializeReferrerLeaderboardPage(page) {
|
|
3541
|
+
return {
|
|
3542
|
+
rules: serializeReferralProgramRules(page.rules),
|
|
3543
|
+
referrers: page.referrers.map(serializeAwardedReferrerMetrics),
|
|
3544
|
+
aggregatedMetrics: serializeAggregatedReferrerMetrics(page.aggregatedMetrics),
|
|
3545
|
+
pageContext: page.pageContext,
|
|
3546
|
+
accurateAsOf: page.accurateAsOf
|
|
3547
|
+
};
|
|
3548
|
+
}
|
|
3549
|
+
function serializeReferrerDetailRanked(detail) {
|
|
3550
|
+
return {
|
|
3551
|
+
type: detail.type,
|
|
3552
|
+
rules: serializeReferralProgramRules(detail.rules),
|
|
3553
|
+
referrer: serializeAwardedReferrerMetrics(detail.referrer),
|
|
3554
|
+
aggregatedMetrics: serializeAggregatedReferrerMetrics(detail.aggregatedMetrics),
|
|
3555
|
+
accurateAsOf: detail.accurateAsOf
|
|
3556
|
+
};
|
|
3557
|
+
}
|
|
3558
|
+
function serializeReferrerDetailUnranked(detail) {
|
|
3559
|
+
return {
|
|
3560
|
+
type: detail.type,
|
|
3561
|
+
rules: serializeReferralProgramRules(detail.rules),
|
|
3562
|
+
referrer: serializeUnrankedReferrerMetrics(detail.referrer),
|
|
3563
|
+
aggregatedMetrics: serializeAggregatedReferrerMetrics(detail.aggregatedMetrics),
|
|
3564
|
+
accurateAsOf: detail.accurateAsOf
|
|
3565
|
+
};
|
|
3566
|
+
}
|
|
3325
3567
|
function serializeReferrerLeaderboardPageResponse(response) {
|
|
3326
3568
|
switch (response.responseCode) {
|
|
3327
3569
|
case ReferrerLeaderboardPageResponseCodes.Ok:
|
|
3328
|
-
return
|
|
3570
|
+
return {
|
|
3571
|
+
responseCode: response.responseCode,
|
|
3572
|
+
data: serializeReferrerLeaderboardPage(response.data)
|
|
3573
|
+
};
|
|
3329
3574
|
case ReferrerLeaderboardPageResponseCodes.Error:
|
|
3330
3575
|
return response;
|
|
3331
3576
|
}
|
|
@@ -3333,7 +3578,19 @@ function serializeReferrerLeaderboardPageResponse(response) {
|
|
|
3333
3578
|
function serializeReferrerDetailResponse(response) {
|
|
3334
3579
|
switch (response.responseCode) {
|
|
3335
3580
|
case ReferrerDetailResponseCodes.Ok:
|
|
3336
|
-
|
|
3581
|
+
switch (response.data.type) {
|
|
3582
|
+
case "ranked":
|
|
3583
|
+
return {
|
|
3584
|
+
responseCode: response.responseCode,
|
|
3585
|
+
data: serializeReferrerDetailRanked(response.data)
|
|
3586
|
+
};
|
|
3587
|
+
case "unranked":
|
|
3588
|
+
return {
|
|
3589
|
+
responseCode: response.responseCode,
|
|
3590
|
+
data: serializeReferrerDetailUnranked(response.data)
|
|
3591
|
+
};
|
|
3592
|
+
}
|
|
3593
|
+
break;
|
|
3337
3594
|
case ReferrerDetailResponseCodes.Error:
|
|
3338
3595
|
return response;
|
|
3339
3596
|
}
|
|
@@ -3765,6 +4022,7 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3765
4022
|
* const { registrarActions, pageContext } = response;
|
|
3766
4023
|
* console.log(registrarActions);
|
|
3767
4024
|
* console.log(`Page ${pageContext.page} of ${pageContext.totalPages}`);
|
|
4025
|
+
* console.log(`Accurate as of: ${response.accurateAsOf}`);
|
|
3768
4026
|
* }
|
|
3769
4027
|
*
|
|
3770
4028
|
* // Get second page with 25 records per page
|
|
@@ -3795,6 +4053,26 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3795
4053
|
* filters: [registrarActionsFilter.byParentNode(namehash('base.eth'))],
|
|
3796
4054
|
* recordsPerPage: 10
|
|
3797
4055
|
* });
|
|
4056
|
+
*
|
|
4057
|
+
* // get registrar actions within a specific time range
|
|
4058
|
+
* const beginTimestamp = 1764547200; // Dec 1, 2025, 00:00:00 UTC
|
|
4059
|
+
* const endTimestamp = 1767225600; // Jan 1, 2026, 00:00:00 UTC
|
|
4060
|
+
* await client.registrarActions({
|
|
4061
|
+
* filters: [
|
|
4062
|
+
* registrarActionsFilter.beginTimestamp(beginTimestamp),
|
|
4063
|
+
* registrarActionsFilter.endTimestamp(endTimestamp),
|
|
4064
|
+
* ],
|
|
4065
|
+
* });
|
|
4066
|
+
*
|
|
4067
|
+
* // get registrar actions from a specific timestamp onwards
|
|
4068
|
+
* await client.registrarActions({
|
|
4069
|
+
* filters: [registrarActionsFilter.beginTimestamp(1764547200)],
|
|
4070
|
+
* });
|
|
4071
|
+
*
|
|
4072
|
+
* // get registrar actions up to a specific timestamp
|
|
4073
|
+
* await client.registrarActions({
|
|
4074
|
+
* filters: [registrarActionsFilter.endTimestamp(1767225600)],
|
|
4075
|
+
* });
|
|
3798
4076
|
* ```
|
|
3799
4077
|
*/
|
|
3800
4078
|
async registrarActions(request = {}) {
|
|
@@ -3816,6 +4094,18 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3816
4094
|
);
|
|
3817
4095
|
return decodedReferrerFilter ? { key: "decodedReferrer", value: decodedReferrerFilter.value } : null;
|
|
3818
4096
|
};
|
|
4097
|
+
const buildBeginTimestampArg = (filters) => {
|
|
4098
|
+
const beginTimestampFilter = filters?.find(
|
|
4099
|
+
(f) => f.filterType === RegistrarActionsFilterTypes.BeginTimestamp
|
|
4100
|
+
);
|
|
4101
|
+
return beginTimestampFilter ? { key: "beginTimestamp", value: beginTimestampFilter.value.toString() } : null;
|
|
4102
|
+
};
|
|
4103
|
+
const buildEndTimestampArg = (filters) => {
|
|
4104
|
+
const endTimestampFilter = filters?.find(
|
|
4105
|
+
(f) => f.filterType === RegistrarActionsFilterTypes.EndTimestamp
|
|
4106
|
+
);
|
|
4107
|
+
return endTimestampFilter ? { key: "endTimestamp", value: endTimestampFilter.value.toString() } : null;
|
|
4108
|
+
};
|
|
3819
4109
|
const buildOrderArg = (order) => {
|
|
3820
4110
|
switch (order) {
|
|
3821
4111
|
case RegistrarActionsOrders.LatestRegistrarActions: {
|
|
@@ -3846,6 +4136,14 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3846
4136
|
if (decodedReferrerArg) {
|
|
3847
4137
|
url.searchParams.set(decodedReferrerArg.key, decodedReferrerArg.value);
|
|
3848
4138
|
}
|
|
4139
|
+
const beginTimestampArg = buildBeginTimestampArg(request.filters);
|
|
4140
|
+
if (beginTimestampArg) {
|
|
4141
|
+
url.searchParams.set(beginTimestampArg.key, beginTimestampArg.value);
|
|
4142
|
+
}
|
|
4143
|
+
const endTimestampArg = buildEndTimestampArg(request.filters);
|
|
4144
|
+
if (endTimestampArg) {
|
|
4145
|
+
url.searchParams.set(endTimestampArg.key, endTimestampArg.value);
|
|
4146
|
+
}
|
|
3849
4147
|
const response = await fetch(url);
|
|
3850
4148
|
let responseData;
|
|
3851
4149
|
try {
|
|
@@ -3899,7 +4197,7 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3899
4197
|
const url = new URL(`/api/name-tokens`, this.options.url);
|
|
3900
4198
|
if (request.name !== void 0) {
|
|
3901
4199
|
url.searchParams.set("name", request.name);
|
|
3902
|
-
} else {
|
|
4200
|
+
} else if (request.domainId !== void 0) {
|
|
3903
4201
|
url.searchParams.set("domainId", request.domainId);
|
|
3904
4202
|
}
|
|
3905
4203
|
const response = await fetch(url);
|
|
@@ -3924,6 +4222,30 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3924
4222
|
}
|
|
3925
4223
|
};
|
|
3926
4224
|
|
|
4225
|
+
// src/ensv2/ids-lib.ts
|
|
4226
|
+
import { hexToBigInt as hexToBigInt2 } from "viem";
|
|
4227
|
+
var makeRegistryId = (accountId) => formatAccountId(accountId);
|
|
4228
|
+
var makeENSv1DomainId = (node) => node;
|
|
4229
|
+
var makeENSv2DomainId = (registry, canonicalId) => formatAssetId({
|
|
4230
|
+
assetNamespace: AssetNamespaces.ERC1155,
|
|
4231
|
+
contract: registry,
|
|
4232
|
+
tokenId: canonicalId
|
|
4233
|
+
});
|
|
4234
|
+
var maskLower32Bits = (num) => num ^ num & 0xffffffffn;
|
|
4235
|
+
var getCanonicalId = (input) => {
|
|
4236
|
+
if (typeof input === "bigint") return maskLower32Bits(input);
|
|
4237
|
+
return getCanonicalId(hexToBigInt2(input));
|
|
4238
|
+
};
|
|
4239
|
+
var makePermissionsId = (contract) => formatAccountId(contract);
|
|
4240
|
+
var makePermissionsResourceId = (contract, resource) => `${makePermissionsId(contract)}/${resource}`;
|
|
4241
|
+
var makePermissionsUserId = (contract, resource, user) => `${makePermissionsId(contract)}/${resource}/${user}`;
|
|
4242
|
+
var makeResolverId = (contract) => formatAccountId(contract);
|
|
4243
|
+
var makeResolverRecordsId = (resolver, node) => `${makeResolverId(resolver)}/${node}`;
|
|
4244
|
+
var makeLatestRegistrationId = (domainId) => `${domainId}/latest`;
|
|
4245
|
+
var makeRegistrationId = (domainId, index = 0) => `${domainId}/${index}`;
|
|
4246
|
+
var makeLatestRenewalId = (domainId, registrationIndex) => `${makeRegistrationId(domainId, registrationIndex)}/latest`;
|
|
4247
|
+
var makeRenewalId = (domainId, registrationIndex, index = 0) => `${makeRegistrationId(domainId, registrationIndex)}/${index}`;
|
|
4248
|
+
|
|
3927
4249
|
// src/identity/identity.ts
|
|
3928
4250
|
import { getENSRootChainId as getENSRootChainId2 } from "@ensnode/datasources";
|
|
3929
4251
|
|
|
@@ -3974,7 +4296,11 @@ var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
|
|
|
3974
4296
|
// src/resolution/resolver-records-selection.ts
|
|
3975
4297
|
var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length;
|
|
3976
4298
|
|
|
3977
|
-
// src/tracing/
|
|
4299
|
+
// src/tracing/ens-protocol-tracing.ts
|
|
4300
|
+
var PROTOCOL_ATTRIBUTE_PREFIX = "ens";
|
|
4301
|
+
var ATTR_PROTOCOL_NAME = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol`;
|
|
4302
|
+
var ATTR_PROTOCOL_STEP = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol.step`;
|
|
4303
|
+
var ATTR_PROTOCOL_STEP_RESULT = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol.step.result`;
|
|
3978
4304
|
var TraceableENSProtocol = /* @__PURE__ */ ((TraceableENSProtocol2) => {
|
|
3979
4305
|
TraceableENSProtocol2["ForwardResolution"] = "forward-resolution";
|
|
3980
4306
|
TraceableENSProtocol2["ReverseResolution"] = "reverse-resolution";
|
|
@@ -3999,10 +4325,6 @@ var ReverseResolutionProtocolStep = /* @__PURE__ */ ((ReverseResolutionProtocolS
|
|
|
3999
4325
|
ReverseResolutionProtocolStep2["VerifyResolvedAddressMatchesAddress"] = "verify-resolved-address-matches-address";
|
|
4000
4326
|
return ReverseResolutionProtocolStep2;
|
|
4001
4327
|
})(ReverseResolutionProtocolStep || {});
|
|
4002
|
-
var PROTOCOL_ATTRIBUTE_PREFIX = "ens";
|
|
4003
|
-
var ATTR_PROTOCOL_NAME = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol`;
|
|
4004
|
-
var ATTR_PROTOCOL_STEP = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol.step`;
|
|
4005
|
-
var ATTR_PROTOCOL_STEP_RESULT = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol.step.result`;
|
|
4006
4328
|
export {
|
|
4007
4329
|
ADDR_REVERSE_NODE,
|
|
4008
4330
|
ATTR_PROTOCOL_NAME,
|
|
@@ -4028,6 +4350,7 @@ export {
|
|
|
4028
4350
|
LruCache,
|
|
4029
4351
|
NFTMintStatuses,
|
|
4030
4352
|
NFTTransferTypes,
|
|
4353
|
+
NODE_ANY,
|
|
4031
4354
|
NameTokenOwnershipTypes,
|
|
4032
4355
|
NameTokensResponseCodes,
|
|
4033
4356
|
NameTokensResponseErrorCodes,
|
|
@@ -4037,6 +4360,7 @@ export {
|
|
|
4037
4360
|
RECORDS_PER_PAGE_DEFAULT,
|
|
4038
4361
|
RECORDS_PER_PAGE_MAX,
|
|
4039
4362
|
ROOT_NODE,
|
|
4363
|
+
ROOT_RESOURCE,
|
|
4040
4364
|
ReferrerDetailResponseCodes,
|
|
4041
4365
|
ReferrerLeaderboardPageResponseCodes,
|
|
4042
4366
|
RegistrarActionTypes,
|
|
@@ -4100,15 +4424,20 @@ export {
|
|
|
4100
4424
|
deserializedNameTokensResponse,
|
|
4101
4425
|
durationBetween,
|
|
4102
4426
|
encodeLabelHash,
|
|
4427
|
+
encodedLabelToLabelhash,
|
|
4103
4428
|
evmChainIdToCoinType,
|
|
4104
4429
|
formatAccountId,
|
|
4105
4430
|
formatAssetId,
|
|
4106
4431
|
formatNFTTransferEventMetadata,
|
|
4107
4432
|
getBasenamesSubregistryId,
|
|
4108
4433
|
getBasenamesSubregistryManagedName,
|
|
4434
|
+
getCanonicalId,
|
|
4109
4435
|
getCurrencyInfo,
|
|
4110
4436
|
getDatasourceContract,
|
|
4111
4437
|
getENSRootChainId,
|
|
4438
|
+
getENSv1Registry,
|
|
4439
|
+
getENSv2RootRegistry,
|
|
4440
|
+
getENSv2RootRegistryId,
|
|
4112
4441
|
getEthnamesSubregistryId,
|
|
4113
4442
|
getEthnamesSubregistryManagedName,
|
|
4114
4443
|
getLatestIndexedBlockRef,
|
|
@@ -4125,16 +4454,33 @@ export {
|
|
|
4125
4454
|
getTimestampForHighestOmnichainKnownBlock,
|
|
4126
4455
|
getTimestampForLowestOmnichainStartBlock,
|
|
4127
4456
|
hasNullByte,
|
|
4457
|
+
interpretAddress,
|
|
4458
|
+
interpretAddressRecordValue,
|
|
4459
|
+
interpretNameRecordValue,
|
|
4460
|
+
interpretTextRecordKey,
|
|
4461
|
+
interpretTextRecordValue,
|
|
4462
|
+
interpretTokenIdAsLabelHash,
|
|
4463
|
+
interpretTokenIdAsNode,
|
|
4128
4464
|
interpretedLabelsToInterpretedName,
|
|
4465
|
+
interpretedNameToInterpretedLabels,
|
|
4466
|
+
interpretedNameToLabelHashPath,
|
|
4467
|
+
isENSv1Registry,
|
|
4468
|
+
isENSv2RootRegistry,
|
|
4129
4469
|
isEncodedLabelHash,
|
|
4130
4470
|
isHttpProtocol,
|
|
4471
|
+
isInterpetedLabel,
|
|
4472
|
+
isInterpretedName,
|
|
4131
4473
|
isLabelHash,
|
|
4132
4474
|
isNormalizedLabel,
|
|
4133
4475
|
isNormalizedName,
|
|
4476
|
+
isPccFuseSet,
|
|
4134
4477
|
isPriceCurrencyEqual,
|
|
4135
4478
|
isPriceEqual,
|
|
4136
4479
|
isRegistrarActionPricingAvailable,
|
|
4137
4480
|
isRegistrarActionReferralAvailable,
|
|
4481
|
+
isRegistrationExpired,
|
|
4482
|
+
isRegistrationFullyExpired,
|
|
4483
|
+
isRegistrationInGracePeriod,
|
|
4138
4484
|
isResolvedIdentity,
|
|
4139
4485
|
isSelectionEmpty,
|
|
4140
4486
|
isSubgraphCompatible,
|
|
@@ -4144,7 +4490,20 @@ export {
|
|
|
4144
4490
|
literalLabelToInterpretedLabel,
|
|
4145
4491
|
literalLabelsToInterpretedName,
|
|
4146
4492
|
literalLabelsToLiteralName,
|
|
4493
|
+
makeContractMatcher,
|
|
4147
4494
|
makeENSApiPublicConfigSchema,
|
|
4495
|
+
makeENSv1DomainId,
|
|
4496
|
+
makeENSv2DomainId,
|
|
4497
|
+
makeLatestRegistrationId,
|
|
4498
|
+
makeLatestRenewalId,
|
|
4499
|
+
makePermissionsId,
|
|
4500
|
+
makePermissionsResourceId,
|
|
4501
|
+
makePermissionsUserId,
|
|
4502
|
+
makeRegistrationId,
|
|
4503
|
+
makeRegistryId,
|
|
4504
|
+
makeRenewalId,
|
|
4505
|
+
makeResolverId,
|
|
4506
|
+
makeResolverRecordsId,
|
|
4148
4507
|
makeSubdomainNode,
|
|
4149
4508
|
maybeGetDatasourceContract,
|
|
4150
4509
|
nameTokensPrerequisites,
|