@ensnode/ensnode-sdk 1.3.1 → 1.5.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 +807 -334
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +575 -139
- package/dist/index.d.ts +575 -139
- package/dist/index.js +732 -257
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -54,6 +54,7 @@ __export(index_exports, {
|
|
|
54
54
|
LruCache: () => LruCache,
|
|
55
55
|
NFTMintStatuses: () => NFTMintStatuses,
|
|
56
56
|
NFTTransferTypes: () => NFTTransferTypes,
|
|
57
|
+
NODE_ANY: () => NODE_ANY,
|
|
57
58
|
NameTokenOwnershipTypes: () => NameTokenOwnershipTypes,
|
|
58
59
|
NameTokensResponseCodes: () => NameTokensResponseCodes,
|
|
59
60
|
NameTokensResponseErrorCodes: () => NameTokensResponseErrorCodes,
|
|
@@ -63,6 +64,7 @@ __export(index_exports, {
|
|
|
63
64
|
RECORDS_PER_PAGE_DEFAULT: () => RECORDS_PER_PAGE_DEFAULT,
|
|
64
65
|
RECORDS_PER_PAGE_MAX: () => RECORDS_PER_PAGE_MAX,
|
|
65
66
|
ROOT_NODE: () => ROOT_NODE,
|
|
67
|
+
ROOT_RESOURCE: () => ROOT_RESOURCE,
|
|
66
68
|
ReferrerDetailResponseCodes: () => ReferrerDetailResponseCodes,
|
|
67
69
|
ReferrerLeaderboardPageResponseCodes: () => ReferrerLeaderboardPageResponseCodes,
|
|
68
70
|
RegistrarActionTypes: () => RegistrarActionTypes,
|
|
@@ -126,15 +128,20 @@ __export(index_exports, {
|
|
|
126
128
|
deserializedNameTokensResponse: () => deserializedNameTokensResponse,
|
|
127
129
|
durationBetween: () => durationBetween,
|
|
128
130
|
encodeLabelHash: () => encodeLabelHash,
|
|
131
|
+
encodedLabelToLabelhash: () => encodedLabelToLabelhash,
|
|
129
132
|
evmChainIdToCoinType: () => evmChainIdToCoinType,
|
|
130
133
|
formatAccountId: () => formatAccountId,
|
|
131
134
|
formatAssetId: () => formatAssetId,
|
|
132
135
|
formatNFTTransferEventMetadata: () => formatNFTTransferEventMetadata,
|
|
133
136
|
getBasenamesSubregistryId: () => getBasenamesSubregistryId,
|
|
134
137
|
getBasenamesSubregistryManagedName: () => getBasenamesSubregistryManagedName,
|
|
138
|
+
getCanonicalId: () => getCanonicalId,
|
|
135
139
|
getCurrencyInfo: () => getCurrencyInfo,
|
|
136
140
|
getDatasourceContract: () => getDatasourceContract,
|
|
137
141
|
getENSRootChainId: () => import_datasources2.getENSRootChainId,
|
|
142
|
+
getENSv1Registry: () => getENSv1Registry,
|
|
143
|
+
getENSv2RootRegistry: () => getENSv2RootRegistry,
|
|
144
|
+
getENSv2RootRegistryId: () => getENSv2RootRegistryId,
|
|
138
145
|
getEthnamesSubregistryId: () => getEthnamesSubregistryId,
|
|
139
146
|
getEthnamesSubregistryManagedName: () => getEthnamesSubregistryManagedName,
|
|
140
147
|
getLatestIndexedBlockRef: () => getLatestIndexedBlockRef,
|
|
@@ -151,16 +158,33 @@ __export(index_exports, {
|
|
|
151
158
|
getTimestampForHighestOmnichainKnownBlock: () => getTimestampForHighestOmnichainKnownBlock,
|
|
152
159
|
getTimestampForLowestOmnichainStartBlock: () => getTimestampForLowestOmnichainStartBlock,
|
|
153
160
|
hasNullByte: () => hasNullByte,
|
|
161
|
+
interpretAddress: () => interpretAddress,
|
|
162
|
+
interpretAddressRecordValue: () => interpretAddressRecordValue,
|
|
163
|
+
interpretNameRecordValue: () => interpretNameRecordValue,
|
|
164
|
+
interpretTextRecordKey: () => interpretTextRecordKey,
|
|
165
|
+
interpretTextRecordValue: () => interpretTextRecordValue,
|
|
166
|
+
interpretTokenIdAsLabelHash: () => interpretTokenIdAsLabelHash,
|
|
167
|
+
interpretTokenIdAsNode: () => interpretTokenIdAsNode,
|
|
154
168
|
interpretedLabelsToInterpretedName: () => interpretedLabelsToInterpretedName,
|
|
169
|
+
interpretedNameToInterpretedLabels: () => interpretedNameToInterpretedLabels,
|
|
170
|
+
interpretedNameToLabelHashPath: () => interpretedNameToLabelHashPath,
|
|
171
|
+
isENSv1Registry: () => isENSv1Registry,
|
|
172
|
+
isENSv2RootRegistry: () => isENSv2RootRegistry,
|
|
155
173
|
isEncodedLabelHash: () => isEncodedLabelHash,
|
|
156
174
|
isHttpProtocol: () => isHttpProtocol,
|
|
175
|
+
isInterpetedLabel: () => isInterpetedLabel,
|
|
176
|
+
isInterpretedName: () => isInterpretedName,
|
|
157
177
|
isLabelHash: () => isLabelHash,
|
|
158
178
|
isNormalizedLabel: () => isNormalizedLabel,
|
|
159
179
|
isNormalizedName: () => isNormalizedName,
|
|
180
|
+
isPccFuseSet: () => isPccFuseSet,
|
|
160
181
|
isPriceCurrencyEqual: () => isPriceCurrencyEqual,
|
|
161
182
|
isPriceEqual: () => isPriceEqual,
|
|
162
183
|
isRegistrarActionPricingAvailable: () => isRegistrarActionPricingAvailable,
|
|
163
184
|
isRegistrarActionReferralAvailable: () => isRegistrarActionReferralAvailable,
|
|
185
|
+
isRegistrationExpired: () => isRegistrationExpired,
|
|
186
|
+
isRegistrationFullyExpired: () => isRegistrationFullyExpired,
|
|
187
|
+
isRegistrationInGracePeriod: () => isRegistrationInGracePeriod,
|
|
164
188
|
isResolvedIdentity: () => isResolvedIdentity,
|
|
165
189
|
isSelectionEmpty: () => isSelectionEmpty,
|
|
166
190
|
isSubgraphCompatible: () => isSubgraphCompatible,
|
|
@@ -170,7 +194,20 @@ __export(index_exports, {
|
|
|
170
194
|
literalLabelToInterpretedLabel: () => literalLabelToInterpretedLabel,
|
|
171
195
|
literalLabelsToInterpretedName: () => literalLabelsToInterpretedName,
|
|
172
196
|
literalLabelsToLiteralName: () => literalLabelsToLiteralName,
|
|
197
|
+
makeContractMatcher: () => makeContractMatcher,
|
|
173
198
|
makeENSApiPublicConfigSchema: () => makeENSApiPublicConfigSchema,
|
|
199
|
+
makeENSv1DomainId: () => makeENSv1DomainId,
|
|
200
|
+
makeENSv2DomainId: () => makeENSv2DomainId,
|
|
201
|
+
makeLatestRegistrationId: () => makeLatestRegistrationId,
|
|
202
|
+
makeLatestRenewalId: () => makeLatestRenewalId,
|
|
203
|
+
makePermissionsId: () => makePermissionsId,
|
|
204
|
+
makePermissionsResourceId: () => makePermissionsResourceId,
|
|
205
|
+
makePermissionsUserId: () => makePermissionsUserId,
|
|
206
|
+
makeRegistrationId: () => makeRegistrationId,
|
|
207
|
+
makeRegistryId: () => makeRegistryId,
|
|
208
|
+
makeRenewalId: () => makeRenewalId,
|
|
209
|
+
makeResolverId: () => makeResolverId,
|
|
210
|
+
makeResolverRecordsId: () => makeResolverRecordsId,
|
|
174
211
|
makeSubdomainNode: () => makeSubdomainNode,
|
|
175
212
|
maybeGetDatasourceContract: () => maybeGetDatasourceContract,
|
|
176
213
|
nameTokensPrerequisites: () => nameTokensPrerequisites,
|
|
@@ -219,13 +256,13 @@ __export(index_exports, {
|
|
|
219
256
|
module.exports = __toCommonJS(index_exports);
|
|
220
257
|
|
|
221
258
|
// src/ensapi/config/deserialize.ts
|
|
222
|
-
var
|
|
259
|
+
var import_v46 = require("zod/v4");
|
|
223
260
|
|
|
224
261
|
// src/ensapi/config/zod-schemas.ts
|
|
225
|
-
var
|
|
262
|
+
var import_v45 = require("zod/v4");
|
|
226
263
|
|
|
227
264
|
// src/ensindexer/config/zod-schemas.ts
|
|
228
|
-
var import_v43 =
|
|
265
|
+
var import_v43 = require("zod/v4");
|
|
229
266
|
|
|
230
267
|
// src/shared/account-id.ts
|
|
231
268
|
var import_viem = require("viem");
|
|
@@ -297,7 +334,7 @@ var import_v42 = require("zod/v4");
|
|
|
297
334
|
// src/shared/zod-schemas.ts
|
|
298
335
|
var import_caip = require("caip");
|
|
299
336
|
var import_viem8 = require("viem");
|
|
300
|
-
var import_v4 =
|
|
337
|
+
var import_v4 = require("zod/v4");
|
|
301
338
|
|
|
302
339
|
// src/ens/index.ts
|
|
303
340
|
var import_datasources2 = require("@ensnode/datasources");
|
|
@@ -329,6 +366,8 @@ var ETH_NODE = (0, import_viem2.namehash)("eth");
|
|
|
329
366
|
var BASENAMES_NODE = (0, import_viem2.namehash)("base.eth");
|
|
330
367
|
var LINEANAMES_NODE = (0, import_viem2.namehash)("linea.eth");
|
|
331
368
|
var ADDR_REVERSE_NODE = (0, import_viem2.namehash)("addr.reverse");
|
|
369
|
+
var NODE_ANY = import_viem2.zeroHash;
|
|
370
|
+
var ROOT_RESOURCE = 0n;
|
|
332
371
|
|
|
333
372
|
// src/ens/dns-encoded-name.ts
|
|
334
373
|
var import_viem3 = require("viem");
|
|
@@ -377,6 +416,10 @@ function isEncodedLabelHash(maybeEncodedLabelHash) {
|
|
|
377
416
|
return expectedFormatting && includesLabelHash;
|
|
378
417
|
}
|
|
379
418
|
|
|
419
|
+
// src/ens/fuses.ts
|
|
420
|
+
var PARENT_CANNOT_CONTROL = 65536;
|
|
421
|
+
var isPccFuseSet = (fuses) => (fuses & PARENT_CANNOT_CONTROL) === PARENT_CANNOT_CONTROL;
|
|
422
|
+
|
|
380
423
|
// src/ens/is-normalized.ts
|
|
381
424
|
var import_ens = require("viem/ens");
|
|
382
425
|
function isNormalizedName(name) {
|
|
@@ -547,7 +590,7 @@ function addPrices(...prices) {
|
|
|
547
590
|
);
|
|
548
591
|
}
|
|
549
592
|
|
|
550
|
-
// src/shared/reinterpretation.ts
|
|
593
|
+
// src/shared/interpretation/reinterpretation.ts
|
|
551
594
|
var import_viem7 = require("viem");
|
|
552
595
|
function reinterpretLabel(label) {
|
|
553
596
|
if (label === "") {
|
|
@@ -568,14 +611,14 @@ function reinterpretName(name) {
|
|
|
568
611
|
}
|
|
569
612
|
|
|
570
613
|
// src/shared/zod-schemas.ts
|
|
571
|
-
var makeFiniteNonNegativeNumberSchema = (valueLabel = "Value") => import_v4.
|
|
614
|
+
var makeFiniteNonNegativeNumberSchema = (valueLabel = "Value") => import_v4.z.number({
|
|
572
615
|
// NOTE: Zod's implementation of `number` automatically rejects NaN and Infinity values.
|
|
573
616
|
// and therefore the finite check is implicit.
|
|
574
617
|
error: `${valueLabel} must be a finite number.`
|
|
575
618
|
}).nonnegative({
|
|
576
619
|
error: `${valueLabel} must be a non-negative number (>=0).`
|
|
577
620
|
});
|
|
578
|
-
var makeIntegerSchema = (valueLabel = "Value") => import_v4.
|
|
621
|
+
var makeIntegerSchema = (valueLabel = "Value") => import_v4.z.int({
|
|
579
622
|
error: `${valueLabel} must be an integer.`
|
|
580
623
|
});
|
|
581
624
|
var makePositiveIntegerSchema = (valueLabel = "Value") => makeIntegerSchema(valueLabel).positive({
|
|
@@ -584,12 +627,12 @@ var makePositiveIntegerSchema = (valueLabel = "Value") => makeIntegerSchema(valu
|
|
|
584
627
|
var makeNonNegativeIntegerSchema = (valueLabel = "Value") => makeIntegerSchema(valueLabel).nonnegative({
|
|
585
628
|
error: `${valueLabel} must be a non-negative integer (>=0).`
|
|
586
629
|
});
|
|
587
|
-
var makeDurationSchema = (valueLabel = "Value") => import_v4.
|
|
630
|
+
var makeDurationSchema = (valueLabel = "Value") => import_v4.z.coerce.number({
|
|
588
631
|
error: `${valueLabel} must be a number.`
|
|
589
632
|
}).pipe(makeNonNegativeIntegerSchema(valueLabel));
|
|
590
633
|
var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
|
|
591
|
-
var makeChainIdStringSchema = (valueLabel = "Chain ID String") => import_v4.
|
|
592
|
-
var makeLowercaseAddressSchema = (valueLabel = "EVM address") => import_v4.
|
|
634
|
+
var makeChainIdStringSchema = (valueLabel = "Chain ID String") => import_v4.z.string({ error: `${valueLabel} must be a string representing a chain ID.` }).pipe(import_v4.z.coerce.number({ error: `${valueLabel} must represent a positive integer (>0).` })).pipe(makeChainIdSchema(`The numeric value represented by ${valueLabel}`));
|
|
635
|
+
var makeLowercaseAddressSchema = (valueLabel = "EVM address") => import_v4.z.string().check((ctx) => {
|
|
593
636
|
if (!(0, import_viem8.isAddress)(ctx.value)) {
|
|
594
637
|
ctx.issues.push({
|
|
595
638
|
code: "custom",
|
|
@@ -598,14 +641,14 @@ var makeLowercaseAddressSchema = (valueLabel = "EVM address") => import_v4.defau
|
|
|
598
641
|
});
|
|
599
642
|
}
|
|
600
643
|
}).transform((val) => asLowerCaseAddress(val));
|
|
601
|
-
var makeDatetimeSchema = (valueLabel = "Datetime string") => import_v4.
|
|
644
|
+
var makeDatetimeSchema = (valueLabel = "Datetime string") => import_v4.z.iso.datetime({ error: `${valueLabel} must be a string in ISO 8601 format.` }).transform((v) => new Date(v));
|
|
602
645
|
var makeUnixTimestampSchema = (valueLabel = "Timestamp") => makeIntegerSchema(valueLabel);
|
|
603
|
-
var makeUrlSchema = (valueLabel = "Value") => import_v4.
|
|
646
|
+
var makeUrlSchema = (valueLabel = "Value") => import_v4.z.url({
|
|
604
647
|
error: `${valueLabel} must be a valid URL string (e.g., http://localhost:8080 or https://example.com).`,
|
|
605
648
|
abort: true
|
|
606
649
|
}).transform((v) => new URL(v));
|
|
607
650
|
var makeBlockNumberSchema = (valueLabel = "Block number") => makeNonNegativeIntegerSchema(valueLabel);
|
|
608
|
-
var makeBlockrangeSchema = (valueLabel = "Value") => import_v4.
|
|
651
|
+
var makeBlockrangeSchema = (valueLabel = "Value") => import_v4.z.strictObject(
|
|
609
652
|
{
|
|
610
653
|
startBlock: makeBlockNumberSchema(`${valueLabel}.startBlock`).optional(),
|
|
611
654
|
endBlock: makeBlockNumberSchema(`${valueLabel}.endBlock`).optional()
|
|
@@ -622,7 +665,7 @@ var makeBlockrangeSchema = (valueLabel = "Value") => import_v4.default.strictObj
|
|
|
622
665
|
},
|
|
623
666
|
{ error: `${valueLabel}: startBlock must be before or equal to endBlock` }
|
|
624
667
|
);
|
|
625
|
-
var makeBlockRefSchema = (valueLabel = "Value") => import_v4.
|
|
668
|
+
var makeBlockRefSchema = (valueLabel = "Value") => import_v4.z.strictObject(
|
|
626
669
|
{
|
|
627
670
|
timestamp: makeUnixTimestampSchema(`${valueLabel}.timestamp`),
|
|
628
671
|
number: makeBlockNumberSchema(`${valueLabel}.number`)
|
|
@@ -631,35 +674,35 @@ var makeBlockRefSchema = (valueLabel = "Value") => import_v4.default.strictObjec
|
|
|
631
674
|
error: `${valueLabel} must be a valid BlockRef object.`
|
|
632
675
|
}
|
|
633
676
|
);
|
|
634
|
-
var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => import_v4.
|
|
677
|
+
var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => import_v4.z.enum(import_datasources.ENSNamespaceIds, {
|
|
635
678
|
error() {
|
|
636
679
|
return `Invalid ${valueLabel}. Supported ENS namespace IDs are: ${Object.keys(import_datasources.ENSNamespaceIds).join(", ")}`;
|
|
637
680
|
}
|
|
638
681
|
});
|
|
639
|
-
var makePriceAmountSchema = (valueLabel = "Amount") => import_v4.
|
|
682
|
+
var makePriceAmountSchema = (valueLabel = "Amount") => import_v4.z.coerce.bigint({
|
|
640
683
|
error: `${valueLabel} must represent a bigint.`
|
|
641
684
|
}).nonnegative({
|
|
642
685
|
error: `${valueLabel} must not be negative.`
|
|
643
686
|
});
|
|
644
|
-
var makePriceCurrencySchema = (currency, valueLabel = "Price Currency") => import_v4.
|
|
687
|
+
var makePriceCurrencySchema = (currency, valueLabel = "Price Currency") => import_v4.z.strictObject({
|
|
645
688
|
amount: makePriceAmountSchema(`${valueLabel} amount`),
|
|
646
|
-
currency: import_v4.
|
|
689
|
+
currency: import_v4.z.literal(currency, {
|
|
647
690
|
error: `${valueLabel} currency must be set to '${currency}'.`
|
|
648
691
|
})
|
|
649
692
|
});
|
|
650
693
|
var makePriceEthSchema = (valueLabel = "Price ETH") => makePriceCurrencySchema(CurrencyIds.ETH, valueLabel).transform((v) => v);
|
|
651
|
-
var makeAccountIdSchema = (valueLabel = "AccountId") => import_v4.
|
|
694
|
+
var makeAccountIdSchema = (valueLabel = "AccountId") => import_v4.z.strictObject({
|
|
652
695
|
chainId: makeChainIdSchema(`${valueLabel} chain ID`),
|
|
653
696
|
address: makeLowercaseAddressSchema(`${valueLabel} address`)
|
|
654
697
|
});
|
|
655
|
-
var makeAccountIdStringSchema = (valueLabel = "Account ID String") => import_v4.
|
|
698
|
+
var makeAccountIdStringSchema = (valueLabel = "Account ID String") => import_v4.z.coerce.string().transform((v) => {
|
|
656
699
|
const result = new import_caip.AccountId(v);
|
|
657
700
|
return {
|
|
658
701
|
chainId: Number(result.chainId.reference),
|
|
659
702
|
address: result.address
|
|
660
703
|
};
|
|
661
704
|
}).pipe(makeAccountIdSchema(valueLabel));
|
|
662
|
-
var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => import_v4.
|
|
705
|
+
var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => import_v4.z.string().check(function invariant_isHexEncoded(ctx) {
|
|
663
706
|
if (!(0, import_viem8.isHex)(ctx.value)) {
|
|
664
707
|
ctx.issues.push({
|
|
665
708
|
code: "custom",
|
|
@@ -680,7 +723,7 @@ var makeHexStringSchema = (options, valueLabel = "String representation of bytes
|
|
|
680
723
|
});
|
|
681
724
|
var makeNodeSchema = (valueLabel = "Node") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
|
|
682
725
|
var makeTransactionHashSchema = (valueLabel = "Transaction hash") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
|
|
683
|
-
var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_v4.
|
|
726
|
+
var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_v4.z.string().transform((v) => v).check((ctx) => {
|
|
684
727
|
try {
|
|
685
728
|
reinterpretName(ctx.value);
|
|
686
729
|
} catch (error) {
|
|
@@ -943,12 +986,60 @@ var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
|
943
986
|
}
|
|
944
987
|
return contract;
|
|
945
988
|
};
|
|
989
|
+
var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
990
|
+
const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
|
|
991
|
+
return a && accountIdEqual(a, b);
|
|
992
|
+
};
|
|
946
993
|
|
|
947
|
-
// src/shared/
|
|
994
|
+
// src/shared/interpretation/interpret-address.ts
|
|
948
995
|
var import_viem9 = require("viem");
|
|
949
|
-
var
|
|
996
|
+
var interpretAddress = (owner) => (0, import_viem9.isAddressEqual)(import_viem9.zeroAddress, owner) ? null : owner;
|
|
997
|
+
|
|
998
|
+
// src/shared/interpretation/interpret-record-values.ts
|
|
999
|
+
var import_viem10 = require("viem");
|
|
1000
|
+
|
|
1001
|
+
// src/shared/null-bytes.ts
|
|
1002
|
+
var hasNullByte = (value) => value.indexOf("\0") !== -1;
|
|
1003
|
+
var stripNullBytes = (value) => value.replaceAll("\0", "");
|
|
1004
|
+
|
|
1005
|
+
// src/shared/interpretation/interpret-record-values.ts
|
|
1006
|
+
function interpretNameRecordValue(value) {
|
|
1007
|
+
if (value === "") return null;
|
|
1008
|
+
if (!isNormalizedName(value)) return null;
|
|
1009
|
+
return value;
|
|
1010
|
+
}
|
|
1011
|
+
function interpretAddressRecordValue(value) {
|
|
1012
|
+
if (hasNullByte(value)) return null;
|
|
1013
|
+
if (value === "") return null;
|
|
1014
|
+
if (value === "0x") return null;
|
|
1015
|
+
if (!(0, import_viem10.isAddress)(value)) return value;
|
|
1016
|
+
if ((0, import_viem10.isAddressEqual)(value, import_viem10.zeroAddress)) return null;
|
|
1017
|
+
return asLowerCaseAddress(value);
|
|
1018
|
+
}
|
|
1019
|
+
function interpretTextRecordKey(key) {
|
|
1020
|
+
if (hasNullByte(key)) return null;
|
|
1021
|
+
if (key === "") return null;
|
|
1022
|
+
return key;
|
|
1023
|
+
}
|
|
1024
|
+
function interpretTextRecordValue(value) {
|
|
1025
|
+
if (hasNullByte(value)) return null;
|
|
1026
|
+
if (value === "") return null;
|
|
1027
|
+
return value;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// src/shared/interpretation/interpret-tokenid.ts
|
|
1031
|
+
var interpretTokenIdAsLabelHash = (tokenId) => uint256ToHex32(tokenId);
|
|
1032
|
+
var interpretTokenIdAsNode = (tokenId) => uint256ToHex32(tokenId);
|
|
950
1033
|
|
|
951
|
-
// src/shared/interpretation.ts
|
|
1034
|
+
// src/shared/interpretation/interpreted-names-and-labels.ts
|
|
1035
|
+
var import_viem12 = require("viem");
|
|
1036
|
+
var import_ens5 = require("viem/ens");
|
|
1037
|
+
|
|
1038
|
+
// src/shared/labelhash.ts
|
|
1039
|
+
var import_viem11 = require("viem");
|
|
1040
|
+
var labelhashLiteralLabel = (label) => (0, import_viem11.keccak256)((0, import_viem11.stringToBytes)(label));
|
|
1041
|
+
|
|
1042
|
+
// src/shared/interpretation/interpreted-names-and-labels.ts
|
|
952
1043
|
function literalLabelToInterpretedLabel(label) {
|
|
953
1044
|
if (isNormalizedLabel(label)) return label;
|
|
954
1045
|
return encodeLabelHash(labelhashLiteralLabel(label));
|
|
@@ -962,10 +1053,39 @@ function interpretedLabelsToInterpretedName(labels) {
|
|
|
962
1053
|
function literalLabelsToLiteralName(labels) {
|
|
963
1054
|
return labels.join(".");
|
|
964
1055
|
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1056
|
+
function interpretedNameToInterpretedLabels(name) {
|
|
1057
|
+
return name.split(".");
|
|
1058
|
+
}
|
|
1059
|
+
function encodedLabelToLabelhash(label) {
|
|
1060
|
+
if (label.length !== 66) return null;
|
|
1061
|
+
if (label.indexOf("[") !== 0) return null;
|
|
1062
|
+
if (label.indexOf("]") !== 65) return null;
|
|
1063
|
+
const hash = `0x${label.slice(1, 65)}`;
|
|
1064
|
+
if (!(0, import_viem12.isHex)(hash)) return null;
|
|
1065
|
+
return hash;
|
|
1066
|
+
}
|
|
1067
|
+
function isInterpetedLabel(label) {
|
|
1068
|
+
if (label.startsWith("[")) {
|
|
1069
|
+
const labelHash = encodedLabelToLabelhash(label);
|
|
1070
|
+
if (labelHash === null) return false;
|
|
1071
|
+
}
|
|
1072
|
+
return isNormalizedLabel(label);
|
|
1073
|
+
}
|
|
1074
|
+
function isInterpretedName(name) {
|
|
1075
|
+
return name.split(".").every(isInterpetedLabel);
|
|
1076
|
+
}
|
|
1077
|
+
function interpretedNameToLabelHashPath(name) {
|
|
1078
|
+
return interpretedNameToInterpretedLabels(name).map((label) => {
|
|
1079
|
+
if (!isInterpetedLabel(label)) {
|
|
1080
|
+
throw new Error(
|
|
1081
|
+
`Invariant(interpretedNameToLabelHashPath): Expected InterpretedLabel, received '${label}'.`
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
const maybeLabelHash = encodedLabelToLabelhash(label);
|
|
1085
|
+
if (maybeLabelHash !== null) return maybeLabelHash;
|
|
1086
|
+
return (0, import_ens5.labelhash)(label);
|
|
1087
|
+
}).toReversed();
|
|
1088
|
+
}
|
|
969
1089
|
|
|
970
1090
|
// src/shared/numbers.ts
|
|
971
1091
|
function bigIntToNumber(n) {
|
|
@@ -982,6 +1102,14 @@ function bigIntToNumber(n) {
|
|
|
982
1102
|
return Number(n);
|
|
983
1103
|
}
|
|
984
1104
|
|
|
1105
|
+
// src/shared/root-registry.ts
|
|
1106
|
+
var import_datasources4 = require("@ensnode/datasources");
|
|
1107
|
+
var getENSv1Registry = (namespace) => getDatasourceContract(namespace, import_datasources4.DatasourceNames.ENSRoot, "ENSv1Registry");
|
|
1108
|
+
var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(namespace), contract);
|
|
1109
|
+
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace, import_datasources4.DatasourceNames.ENSRoot, "RootRegistry");
|
|
1110
|
+
var getENSv2RootRegistryId = (namespace) => makeRegistryId(getENSv2RootRegistry(namespace));
|
|
1111
|
+
var isENSv2RootRegistry = (namespace, contract) => accountIdEqual(getENSv2RootRegistry(namespace), contract);
|
|
1112
|
+
|
|
985
1113
|
// src/shared/serialize.ts
|
|
986
1114
|
var import_caip2 = require("caip");
|
|
987
1115
|
function serializeChainId(chainId) {
|
|
@@ -1008,6 +1136,23 @@ function formatAccountId(accountId) {
|
|
|
1008
1136
|
address: accountId.address
|
|
1009
1137
|
}).toLowerCase();
|
|
1010
1138
|
}
|
|
1139
|
+
function formatAssetId({
|
|
1140
|
+
assetNamespace,
|
|
1141
|
+
contract: { chainId, address },
|
|
1142
|
+
tokenId
|
|
1143
|
+
}) {
|
|
1144
|
+
return import_caip2.AssetId.format({
|
|
1145
|
+
chainId: { namespace: "eip155", reference: chainId.toString() },
|
|
1146
|
+
assetName: { namespace: assetNamespace, reference: address },
|
|
1147
|
+
tokenId: uint256ToHex32(tokenId)
|
|
1148
|
+
}).toLowerCase();
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// src/shared/types.ts
|
|
1152
|
+
var AssetNamespaces = {
|
|
1153
|
+
ERC721: "erc721",
|
|
1154
|
+
ERC1155: "erc1155"
|
|
1155
|
+
};
|
|
1011
1156
|
|
|
1012
1157
|
// src/shared/url.ts
|
|
1013
1158
|
function isHttpProtocol(url) {
|
|
@@ -1018,7 +1163,7 @@ function isWebSocketProtocol(url) {
|
|
|
1018
1163
|
}
|
|
1019
1164
|
|
|
1020
1165
|
// src/ensindexer/config/is-subgraph-compatible.ts
|
|
1021
|
-
var
|
|
1166
|
+
var import_datasources5 = require("@ensnode/datasources");
|
|
1022
1167
|
|
|
1023
1168
|
// src/ensindexer/config/types.ts
|
|
1024
1169
|
var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
@@ -1029,6 +1174,7 @@ var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
|
1029
1174
|
PluginName2["ProtocolAcceleration"] = "protocol-acceleration";
|
|
1030
1175
|
PluginName2["Registrars"] = "registrars";
|
|
1031
1176
|
PluginName2["TokenScope"] = "tokenscope";
|
|
1177
|
+
PluginName2["ENSv2"] = "ensv2";
|
|
1032
1178
|
return PluginName2;
|
|
1033
1179
|
})(PluginName || {});
|
|
1034
1180
|
|
|
@@ -1037,7 +1183,7 @@ function isSubgraphCompatible(config) {
|
|
|
1037
1183
|
const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
|
|
1038
1184
|
const isSubgraphLabelSet = config.labelSet.labelSetId === "subgraph" && config.labelSet.labelSetVersion === 0;
|
|
1039
1185
|
const isEnsTestEnvLabelSet = config.labelSet.labelSetId === "ens-test-env" && config.labelSet.labelSetVersion === 0;
|
|
1040
|
-
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace ===
|
|
1186
|
+
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === import_datasources5.ENSNamespaceIds.EnsTestEnv && isEnsTestEnvLabelSet;
|
|
1041
1187
|
return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
|
|
1042
1188
|
}
|
|
1043
1189
|
|
|
@@ -1054,26 +1200,26 @@ function invariant_ensDbVersionIsSameAsEnsIndexerVersion(ctx) {
|
|
|
1054
1200
|
}
|
|
1055
1201
|
|
|
1056
1202
|
// src/ensindexer/config/zod-schemas.ts
|
|
1057
|
-
var makeIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => import_v43.
|
|
1203
|
+
var makeIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => import_v43.z.array(makeChainIdSchema(valueLabel), {
|
|
1058
1204
|
error: `${valueLabel} must be an array.`
|
|
1059
1205
|
}).min(1, { error: `${valueLabel} list must include at least one element.` }).transform((v) => new Set(v));
|
|
1060
|
-
var makePluginsListSchema = (valueLabel = "Plugins") => import_v43.
|
|
1206
|
+
var makePluginsListSchema = (valueLabel = "Plugins") => import_v43.z.array(import_v43.z.string(), {
|
|
1061
1207
|
error: `${valueLabel} must be a list of strings.`
|
|
1062
1208
|
}).min(1, {
|
|
1063
1209
|
error: `${valueLabel} must be a list of strings with at least one string value`
|
|
1064
1210
|
}).refine((arr) => arr.length === uniq(arr).length, {
|
|
1065
1211
|
error: `${valueLabel} cannot contain duplicate values.`
|
|
1066
1212
|
});
|
|
1067
|
-
var makeDatabaseSchemaNameSchema = (valueLabel = "Database schema name") => import_v43.
|
|
1213
|
+
var makeDatabaseSchemaNameSchema = (valueLabel = "Database schema name") => import_v43.z.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
|
|
1068
1214
|
error: `${valueLabel} is required and must be a non-empty string.`
|
|
1069
1215
|
});
|
|
1070
1216
|
var makeLabelSetIdSchema = (valueLabel) => {
|
|
1071
|
-
return import_v43.
|
|
1217
|
+
return import_v43.z.string({ error: `${valueLabel} must be a string` }).min(1, { error: `${valueLabel} must be 1-50 characters long` }).max(50, { error: `${valueLabel} must be 1-50 characters long` }).regex(/^[a-z-]+$/, {
|
|
1072
1218
|
error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
|
|
1073
1219
|
});
|
|
1074
1220
|
};
|
|
1075
1221
|
var makeLabelSetVersionSchema = (valueLabel) => {
|
|
1076
|
-
return import_v43.
|
|
1222
|
+
return import_v43.z.coerce.number({ error: `${valueLabel} must be an integer.` }).pipe(makeNonNegativeIntegerSchema(valueLabel));
|
|
1077
1223
|
};
|
|
1078
1224
|
var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
|
|
1079
1225
|
let valueLabelLabelSetId = valueLabel;
|
|
@@ -1085,13 +1231,13 @@ var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
|
|
|
1085
1231
|
valueLabelLabelSetId = `${valueLabel}.labelSetId`;
|
|
1086
1232
|
valueLabelLabelSetVersion = `${valueLabel}.labelSetVersion`;
|
|
1087
1233
|
}
|
|
1088
|
-
return import_v43.
|
|
1234
|
+
return import_v43.z.object({
|
|
1089
1235
|
labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
|
|
1090
1236
|
labelSetVersion: makeLabelSetVersionSchema(valueLabelLabelSetVersion)
|
|
1091
1237
|
});
|
|
1092
1238
|
};
|
|
1093
|
-
var makeNonEmptyStringSchema = (valueLabel = "Value") => import_v43.
|
|
1094
|
-
var makeENSIndexerVersionInfoSchema = (valueLabel = "Value") => import_v43.
|
|
1239
|
+
var makeNonEmptyStringSchema = (valueLabel = "Value") => import_v43.z.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
|
|
1240
|
+
var makeENSIndexerVersionInfoSchema = (valueLabel = "Value") => import_v43.z.strictObject(
|
|
1095
1241
|
{
|
|
1096
1242
|
nodejs: makeNonEmptyStringSchema(),
|
|
1097
1243
|
ponder: makeNonEmptyStringSchema(),
|
|
@@ -1115,30 +1261,39 @@ function invariant_isSubgraphCompatibleRequirements(ctx) {
|
|
|
1115
1261
|
});
|
|
1116
1262
|
}
|
|
1117
1263
|
}
|
|
1118
|
-
var makeENSIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => import_v43.
|
|
1264
|
+
var makeENSIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => import_v43.z.object({
|
|
1119
1265
|
labelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.labelSet`),
|
|
1120
1266
|
indexedChainIds: makeIndexedChainIdsSchema(`${valueLabel}.indexedChainIds`),
|
|
1121
|
-
isSubgraphCompatible: import_v43.
|
|
1267
|
+
isSubgraphCompatible: import_v43.z.boolean({ error: `${valueLabel}.isSubgraphCompatible` }),
|
|
1122
1268
|
namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
|
|
1123
1269
|
plugins: makePluginsListSchema(`${valueLabel}.plugins`),
|
|
1124
1270
|
databaseSchemaName: makeDatabaseSchemaNameSchema(`${valueLabel}.databaseSchemaName`),
|
|
1125
1271
|
versionInfo: makeENSIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
|
|
1126
1272
|
}).check(invariant_isSubgraphCompatibleRequirements);
|
|
1127
1273
|
|
|
1128
|
-
// src/
|
|
1274
|
+
// src/shared/config/thegraph.ts
|
|
1275
|
+
var import_v44 = require("zod/v4");
|
|
1129
1276
|
var TheGraphCannotFallbackReasonSchema = import_v44.z.enum({
|
|
1130
1277
|
NotSubgraphCompatible: "not-subgraph-compatible",
|
|
1131
1278
|
NoApiKey: "no-api-key",
|
|
1132
1279
|
NoSubgraphUrl: "no-subgraph-url"
|
|
1133
1280
|
});
|
|
1134
|
-
var TheGraphFallbackSchema = import_v44.z.
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1281
|
+
var TheGraphFallbackSchema = import_v44.z.discriminatedUnion("canFallback", [
|
|
1282
|
+
import_v44.z.strictObject({
|
|
1283
|
+
canFallback: import_v44.z.literal(true),
|
|
1284
|
+
url: import_v44.z.string()
|
|
1285
|
+
}),
|
|
1286
|
+
import_v44.z.strictObject({
|
|
1287
|
+
canFallback: import_v44.z.literal(false),
|
|
1288
|
+
reason: TheGraphCannotFallbackReasonSchema
|
|
1289
|
+
})
|
|
1290
|
+
]);
|
|
1291
|
+
|
|
1292
|
+
// src/ensapi/config/zod-schemas.ts
|
|
1138
1293
|
function makeENSApiPublicConfigSchema(valueLabel) {
|
|
1139
1294
|
const label = valueLabel ?? "ENSApiPublicConfig";
|
|
1140
|
-
return
|
|
1141
|
-
version:
|
|
1295
|
+
return import_v45.z.strictObject({
|
|
1296
|
+
version: import_v45.z.string().min(1, `${label}.version must be a non-empty string`),
|
|
1142
1297
|
theGraphFallback: TheGraphFallbackSchema,
|
|
1143
1298
|
ensIndexerPublicConfig: makeENSIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`)
|
|
1144
1299
|
});
|
|
@@ -1150,9 +1305,9 @@ function deserializeENSApiPublicConfig(maybeConfig, valueLabel) {
|
|
|
1150
1305
|
try {
|
|
1151
1306
|
return schema.parse(maybeConfig);
|
|
1152
1307
|
} catch (error) {
|
|
1153
|
-
if (error instanceof
|
|
1308
|
+
if (error instanceof import_v46.ZodError) {
|
|
1154
1309
|
throw new Error(`Cannot deserialize ENSApiPublicConfig:
|
|
1155
|
-
${(0,
|
|
1310
|
+
${(0, import_v46.prettifyError)(error)}
|
|
1156
1311
|
`);
|
|
1157
1312
|
}
|
|
1158
1313
|
throw error;
|
|
@@ -1160,20 +1315,20 @@ ${(0, import_v45.prettifyError)(error)}
|
|
|
1160
1315
|
}
|
|
1161
1316
|
|
|
1162
1317
|
// src/ensindexer/config/deserialize.ts
|
|
1163
|
-
var
|
|
1318
|
+
var import_v47 = require("zod/v4");
|
|
1164
1319
|
function deserializeENSIndexerPublicConfig(maybeConfig, valueLabel) {
|
|
1165
1320
|
const schema = makeENSIndexerPublicConfigSchema(valueLabel);
|
|
1166
1321
|
const parsed = schema.safeParse(maybeConfig);
|
|
1167
1322
|
if (parsed.error) {
|
|
1168
1323
|
throw new Error(`Cannot deserialize ENSIndexerPublicConfig:
|
|
1169
|
-
${(0,
|
|
1324
|
+
${(0, import_v47.prettifyError)(parsed.error)}
|
|
1170
1325
|
`);
|
|
1171
1326
|
}
|
|
1172
1327
|
return parsed.data;
|
|
1173
1328
|
}
|
|
1174
1329
|
|
|
1175
1330
|
// src/ensindexer/config/label-utils.ts
|
|
1176
|
-
var
|
|
1331
|
+
var import_viem13 = require("viem");
|
|
1177
1332
|
function labelHashToBytes(labelHash) {
|
|
1178
1333
|
try {
|
|
1179
1334
|
if (labelHash.length !== 66) {
|
|
@@ -1185,7 +1340,7 @@ function labelHashToBytes(labelHash) {
|
|
|
1185
1340
|
if (!labelHash.startsWith("0x")) {
|
|
1186
1341
|
throw new Error("Labelhash must be 0x-prefixed");
|
|
1187
1342
|
}
|
|
1188
|
-
const bytes = (0,
|
|
1343
|
+
const bytes = (0, import_viem13.hexToBytes)(labelHash);
|
|
1189
1344
|
if (bytes.length !== 32) {
|
|
1190
1345
|
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
1191
1346
|
}
|
|
@@ -1278,10 +1433,10 @@ function serializeENSIndexerPublicConfig(config) {
|
|
|
1278
1433
|
}
|
|
1279
1434
|
|
|
1280
1435
|
// src/ensindexer/indexing-status/deserialize.ts
|
|
1281
|
-
var
|
|
1436
|
+
var import_v49 = require("zod/v4");
|
|
1282
1437
|
|
|
1283
1438
|
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1284
|
-
var
|
|
1439
|
+
var import_v48 = require("zod/v4");
|
|
1285
1440
|
|
|
1286
1441
|
// src/ensindexer/indexing-status/types.ts
|
|
1287
1442
|
var ChainIndexingConfigTypeIds = {
|
|
@@ -1707,7 +1862,7 @@ function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
|
1707
1862
|
ctx.issues.push({
|
|
1708
1863
|
code: "custom",
|
|
1709
1864
|
input: ctx.value,
|
|
1710
|
-
message: `'snapshotTime' must be greater than or equal to
|
|
1865
|
+
message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
|
|
1711
1866
|
});
|
|
1712
1867
|
}
|
|
1713
1868
|
}
|
|
@@ -1737,52 +1892,52 @@ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ct
|
|
|
1737
1892
|
}
|
|
1738
1893
|
|
|
1739
1894
|
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1740
|
-
var makeChainIndexingConfigSchema = (valueLabel = "Value") =>
|
|
1741
|
-
|
|
1742
|
-
configType:
|
|
1895
|
+
var makeChainIndexingConfigSchema = (valueLabel = "Value") => import_v48.z.discriminatedUnion("configType", [
|
|
1896
|
+
import_v48.z.strictObject({
|
|
1897
|
+
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1743
1898
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1744
1899
|
}),
|
|
1745
|
-
|
|
1746
|
-
configType:
|
|
1900
|
+
import_v48.z.strictObject({
|
|
1901
|
+
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1747
1902
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1748
1903
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1749
1904
|
})
|
|
1750
1905
|
]);
|
|
1751
|
-
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") =>
|
|
1752
|
-
chainStatus:
|
|
1906
|
+
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v48.z.strictObject({
|
|
1907
|
+
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Queued),
|
|
1753
1908
|
config: makeChainIndexingConfigSchema(valueLabel)
|
|
1754
1909
|
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1755
|
-
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") =>
|
|
1756
|
-
chainStatus:
|
|
1910
|
+
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v48.z.strictObject({
|
|
1911
|
+
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Backfill),
|
|
1757
1912
|
config: makeChainIndexingConfigSchema(valueLabel),
|
|
1758
1913
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1759
1914
|
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1760
1915
|
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1761
|
-
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") =>
|
|
1762
|
-
chainStatus:
|
|
1763
|
-
config:
|
|
1764
|
-
configType:
|
|
1916
|
+
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v48.z.strictObject({
|
|
1917
|
+
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Completed),
|
|
1918
|
+
config: import_v48.z.strictObject({
|
|
1919
|
+
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Definite),
|
|
1765
1920
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1766
1921
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1767
1922
|
}),
|
|
1768
1923
|
latestIndexedBlock: makeBlockRefSchema(valueLabel)
|
|
1769
1924
|
}).check(invariant_chainSnapshotCompletedBlocks);
|
|
1770
|
-
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") =>
|
|
1771
|
-
chainStatus:
|
|
1772
|
-
config:
|
|
1773
|
-
configType:
|
|
1925
|
+
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v48.z.strictObject({
|
|
1926
|
+
chainStatus: import_v48.z.literal(ChainIndexingStatusIds.Following),
|
|
1927
|
+
config: import_v48.z.strictObject({
|
|
1928
|
+
configType: import_v48.z.literal(ChainIndexingConfigTypeIds.Indefinite),
|
|
1774
1929
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1775
1930
|
}),
|
|
1776
1931
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1777
1932
|
latestKnownBlock: makeBlockRefSchema(valueLabel)
|
|
1778
1933
|
}).check(invariant_chainSnapshotFollowingBlocks);
|
|
1779
|
-
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") =>
|
|
1934
|
+
var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => import_v48.z.discriminatedUnion("chainStatus", [
|
|
1780
1935
|
makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
|
|
1781
1936
|
makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1782
1937
|
makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
1783
1938
|
makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
|
|
1784
1939
|
]);
|
|
1785
|
-
var makeChainIndexingStatusesSchema = (valueLabel = "Value") =>
|
|
1940
|
+
var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v48.z.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
|
|
1786
1941
|
error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
|
|
1787
1942
|
}).transform((serializedChainsIndexingStatus) => {
|
|
1788
1943
|
const chainsIndexingStatus = /* @__PURE__ */ new Map();
|
|
@@ -1791,29 +1946,29 @@ var makeChainIndexingStatusesSchema = (valueLabel = "Value") => import_v47.defau
|
|
|
1791
1946
|
}
|
|
1792
1947
|
return chainsIndexingStatus;
|
|
1793
1948
|
});
|
|
1794
|
-
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) =>
|
|
1795
|
-
omnichainStatus:
|
|
1949
|
+
var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => import_v48.z.strictObject({
|
|
1950
|
+
omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Unstarted),
|
|
1796
1951
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainSnapshotUnstartedHasValidChains).transform((chains) => chains),
|
|
1797
1952
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1798
1953
|
});
|
|
1799
|
-
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) =>
|
|
1800
|
-
omnichainStatus:
|
|
1954
|
+
var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => import_v48.z.strictObject({
|
|
1955
|
+
omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Backfill),
|
|
1801
1956
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotBackfillHasValidChains).transform(
|
|
1802
1957
|
(chains) => chains
|
|
1803
1958
|
),
|
|
1804
1959
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1805
1960
|
});
|
|
1806
|
-
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) =>
|
|
1807
|
-
omnichainStatus:
|
|
1961
|
+
var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => import_v48.z.strictObject({
|
|
1962
|
+
omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Completed),
|
|
1808
1963
|
chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotCompletedHasValidChains).transform((chains) => chains),
|
|
1809
1964
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1810
1965
|
});
|
|
1811
|
-
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) =>
|
|
1812
|
-
omnichainStatus:
|
|
1966
|
+
var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => import_v48.z.strictObject({
|
|
1967
|
+
omnichainStatus: import_v48.z.literal(OmnichainIndexingStatusIds.Following),
|
|
1813
1968
|
chains: makeChainIndexingStatusesSchema(valueLabel),
|
|
1814
1969
|
omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
|
|
1815
1970
|
});
|
|
1816
|
-
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") =>
|
|
1971
|
+
var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => import_v48.z.discriminatedUnion("omnichainStatus", [
|
|
1817
1972
|
makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
|
|
1818
1973
|
makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
|
|
1819
1974
|
makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
|
|
@@ -1821,16 +1976,16 @@ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexin
|
|
|
1821
1976
|
]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
|
|
1822
1977
|
invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
|
|
1823
1978
|
).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
|
|
1824
|
-
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") =>
|
|
1825
|
-
strategy:
|
|
1979
|
+
var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => import_v48.z.strictObject({
|
|
1980
|
+
strategy: import_v48.z.literal(CrossChainIndexingStrategyIds.Omnichain),
|
|
1826
1981
|
slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
|
|
1827
1982
|
snapshotTime: makeUnixTimestampSchema(valueLabel),
|
|
1828
1983
|
omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
|
|
1829
1984
|
}).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
|
|
1830
|
-
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") =>
|
|
1985
|
+
var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => import_v48.z.discriminatedUnion("strategy", [
|
|
1831
1986
|
makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
|
|
1832
1987
|
]);
|
|
1833
|
-
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") =>
|
|
1988
|
+
var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v48.z.strictObject({
|
|
1834
1989
|
projectedAt: makeUnixTimestampSchema(valueLabel),
|
|
1835
1990
|
worstCaseDistance: makeDurationSchema(valueLabel),
|
|
1836
1991
|
snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
|
|
@@ -1843,7 +1998,7 @@ function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
|
1843
1998
|
if (parsed.error) {
|
|
1844
1999
|
throw new Error(
|
|
1845
2000
|
`Cannot deserialize into ChainIndexingStatusSnapshot:
|
|
1846
|
-
${(0,
|
|
2001
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1847
2002
|
`
|
|
1848
2003
|
);
|
|
1849
2004
|
}
|
|
@@ -1855,7 +2010,7 @@ function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
|
|
|
1855
2010
|
if (parsed.error) {
|
|
1856
2011
|
throw new Error(
|
|
1857
2012
|
`Cannot deserialize into OmnichainIndexingStatusSnapshot:
|
|
1858
|
-
${(0,
|
|
2013
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1859
2014
|
`
|
|
1860
2015
|
);
|
|
1861
2016
|
}
|
|
@@ -1867,7 +2022,7 @@ function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel)
|
|
|
1867
2022
|
if (parsed.error) {
|
|
1868
2023
|
throw new Error(
|
|
1869
2024
|
`Cannot deserialize into CrossChainIndexingStatusSnapshot:
|
|
1870
|
-
${(0,
|
|
2025
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1871
2026
|
`
|
|
1872
2027
|
);
|
|
1873
2028
|
}
|
|
@@ -1879,7 +2034,7 @@ function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel
|
|
|
1879
2034
|
if (parsed.error) {
|
|
1880
2035
|
throw new Error(
|
|
1881
2036
|
`Cannot deserialize into RealtimeIndexingStatusProjection:
|
|
1882
|
-
${(0,
|
|
2037
|
+
${(0, import_v49.prettifyError)(parsed.error)}
|
|
1883
2038
|
`
|
|
1884
2039
|
);
|
|
1885
2040
|
}
|
|
@@ -1975,10 +2130,10 @@ function serializeConfigResponse(response) {
|
|
|
1975
2130
|
}
|
|
1976
2131
|
|
|
1977
2132
|
// src/api/indexing-status/deserialize.ts
|
|
1978
|
-
var
|
|
2133
|
+
var import_v411 = require("zod/v4");
|
|
1979
2134
|
|
|
1980
2135
|
// src/api/indexing-status/zod-schemas.ts
|
|
1981
|
-
var
|
|
2136
|
+
var import_v410 = __toESM(require("zod/v4"), 1);
|
|
1982
2137
|
|
|
1983
2138
|
// src/api/indexing-status/response.ts
|
|
1984
2139
|
var IndexingStatusResponseCodes = {
|
|
@@ -1993,14 +2148,14 @@ var IndexingStatusResponseCodes = {
|
|
|
1993
2148
|
};
|
|
1994
2149
|
|
|
1995
2150
|
// src/api/indexing-status/zod-schemas.ts
|
|
1996
|
-
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") =>
|
|
1997
|
-
responseCode:
|
|
2151
|
+
var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v410.default.strictObject({
|
|
2152
|
+
responseCode: import_v410.default.literal(IndexingStatusResponseCodes.Ok),
|
|
1998
2153
|
realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
|
|
1999
2154
|
});
|
|
2000
|
-
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") =>
|
|
2001
|
-
responseCode:
|
|
2155
|
+
var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v410.default.strictObject({
|
|
2156
|
+
responseCode: import_v410.default.literal(IndexingStatusResponseCodes.Error)
|
|
2002
2157
|
});
|
|
2003
|
-
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") =>
|
|
2158
|
+
var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v410.default.discriminatedUnion("responseCode", [
|
|
2004
2159
|
makeIndexingStatusResponseOkSchema(valueLabel),
|
|
2005
2160
|
makeIndexingStatusResponseErrorSchema(valueLabel)
|
|
2006
2161
|
]);
|
|
@@ -2010,7 +2165,7 @@ function deserializeIndexingStatusResponse(maybeResponse) {
|
|
|
2010
2165
|
const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
|
|
2011
2166
|
if (parsed.error) {
|
|
2012
2167
|
throw new Error(`Cannot deserialize IndexingStatusResponse:
|
|
2013
|
-
${(0,
|
|
2168
|
+
${(0, import_v411.prettifyError)(parsed.error)}
|
|
2014
2169
|
`);
|
|
2015
2170
|
}
|
|
2016
2171
|
return parsed.data;
|
|
@@ -2030,25 +2185,24 @@ function serializeIndexingStatusResponse(response) {
|
|
|
2030
2185
|
}
|
|
2031
2186
|
|
|
2032
2187
|
// src/api/name-tokens/deserialize.ts
|
|
2033
|
-
var
|
|
2188
|
+
var import_v416 = require("zod/v4");
|
|
2034
2189
|
|
|
2035
2190
|
// src/api/name-tokens/zod-schemas.ts
|
|
2036
|
-
var
|
|
2037
|
-
var
|
|
2191
|
+
var import_viem17 = require("viem");
|
|
2192
|
+
var import_v415 = __toESM(require("zod/v4"), 1);
|
|
2038
2193
|
|
|
2039
2194
|
// src/tokenscope/assets.ts
|
|
2040
|
-
var
|
|
2041
|
-
var
|
|
2042
|
-
var import_v412 = require("zod/v4");
|
|
2195
|
+
var import_viem16 = require("viem");
|
|
2196
|
+
var import_v413 = require("zod/v4");
|
|
2043
2197
|
|
|
2044
2198
|
// src/tokenscope/zod-schemas.ts
|
|
2045
2199
|
var import_caip3 = require("caip");
|
|
2046
|
-
var
|
|
2047
|
-
var
|
|
2200
|
+
var import_viem15 = require("viem");
|
|
2201
|
+
var import_v412 = __toESM(require("zod/v4"), 1);
|
|
2048
2202
|
|
|
2049
2203
|
// src/tokenscope/name-token.ts
|
|
2050
|
-
var
|
|
2051
|
-
var
|
|
2204
|
+
var import_viem14 = require("viem");
|
|
2205
|
+
var import_datasources6 = require("@ensnode/datasources");
|
|
2052
2206
|
var NameTokenOwnershipTypes = {
|
|
2053
2207
|
/**
|
|
2054
2208
|
* Name Token is owned by NameWrapper account.
|
|
@@ -2079,12 +2233,12 @@ function serializeNameToken(nameToken) {
|
|
|
2079
2233
|
function getNameWrapperAccounts(namespaceId) {
|
|
2080
2234
|
const ethnamesNameWrapperAccount = getDatasourceContract(
|
|
2081
2235
|
namespaceId,
|
|
2082
|
-
|
|
2236
|
+
import_datasources6.DatasourceNames.ENSRoot,
|
|
2083
2237
|
"NameWrapper"
|
|
2084
2238
|
);
|
|
2085
2239
|
const lineanamesNameWrapperAccount = maybeGetDatasourceContract(
|
|
2086
2240
|
namespaceId,
|
|
2087
|
-
|
|
2241
|
+
import_datasources6.DatasourceNames.Lineanames,
|
|
2088
2242
|
"NameWrapper"
|
|
2089
2243
|
);
|
|
2090
2244
|
const nameWrapperAccounts = [
|
|
@@ -2107,7 +2261,7 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2107
2261
|
owner
|
|
2108
2262
|
};
|
|
2109
2263
|
}
|
|
2110
|
-
if ((0,
|
|
2264
|
+
if ((0, import_viem14.isAddressEqual)(owner.address, import_viem14.zeroAddress)) {
|
|
2111
2265
|
return {
|
|
2112
2266
|
ownershipType: NameTokenOwnershipTypes.Burned,
|
|
2113
2267
|
owner
|
|
@@ -2127,12 +2281,26 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2127
2281
|
}
|
|
2128
2282
|
|
|
2129
2283
|
// src/tokenscope/zod-schemas.ts
|
|
2130
|
-
var
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2284
|
+
var tokenIdSchemaSerializable = import_v412.default.string();
|
|
2285
|
+
var tokenIdSchemaNative = import_v412.default.preprocess(
|
|
2286
|
+
(v) => typeof v === "string" ? BigInt(v) : v,
|
|
2287
|
+
import_v412.default.bigint().positive()
|
|
2288
|
+
);
|
|
2289
|
+
function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
|
|
2290
|
+
if (serializable) {
|
|
2291
|
+
return tokenIdSchemaSerializable;
|
|
2292
|
+
} else {
|
|
2293
|
+
return tokenIdSchemaNative;
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
2297
|
+
return import_v412.default.object({
|
|
2298
|
+
assetNamespace: import_v412.default.enum(AssetNamespaces),
|
|
2299
|
+
contract: makeAccountIdSchema(valueLabel),
|
|
2300
|
+
tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
|
|
2301
|
+
});
|
|
2302
|
+
};
|
|
2303
|
+
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_v412.default.preprocess((v) => {
|
|
2136
2304
|
if (typeof v === "string") {
|
|
2137
2305
|
const result = new import_caip3.AssetId(v);
|
|
2138
2306
|
return {
|
|
@@ -2148,7 +2316,7 @@ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_
|
|
|
2148
2316
|
}, makeAssetIdSchema(valueLabel));
|
|
2149
2317
|
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
2150
2318
|
const ownership = ctx.value;
|
|
2151
|
-
if (ctx.value.owner.address ===
|
|
2319
|
+
if (ctx.value.owner.address === import_viem15.zeroAddress) {
|
|
2152
2320
|
ctx.issues.push({
|
|
2153
2321
|
code: "custom",
|
|
2154
2322
|
input: ctx.value,
|
|
@@ -2156,25 +2324,25 @@ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
|
2156
2324
|
});
|
|
2157
2325
|
}
|
|
2158
2326
|
}
|
|
2159
|
-
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") =>
|
|
2160
|
-
ownershipType:
|
|
2327
|
+
var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => import_v412.default.object({
|
|
2328
|
+
ownershipType: import_v412.default.literal(NameTokenOwnershipTypes.NameWrapper),
|
|
2161
2329
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2162
2330
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2163
|
-
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") =>
|
|
2164
|
-
ownershipType:
|
|
2331
|
+
var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => import_v412.default.object({
|
|
2332
|
+
ownershipType: import_v412.default.literal(NameTokenOwnershipTypes.FullyOnchain),
|
|
2165
2333
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2166
2334
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2167
|
-
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") =>
|
|
2168
|
-
ownershipType:
|
|
2335
|
+
var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => import_v412.default.object({
|
|
2336
|
+
ownershipType: import_v412.default.literal(NameTokenOwnershipTypes.Burned),
|
|
2169
2337
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2170
2338
|
}).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
|
|
2171
|
-
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") =>
|
|
2172
|
-
ownershipType:
|
|
2339
|
+
var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => import_v412.default.object({
|
|
2340
|
+
ownershipType: import_v412.default.literal(NameTokenOwnershipTypes.Unknown),
|
|
2173
2341
|
owner: makeAccountIdSchema(`${valueLabel}.owner`)
|
|
2174
2342
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2175
2343
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
2176
2344
|
const ownership = ctx.value;
|
|
2177
|
-
if (ctx.value.owner.address !==
|
|
2345
|
+
if (ctx.value.owner.address !== import_viem15.zeroAddress) {
|
|
2178
2346
|
ctx.issues.push({
|
|
2179
2347
|
code: "custom",
|
|
2180
2348
|
input: ctx.value,
|
|
@@ -2182,23 +2350,19 @@ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
|
2182
2350
|
});
|
|
2183
2351
|
}
|
|
2184
2352
|
}
|
|
2185
|
-
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") =>
|
|
2353
|
+
var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => import_v412.default.discriminatedUnion("ownershipType", [
|
|
2186
2354
|
makeNameTokenOwnershipNameWrapperSchema(valueLabel),
|
|
2187
2355
|
makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
|
|
2188
2356
|
makeNameTokenOwnershipBurnedSchema(valueLabel),
|
|
2189
2357
|
makeNameTokenOwnershipUnknownSchema(valueLabel)
|
|
2190
2358
|
]);
|
|
2191
|
-
var makeNameTokenSchema = (valueLabel = "Name Token Schema") =>
|
|
2192
|
-
token: makeAssetIdSchema(`${valueLabel}.token
|
|
2359
|
+
var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => import_v412.default.object({
|
|
2360
|
+
token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
|
|
2193
2361
|
ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
|
|
2194
|
-
mintStatus:
|
|
2362
|
+
mintStatus: import_v412.default.enum(NFTMintStatuses)
|
|
2195
2363
|
});
|
|
2196
2364
|
|
|
2197
2365
|
// src/tokenscope/assets.ts
|
|
2198
|
-
var AssetNamespaces = {
|
|
2199
|
-
ERC721: "erc721",
|
|
2200
|
-
ERC1155: "erc1155"
|
|
2201
|
-
};
|
|
2202
2366
|
function serializeAssetId(assetId) {
|
|
2203
2367
|
return {
|
|
2204
2368
|
assetNamespace: assetId.assetNamespace,
|
|
@@ -2211,25 +2375,17 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
|
|
|
2211
2375
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2212
2376
|
if (parsed.error) {
|
|
2213
2377
|
throw new RangeError(`Cannot deserialize AssetId:
|
|
2214
|
-
${(0,
|
|
2378
|
+
${(0, import_v413.prettifyError)(parsed.error)}
|
|
2215
2379
|
`);
|
|
2216
2380
|
}
|
|
2217
2381
|
return parsed.data;
|
|
2218
2382
|
}
|
|
2219
|
-
function formatAssetId(assetId) {
|
|
2220
|
-
const { assetNamespace, contract, tokenId } = serializeAssetId(assetId);
|
|
2221
|
-
return import_caip4.AssetId.format({
|
|
2222
|
-
chainId: { namespace: "eip155", reference: contract.chainId.toString() },
|
|
2223
|
-
assetName: { namespace: assetNamespace, reference: contract.address },
|
|
2224
|
-
tokenId
|
|
2225
|
-
}).toLowerCase();
|
|
2226
|
-
}
|
|
2227
2383
|
function parseAssetId(maybeAssetId, valueLabel) {
|
|
2228
2384
|
const schema = makeAssetIdStringSchema(valueLabel);
|
|
2229
2385
|
const parsed = schema.safeParse(maybeAssetId);
|
|
2230
2386
|
if (parsed.error) {
|
|
2231
2387
|
throw new RangeError(`Cannot parse AssetId:
|
|
2232
|
-
${(0,
|
|
2388
|
+
${(0, import_v413.prettifyError)(parsed.error)}
|
|
2233
2389
|
`);
|
|
2234
2390
|
}
|
|
2235
2391
|
return parsed.data;
|
|
@@ -2252,13 +2408,13 @@ var NFTMintStatuses = {
|
|
|
2252
2408
|
Burned: "burned"
|
|
2253
2409
|
};
|
|
2254
2410
|
var formatNFTTransferEventMetadata = (metadata) => {
|
|
2255
|
-
const
|
|
2411
|
+
const assetIdString = formatAssetId(metadata.nft);
|
|
2256
2412
|
return [
|
|
2257
2413
|
`Event: ${metadata.eventHandlerName}`,
|
|
2258
2414
|
`Chain ID: ${metadata.chainId}`,
|
|
2259
2415
|
`Block Number: ${metadata.blockNumber}`,
|
|
2260
2416
|
`Transaction Hash: ${metadata.transactionHash}`,
|
|
2261
|
-
`NFT: ${
|
|
2417
|
+
`NFT: ${assetIdString}`
|
|
2262
2418
|
].map((line) => ` - ${line}`).join("\n");
|
|
2263
2419
|
};
|
|
2264
2420
|
var NFTTransferTypes = {
|
|
@@ -2364,11 +2520,11 @@ var NFTTransferTypes = {
|
|
|
2364
2520
|
};
|
|
2365
2521
|
var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
|
|
2366
2522
|
const isIndexed = currentlyIndexedOwner !== void 0;
|
|
2367
|
-
const isIndexedAsMinted = isIndexed && !(0,
|
|
2368
|
-
const isMint = (0,
|
|
2369
|
-
const isBurn = (0,
|
|
2370
|
-
const isSelfTransfer = (0,
|
|
2371
|
-
if (isIndexed && !(0,
|
|
2523
|
+
const isIndexedAsMinted = isIndexed && !(0, import_viem16.isAddressEqual)(currentlyIndexedOwner, import_viem16.zeroAddress);
|
|
2524
|
+
const isMint = (0, import_viem16.isAddressEqual)(from, import_viem16.zeroAddress);
|
|
2525
|
+
const isBurn = (0, import_viem16.isAddressEqual)(to, import_viem16.zeroAddress);
|
|
2526
|
+
const isSelfTransfer = (0, import_viem16.isAddressEqual)(from, to);
|
|
2527
|
+
if (isIndexed && !(0, import_viem16.isAddressEqual)(currentlyIndexedOwner, from)) {
|
|
2372
2528
|
if (isMint && allowMintedRemint) {
|
|
2373
2529
|
} else {
|
|
2374
2530
|
throw new Error(
|
|
@@ -2451,10 +2607,10 @@ ${formatNFTTransferEventMetadata(metadata)}`
|
|
|
2451
2607
|
};
|
|
2452
2608
|
|
|
2453
2609
|
// src/api/shared/errors/zod-schemas.ts
|
|
2454
|
-
var
|
|
2455
|
-
var ErrorResponseSchema =
|
|
2456
|
-
message:
|
|
2457
|
-
details:
|
|
2610
|
+
var import_v414 = __toESM(require("zod/v4"), 1);
|
|
2611
|
+
var ErrorResponseSchema = import_v414.default.object({
|
|
2612
|
+
message: import_v414.default.string(),
|
|
2613
|
+
details: import_v414.default.optional(import_v414.default.unknown())
|
|
2458
2614
|
});
|
|
2459
2615
|
|
|
2460
2616
|
// src/api/name-tokens/response.ts
|
|
@@ -2493,33 +2649,39 @@ var NameTokensResponseErrorCodes = {
|
|
|
2493
2649
|
};
|
|
2494
2650
|
|
|
2495
2651
|
// src/api/name-tokens/zod-schemas.ts
|
|
2496
|
-
|
|
2652
|
+
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => import_v415.default.object({
|
|
2653
|
+
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2654
|
+
name: makeReinterpretedNameSchema(valueLabel),
|
|
2655
|
+
tokens: import_v415.default.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
|
|
2656
|
+
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2657
|
+
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2658
|
+
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
2497
2659
|
const { name, domainId } = ctx.value;
|
|
2498
|
-
if ((0,
|
|
2660
|
+
if ((0, import_viem17.namehash)(name) !== domainId) {
|
|
2499
2661
|
ctx.issues.push({
|
|
2500
2662
|
code: "custom",
|
|
2501
2663
|
input: ctx.value,
|
|
2502
2664
|
message: `'name' must be associated with 'domainId': ${domainId}`
|
|
2503
2665
|
});
|
|
2504
2666
|
}
|
|
2505
|
-
}
|
|
2506
|
-
function invariant_nameTokensOwnershipTypeNameWrapperRequiresOwnershipTypeFullyOnchainOrUnknown(ctx) {
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2667
|
+
}).check(
|
|
2668
|
+
function invariant_nameTokensOwnershipTypeNameWrapperRequiresOwnershipTypeFullyOnchainOrUnknown(ctx) {
|
|
2669
|
+
const { tokens } = ctx.value;
|
|
2670
|
+
const containsOwnershipNameWrapper = tokens.some(
|
|
2671
|
+
(t) => t.ownership.ownershipType === NameTokenOwnershipTypes.NameWrapper
|
|
2672
|
+
);
|
|
2673
|
+
const containsOwnershipFullyOnchainOrUnknown = tokens.some(
|
|
2674
|
+
(t) => t.ownership.ownershipType === NameTokenOwnershipTypes.FullyOnchain || t.ownership.ownershipType === NameTokenOwnershipTypes.Unknown
|
|
2675
|
+
);
|
|
2676
|
+
if (containsOwnershipNameWrapper && !containsOwnershipFullyOnchainOrUnknown) {
|
|
2677
|
+
ctx.issues.push({
|
|
2678
|
+
code: "custom",
|
|
2679
|
+
input: ctx.value,
|
|
2680
|
+
message: `'tokens' must contain name token with ownership type 'fully-onchain' or 'unknown' when name token with ownership type 'namewrapper' in listed`
|
|
2681
|
+
});
|
|
2682
|
+
}
|
|
2520
2683
|
}
|
|
2521
|
-
|
|
2522
|
-
function invariant_nameTokensContainAtMostOneWithOwnershipTypeEffective(ctx) {
|
|
2684
|
+
).check(function invariant_nameTokensContainAtMostOneWithOwnershipTypeEffective(ctx) {
|
|
2523
2685
|
const { tokens } = ctx.value;
|
|
2524
2686
|
const tokensCountWithOwnershipFullyOnchain = tokens.filter(
|
|
2525
2687
|
(t) => t.ownership.ownershipType === NameTokenOwnershipTypes.FullyOnchain
|
|
@@ -2531,49 +2693,46 @@ function invariant_nameTokensContainAtMostOneWithOwnershipTypeEffective(ctx) {
|
|
|
2531
2693
|
message: `'tokens' must contain at most one name token with ownership type 'fully-onchain', current count: ${tokensCountWithOwnershipFullyOnchain}`
|
|
2532
2694
|
});
|
|
2533
2695
|
}
|
|
2534
|
-
}
|
|
2535
|
-
var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token") => import_v414.default.object({
|
|
2536
|
-
domainId: makeNodeSchema(`${valueLabel}.domainId`),
|
|
2537
|
-
name: makeReinterpretedNameSchema(valueLabel),
|
|
2538
|
-
tokens: import_v414.default.array(makeNameTokenSchema(`${valueLabel}.tokens`)).nonempty(),
|
|
2539
|
-
expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
|
|
2540
|
-
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2541
|
-
}).check(invariant_nameIsAssociatedWithDomainId).check(invariant_nameTokensContainAtMostOneWithOwnershipTypeEffective).check(invariant_nameTokensOwnershipTypeNameWrapperRequiresOwnershipTypeFullyOnchainOrUnknown);
|
|
2542
|
-
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK") => import_v414.default.strictObject({
|
|
2543
|
-
responseCode: import_v414.default.literal(NameTokensResponseCodes.Ok),
|
|
2544
|
-
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`)
|
|
2545
2696
|
});
|
|
2546
|
-
var
|
|
2547
|
-
responseCode:
|
|
2548
|
-
|
|
2697
|
+
var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => import_v415.default.strictObject({
|
|
2698
|
+
responseCode: import_v415.default.literal(NameTokensResponseCodes.Ok),
|
|
2699
|
+
registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
|
|
2700
|
+
});
|
|
2701
|
+
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v415.default.strictObject({
|
|
2702
|
+
responseCode: import_v415.default.literal(NameTokensResponseCodes.Error),
|
|
2703
|
+
errorCode: import_v415.default.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2549
2704
|
error: ErrorResponseSchema
|
|
2550
2705
|
});
|
|
2551
|
-
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") =>
|
|
2552
|
-
responseCode:
|
|
2553
|
-
errorCode:
|
|
2706
|
+
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v415.default.strictObject({
|
|
2707
|
+
responseCode: import_v415.default.literal(NameTokensResponseCodes.Error),
|
|
2708
|
+
errorCode: import_v415.default.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2554
2709
|
error: ErrorResponseSchema
|
|
2555
2710
|
});
|
|
2556
|
-
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") =>
|
|
2557
|
-
responseCode:
|
|
2558
|
-
errorCode:
|
|
2711
|
+
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v415.default.strictObject({
|
|
2712
|
+
responseCode: import_v415.default.literal(NameTokensResponseCodes.Error),
|
|
2713
|
+
errorCode: import_v415.default.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2559
2714
|
error: ErrorResponseSchema
|
|
2560
2715
|
});
|
|
2561
|
-
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") =>
|
|
2716
|
+
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v415.default.discriminatedUnion("errorCode", [
|
|
2562
2717
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
2563
2718
|
makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
|
|
2564
2719
|
makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
|
|
2565
2720
|
]);
|
|
2566
|
-
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response") =>
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2721
|
+
var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
|
|
2722
|
+
return import_v415.default.discriminatedUnion("responseCode", [
|
|
2723
|
+
makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
|
|
2724
|
+
makeNameTokensResponseErrorSchema(valueLabel)
|
|
2725
|
+
]);
|
|
2726
|
+
};
|
|
2570
2727
|
|
|
2571
2728
|
// src/api/name-tokens/deserialize.ts
|
|
2572
2729
|
function deserializedNameTokensResponse(maybeResponse) {
|
|
2573
|
-
const parsed = makeNameTokensResponseSchema().safeParse(
|
|
2730
|
+
const parsed = makeNameTokensResponseSchema("Name Tokens Response", false).safeParse(
|
|
2731
|
+
maybeResponse
|
|
2732
|
+
);
|
|
2574
2733
|
if (parsed.error) {
|
|
2575
2734
|
throw new Error(`Cannot deserialize NameTokensResponse:
|
|
2576
|
-
${(0,
|
|
2735
|
+
${(0, import_v416.prettifyError)(parsed.error)}
|
|
2577
2736
|
`);
|
|
2578
2737
|
}
|
|
2579
2738
|
return parsed.data;
|
|
@@ -2647,40 +2806,40 @@ function serializeNameTokensResponse(response) {
|
|
|
2647
2806
|
}
|
|
2648
2807
|
|
|
2649
2808
|
// src/api/registrar-actions/deserialize.ts
|
|
2650
|
-
var
|
|
2809
|
+
var import_v420 = require("zod/v4");
|
|
2651
2810
|
|
|
2652
2811
|
// src/api/registrar-actions/zod-schemas.ts
|
|
2653
|
-
var
|
|
2654
|
-
var
|
|
2812
|
+
var import_ens10 = require("viem/ens");
|
|
2813
|
+
var import_v419 = __toESM(require("zod/v4"), 1);
|
|
2655
2814
|
|
|
2656
2815
|
// ../ens-referrals/src/address.ts
|
|
2657
|
-
var
|
|
2816
|
+
var import_viem18 = require("viem");
|
|
2658
2817
|
|
|
2659
2818
|
// ../ens-referrals/src/encoding.ts
|
|
2660
|
-
var
|
|
2819
|
+
var import_viem19 = require("viem");
|
|
2661
2820
|
var ENCODED_REFERRER_BYTE_OFFSET = 12;
|
|
2662
2821
|
var ENCODED_REFERRER_BYTE_LENGTH = 32;
|
|
2663
|
-
var EXPECTED_ENCODED_REFERRER_PADDING = (0,
|
|
2822
|
+
var EXPECTED_ENCODED_REFERRER_PADDING = (0, import_viem19.pad)("0x", {
|
|
2664
2823
|
size: ENCODED_REFERRER_BYTE_OFFSET,
|
|
2665
2824
|
dir: "left"
|
|
2666
2825
|
});
|
|
2667
|
-
var ZERO_ENCODED_REFERRER = (0,
|
|
2826
|
+
var ZERO_ENCODED_REFERRER = (0, import_viem19.pad)("0x", {
|
|
2668
2827
|
size: ENCODED_REFERRER_BYTE_LENGTH,
|
|
2669
2828
|
dir: "left"
|
|
2670
2829
|
});
|
|
2671
2830
|
function decodeEncodedReferrer(encodedReferrer) {
|
|
2672
|
-
if ((0,
|
|
2831
|
+
if ((0, import_viem19.size)(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
|
|
2673
2832
|
throw new Error(
|
|
2674
2833
|
`Encoded referrer value must be represented by ${ENCODED_REFERRER_BYTE_LENGTH} bytes.`
|
|
2675
2834
|
);
|
|
2676
2835
|
}
|
|
2677
|
-
const padding = (0,
|
|
2836
|
+
const padding = (0, import_viem19.slice)(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2678
2837
|
if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) {
|
|
2679
|
-
return
|
|
2838
|
+
return import_viem19.zeroAddress;
|
|
2680
2839
|
}
|
|
2681
|
-
const decodedReferrer = (0,
|
|
2840
|
+
const decodedReferrer = (0, import_viem19.slice)(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2682
2841
|
try {
|
|
2683
|
-
return (0,
|
|
2842
|
+
return (0, import_viem19.getAddress)(decodedReferrer);
|
|
2684
2843
|
} catch {
|
|
2685
2844
|
throw new Error(`Decoded referrer value must be a valid EVM address.`);
|
|
2686
2845
|
}
|
|
@@ -2690,7 +2849,7 @@ function decodeEncodedReferrer(encodedReferrer) {
|
|
|
2690
2849
|
var REFERRERS_PER_LEADERBOARD_PAGE_MAX = 100;
|
|
2691
2850
|
|
|
2692
2851
|
// ../ens-referrals/src/link.ts
|
|
2693
|
-
var
|
|
2852
|
+
var import_viem20 = require("viem");
|
|
2694
2853
|
|
|
2695
2854
|
// ../ens-referrals/src/referrer-detail.ts
|
|
2696
2855
|
var ReferrerDetailTypeIds = {
|
|
@@ -2705,7 +2864,7 @@ var ReferrerDetailTypeIds = {
|
|
|
2705
2864
|
};
|
|
2706
2865
|
|
|
2707
2866
|
// src/registrars/zod-schemas.ts
|
|
2708
|
-
var
|
|
2867
|
+
var import_v417 = require("zod/v4");
|
|
2709
2868
|
|
|
2710
2869
|
// src/registrars/registrar-action.ts
|
|
2711
2870
|
var RegistrarActionTypes = {
|
|
@@ -2746,11 +2905,11 @@ function serializeRegistrarAction(registrarAction) {
|
|
|
2746
2905
|
}
|
|
2747
2906
|
|
|
2748
2907
|
// src/registrars/zod-schemas.ts
|
|
2749
|
-
var makeSubregistrySchema = (valueLabel = "Subregistry") =>
|
|
2908
|
+
var makeSubregistrySchema = (valueLabel = "Subregistry") => import_v417.z.object({
|
|
2750
2909
|
subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
|
|
2751
2910
|
node: makeNodeSchema(`${valueLabel} Node`)
|
|
2752
2911
|
});
|
|
2753
|
-
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") =>
|
|
2912
|
+
var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => import_v417.z.object({
|
|
2754
2913
|
subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
|
|
2755
2914
|
node: makeNodeSchema(`${valueLabel} Node`),
|
|
2756
2915
|
expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
|
|
@@ -2766,18 +2925,18 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
|
|
|
2766
2925
|
});
|
|
2767
2926
|
}
|
|
2768
2927
|
}
|
|
2769
|
-
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") =>
|
|
2928
|
+
var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => import_v417.z.union([
|
|
2770
2929
|
// pricing available
|
|
2771
|
-
|
|
2930
|
+
import_v417.z.object({
|
|
2772
2931
|
baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
|
|
2773
2932
|
premium: makePriceEthSchema(`${valueLabel} Premium`),
|
|
2774
2933
|
total: makePriceEthSchema(`${valueLabel} Total`)
|
|
2775
2934
|
}).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
|
|
2776
2935
|
// pricing unknown
|
|
2777
|
-
|
|
2778
|
-
baseCost:
|
|
2779
|
-
premium:
|
|
2780
|
-
total:
|
|
2936
|
+
import_v417.z.object({
|
|
2937
|
+
baseCost: import_v417.z.null(),
|
|
2938
|
+
premium: import_v417.z.null(),
|
|
2939
|
+
total: import_v417.z.null()
|
|
2781
2940
|
}).transform((v) => v)
|
|
2782
2941
|
]);
|
|
2783
2942
|
function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
@@ -2800,9 +2959,9 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
|
|
|
2800
2959
|
});
|
|
2801
2960
|
}
|
|
2802
2961
|
}
|
|
2803
|
-
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") =>
|
|
2962
|
+
var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => import_v417.z.union([
|
|
2804
2963
|
// referral available
|
|
2805
|
-
|
|
2964
|
+
import_v417.z.object({
|
|
2806
2965
|
encodedReferrer: makeHexStringSchema(
|
|
2807
2966
|
{ bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
|
|
2808
2967
|
`${valueLabel} Encoded Referrer`
|
|
@@ -2810,9 +2969,9 @@ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral
|
|
|
2810
2969
|
decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
|
|
2811
2970
|
}).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
|
|
2812
2971
|
// referral not applicable
|
|
2813
|
-
|
|
2814
|
-
encodedReferrer:
|
|
2815
|
-
decodedReferrer:
|
|
2972
|
+
import_v417.z.object({
|
|
2973
|
+
encodedReferrer: import_v417.z.null(),
|
|
2974
|
+
decodedReferrer: import_v417.z.null()
|
|
2816
2975
|
})
|
|
2817
2976
|
]);
|
|
2818
2977
|
function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
@@ -2825,9 +2984,9 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
2825
2984
|
});
|
|
2826
2985
|
}
|
|
2827
2986
|
}
|
|
2828
|
-
var EventIdSchema =
|
|
2829
|
-
var EventIdsSchema =
|
|
2830
|
-
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") =>
|
|
2987
|
+
var EventIdSchema = import_v417.z.string().nonempty();
|
|
2988
|
+
var EventIdsSchema = import_v417.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
2989
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => import_v417.z.object({
|
|
2831
2990
|
id: EventIdSchema,
|
|
2832
2991
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
2833
2992
|
registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
|
|
@@ -2841,38 +3000,38 @@ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => im
|
|
|
2841
3000
|
eventIds: EventIdsSchema
|
|
2842
3001
|
}).check(invariant_eventIdsInitialElementIsTheActionId);
|
|
2843
3002
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2844
|
-
type:
|
|
3003
|
+
type: import_v417.z.literal(RegistrarActionTypes.Registration)
|
|
2845
3004
|
});
|
|
2846
3005
|
var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
2847
|
-
type:
|
|
3006
|
+
type: import_v417.z.literal(RegistrarActionTypes.Renewal)
|
|
2848
3007
|
});
|
|
2849
|
-
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") =>
|
|
3008
|
+
var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => import_v417.z.discriminatedUnion("type", [
|
|
2850
3009
|
makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
|
|
2851
3010
|
makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
|
|
2852
3011
|
]);
|
|
2853
3012
|
|
|
2854
3013
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2855
|
-
var
|
|
3014
|
+
var import_v418 = __toESM(require("zod/v4"), 1);
|
|
2856
3015
|
|
|
2857
3016
|
// src/api/shared/pagination/request.ts
|
|
2858
3017
|
var RECORDS_PER_PAGE_DEFAULT = 10;
|
|
2859
3018
|
var RECORDS_PER_PAGE_MAX = 100;
|
|
2860
3019
|
|
|
2861
3020
|
// src/api/shared/pagination/zod-schemas.ts
|
|
2862
|
-
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") =>
|
|
3021
|
+
var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => import_v418.default.object({
|
|
2863
3022
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
2864
3023
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
2865
3024
|
RECORDS_PER_PAGE_MAX,
|
|
2866
3025
|
`${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
|
|
2867
3026
|
)
|
|
2868
3027
|
});
|
|
2869
|
-
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") =>
|
|
2870
|
-
totalRecords:
|
|
2871
|
-
totalPages:
|
|
2872
|
-
hasNext:
|
|
2873
|
-
hasPrev:
|
|
2874
|
-
startIndex:
|
|
2875
|
-
endIndex:
|
|
3028
|
+
var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => import_v418.default.object({
|
|
3029
|
+
totalRecords: import_v418.default.literal(0),
|
|
3030
|
+
totalPages: import_v418.default.literal(1),
|
|
3031
|
+
hasNext: import_v418.default.literal(false),
|
|
3032
|
+
hasPrev: import_v418.default.literal(false),
|
|
3033
|
+
startIndex: import_v418.default.undefined(),
|
|
3034
|
+
endIndex: import_v418.default.undefined()
|
|
2876
3035
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
2877
3036
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
2878
3037
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -2907,15 +3066,15 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
|
2907
3066
|
});
|
|
2908
3067
|
}
|
|
2909
3068
|
}
|
|
2910
|
-
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") =>
|
|
3069
|
+
var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => import_v418.default.object({
|
|
2911
3070
|
totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
|
|
2912
3071
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
2913
|
-
hasNext:
|
|
2914
|
-
hasPrev:
|
|
3072
|
+
hasNext: import_v418.default.boolean(),
|
|
3073
|
+
hasPrev: import_v418.default.boolean(),
|
|
2915
3074
|
startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
|
|
2916
3075
|
endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
|
|
2917
3076
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
|
|
2918
|
-
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") =>
|
|
3077
|
+
var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => import_v418.default.union([
|
|
2919
3078
|
makeResponsePageContextSchemaWithNoRecords(valueLabel),
|
|
2920
3079
|
makeResponsePageContextSchemaWithRecords(valueLabel)
|
|
2921
3080
|
]);
|
|
@@ -2936,7 +3095,7 @@ var RegistrarActionsResponseCodes = {
|
|
|
2936
3095
|
function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
2937
3096
|
const { name, action } = ctx.value;
|
|
2938
3097
|
const expectedNode = action.registrationLifecycle.node;
|
|
2939
|
-
const actualNode = (0,
|
|
3098
|
+
const actualNode = (0, import_ens10.namehash)(name);
|
|
2940
3099
|
if (actualNode !== expectedNode) {
|
|
2941
3100
|
ctx.issues.push({
|
|
2942
3101
|
code: "custom",
|
|
@@ -2945,20 +3104,21 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
|
|
|
2945
3104
|
});
|
|
2946
3105
|
}
|
|
2947
3106
|
}
|
|
2948
|
-
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") =>
|
|
3107
|
+
var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => import_v419.default.object({
|
|
2949
3108
|
action: makeRegistrarActionSchema(valueLabel),
|
|
2950
3109
|
name: makeReinterpretedNameSchema(valueLabel)
|
|
2951
3110
|
}).check(invariant_registrationLifecycleNodeMatchesName);
|
|
2952
|
-
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") =>
|
|
2953
|
-
responseCode:
|
|
2954
|
-
registrarActions:
|
|
2955
|
-
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`)
|
|
3111
|
+
var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => import_v419.default.object({
|
|
3112
|
+
responseCode: import_v419.default.literal(RegistrarActionsResponseCodes.Ok),
|
|
3113
|
+
registrarActions: import_v419.default.array(makeNamedRegistrarActionSchema(valueLabel)),
|
|
3114
|
+
pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
|
|
3115
|
+
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
|
|
2956
3116
|
});
|
|
2957
|
-
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") =>
|
|
2958
|
-
responseCode:
|
|
3117
|
+
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v419.default.strictObject({
|
|
3118
|
+
responseCode: import_v419.default.literal(RegistrarActionsResponseCodes.Error),
|
|
2959
3119
|
error: ErrorResponseSchema
|
|
2960
3120
|
});
|
|
2961
|
-
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") =>
|
|
3121
|
+
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v419.default.discriminatedUnion("responseCode", [
|
|
2962
3122
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
2963
3123
|
makeRegistrarActionsResponseErrorSchema(valueLabel)
|
|
2964
3124
|
]);
|
|
@@ -2969,7 +3129,7 @@ function deserializeRegistrarActionsResponse(maybeResponse) {
|
|
|
2969
3129
|
if (parsed.error) {
|
|
2970
3130
|
throw new Error(
|
|
2971
3131
|
`Cannot deserialize RegistrarActionsResponse:
|
|
2972
|
-
${(0,
|
|
3132
|
+
${(0, import_v420.prettifyError)(parsed.error)}
|
|
2973
3133
|
`
|
|
2974
3134
|
);
|
|
2975
3135
|
}
|
|
@@ -2980,7 +3140,9 @@ ${(0, import_v419.prettifyError)(parsed.error)}
|
|
|
2980
3140
|
var RegistrarActionsFilterTypes = {
|
|
2981
3141
|
BySubregistryNode: "bySubregistryNode",
|
|
2982
3142
|
WithEncodedReferral: "withEncodedReferral",
|
|
2983
|
-
ByDecodedReferrer: "byDecodedReferrer"
|
|
3143
|
+
ByDecodedReferrer: "byDecodedReferrer",
|
|
3144
|
+
BeginTimestamp: "beginTimestamp",
|
|
3145
|
+
EndTimestamp: "endTimestamp"
|
|
2984
3146
|
};
|
|
2985
3147
|
var RegistrarActionsOrders = {
|
|
2986
3148
|
LatestRegistrarActions: "orderBy[timestamp]=desc"
|
|
@@ -3013,10 +3175,30 @@ function byDecodedReferrer(decodedReferrer) {
|
|
|
3013
3175
|
value: decodedReferrer
|
|
3014
3176
|
};
|
|
3015
3177
|
}
|
|
3178
|
+
function beginTimestamp(timestamp) {
|
|
3179
|
+
if (typeof timestamp === "undefined") {
|
|
3180
|
+
return void 0;
|
|
3181
|
+
}
|
|
3182
|
+
return {
|
|
3183
|
+
filterType: RegistrarActionsFilterTypes.BeginTimestamp,
|
|
3184
|
+
value: timestamp
|
|
3185
|
+
};
|
|
3186
|
+
}
|
|
3187
|
+
function endTimestamp(timestamp) {
|
|
3188
|
+
if (typeof timestamp === "undefined") {
|
|
3189
|
+
return void 0;
|
|
3190
|
+
}
|
|
3191
|
+
return {
|
|
3192
|
+
filterType: RegistrarActionsFilterTypes.EndTimestamp,
|
|
3193
|
+
value: timestamp
|
|
3194
|
+
};
|
|
3195
|
+
}
|
|
3016
3196
|
var registrarActionsFilter = {
|
|
3017
3197
|
byParentNode,
|
|
3018
3198
|
withReferral,
|
|
3019
|
-
byDecodedReferrer
|
|
3199
|
+
byDecodedReferrer,
|
|
3200
|
+
beginTimestamp,
|
|
3201
|
+
endTimestamp
|
|
3020
3202
|
};
|
|
3021
3203
|
|
|
3022
3204
|
// src/api/registrar-actions/prerequisites.ts
|
|
@@ -3070,11 +3252,11 @@ var registrarActionsPrerequisites = Object.freeze({
|
|
|
3070
3252
|
});
|
|
3071
3253
|
|
|
3072
3254
|
// src/registrars/basenames-subregistry.ts
|
|
3073
|
-
var
|
|
3255
|
+
var import_datasources7 = require("@ensnode/datasources");
|
|
3074
3256
|
function getBasenamesSubregistryId(namespace) {
|
|
3075
|
-
const datasource = (0,
|
|
3257
|
+
const datasource = (0, import_datasources7.maybeGetDatasource)(namespace, import_datasources7.DatasourceNames.Basenames);
|
|
3076
3258
|
if (!datasource) {
|
|
3077
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
3259
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources7.DatasourceNames.Basenames}`);
|
|
3078
3260
|
}
|
|
3079
3261
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3080
3262
|
if (address === void 0 || Array.isArray(address)) {
|
|
@@ -3087,12 +3269,11 @@ function getBasenamesSubregistryId(namespace) {
|
|
|
3087
3269
|
}
|
|
3088
3270
|
function getBasenamesSubregistryManagedName(namespaceId) {
|
|
3089
3271
|
switch (namespaceId) {
|
|
3090
|
-
case
|
|
3272
|
+
case import_datasources7.ENSNamespaceIds.Mainnet:
|
|
3091
3273
|
return "base.eth";
|
|
3092
|
-
case
|
|
3274
|
+
case import_datasources7.ENSNamespaceIds.Sepolia:
|
|
3093
3275
|
return "basetest.eth";
|
|
3094
|
-
case
|
|
3095
|
-
case import_datasources6.ENSNamespaceIds.EnsTestEnv:
|
|
3276
|
+
case import_datasources7.ENSNamespaceIds.EnsTestEnv:
|
|
3096
3277
|
throw new Error(
|
|
3097
3278
|
`No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
|
|
3098
3279
|
);
|
|
@@ -3100,11 +3281,11 @@ function getBasenamesSubregistryManagedName(namespaceId) {
|
|
|
3100
3281
|
}
|
|
3101
3282
|
|
|
3102
3283
|
// src/registrars/ethnames-subregistry.ts
|
|
3103
|
-
var
|
|
3284
|
+
var import_datasources8 = require("@ensnode/datasources");
|
|
3104
3285
|
function getEthnamesSubregistryId(namespace) {
|
|
3105
|
-
const datasource = (0,
|
|
3286
|
+
const datasource = (0, import_datasources8.maybeGetDatasource)(namespace, import_datasources8.DatasourceNames.ENSRoot);
|
|
3106
3287
|
if (!datasource) {
|
|
3107
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
3288
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources8.DatasourceNames.ENSRoot}`);
|
|
3108
3289
|
}
|
|
3109
3290
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3110
3291
|
if (address === void 0 || Array.isArray(address)) {
|
|
@@ -3117,20 +3298,19 @@ function getEthnamesSubregistryId(namespace) {
|
|
|
3117
3298
|
}
|
|
3118
3299
|
function getEthnamesSubregistryManagedName(namespaceId) {
|
|
3119
3300
|
switch (namespaceId) {
|
|
3120
|
-
case
|
|
3121
|
-
case
|
|
3122
|
-
case
|
|
3123
|
-
case import_datasources7.ENSNamespaceIds.EnsTestEnv:
|
|
3301
|
+
case import_datasources8.ENSNamespaceIds.Mainnet:
|
|
3302
|
+
case import_datasources8.ENSNamespaceIds.Sepolia:
|
|
3303
|
+
case import_datasources8.ENSNamespaceIds.EnsTestEnv:
|
|
3124
3304
|
return "eth";
|
|
3125
3305
|
}
|
|
3126
3306
|
}
|
|
3127
3307
|
|
|
3128
3308
|
// src/registrars/lineanames-subregistry.ts
|
|
3129
|
-
var
|
|
3309
|
+
var import_datasources9 = require("@ensnode/datasources");
|
|
3130
3310
|
function getLineanamesSubregistryId(namespace) {
|
|
3131
|
-
const datasource = (0,
|
|
3311
|
+
const datasource = (0, import_datasources9.maybeGetDatasource)(namespace, import_datasources9.DatasourceNames.Lineanames);
|
|
3132
3312
|
if (!datasource) {
|
|
3133
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
3313
|
+
throw new Error(`Datasource not found for ${namespace} ${import_datasources9.DatasourceNames.Lineanames}`);
|
|
3134
3314
|
}
|
|
3135
3315
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
3136
3316
|
if (address === void 0 || Array.isArray(address)) {
|
|
@@ -3143,18 +3323,32 @@ function getLineanamesSubregistryId(namespace) {
|
|
|
3143
3323
|
}
|
|
3144
3324
|
function getLineanamesSubregistryManagedName(namespaceId) {
|
|
3145
3325
|
switch (namespaceId) {
|
|
3146
|
-
case
|
|
3326
|
+
case import_datasources9.ENSNamespaceIds.Mainnet:
|
|
3147
3327
|
return "linea.eth";
|
|
3148
|
-
case
|
|
3328
|
+
case import_datasources9.ENSNamespaceIds.Sepolia:
|
|
3149
3329
|
return "linea-sepolia.eth";
|
|
3150
|
-
case
|
|
3151
|
-
case import_datasources8.ENSNamespaceIds.EnsTestEnv:
|
|
3330
|
+
case import_datasources9.ENSNamespaceIds.EnsTestEnv:
|
|
3152
3331
|
throw new Error(
|
|
3153
3332
|
`No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
|
|
3154
3333
|
);
|
|
3155
3334
|
}
|
|
3156
3335
|
}
|
|
3157
3336
|
|
|
3337
|
+
// src/registrars/registration-expiration.ts
|
|
3338
|
+
function isRegistrationExpired(info, now) {
|
|
3339
|
+
if (info.expiry == null) return false;
|
|
3340
|
+
return info.expiry <= now;
|
|
3341
|
+
}
|
|
3342
|
+
function isRegistrationFullyExpired(info, now) {
|
|
3343
|
+
if (info.expiry == null) return false;
|
|
3344
|
+
return now >= info.expiry + (info.gracePeriod ?? 0n);
|
|
3345
|
+
}
|
|
3346
|
+
function isRegistrationInGracePeriod(info, now) {
|
|
3347
|
+
if (info.expiry == null) return false;
|
|
3348
|
+
if (info.gracePeriod == null) return false;
|
|
3349
|
+
return info.expiry <= now && info.expiry + info.gracePeriod > now;
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3158
3352
|
// src/api/registrar-actions/serialize.ts
|
|
3159
3353
|
function serializeNamedRegistrarAction({
|
|
3160
3354
|
action,
|
|
@@ -3171,7 +3365,8 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3171
3365
|
return {
|
|
3172
3366
|
responseCode: response.responseCode,
|
|
3173
3367
|
registrarActions: response.registrarActions.map(serializeNamedRegistrarAction),
|
|
3174
|
-
pageContext: response.pageContext
|
|
3368
|
+
pageContext: response.pageContext,
|
|
3369
|
+
accurateAsOf: response.accurateAsOf
|
|
3175
3370
|
};
|
|
3176
3371
|
case RegistrarActionsResponseCodes.Error:
|
|
3177
3372
|
return response;
|
|
@@ -3179,12 +3374,12 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3179
3374
|
}
|
|
3180
3375
|
|
|
3181
3376
|
// src/api/shared/errors/deserialize.ts
|
|
3182
|
-
var
|
|
3377
|
+
var import_v421 = require("zod/v4");
|
|
3183
3378
|
function deserializeErrorResponse(maybeErrorResponse) {
|
|
3184
3379
|
const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
|
|
3185
3380
|
if (parsed.error) {
|
|
3186
3381
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3187
|
-
${(0,
|
|
3382
|
+
${(0, import_v421.prettifyError)(parsed.error)}
|
|
3188
3383
|
`);
|
|
3189
3384
|
}
|
|
3190
3385
|
return parsed.data;
|
|
@@ -3239,10 +3434,10 @@ var ClientError = class _ClientError extends Error {
|
|
|
3239
3434
|
};
|
|
3240
3435
|
|
|
3241
3436
|
// src/ensanalytics/deserialize.ts
|
|
3242
|
-
var
|
|
3437
|
+
var import_v423 = require("zod/v4");
|
|
3243
3438
|
|
|
3244
3439
|
// src/ensanalytics/zod-schemas.ts
|
|
3245
|
-
var
|
|
3440
|
+
var import_v422 = __toESM(require("zod/v4"), 1);
|
|
3246
3441
|
|
|
3247
3442
|
// src/ensanalytics/types.ts
|
|
3248
3443
|
var ReferrerLeaderboardPageResponseCodes = {
|
|
@@ -3267,20 +3462,28 @@ var ReferrerDetailResponseCodes = {
|
|
|
3267
3462
|
};
|
|
3268
3463
|
|
|
3269
3464
|
// src/ensanalytics/zod-schemas.ts
|
|
3270
|
-
var
|
|
3465
|
+
var makeRevenueContributionSchema = (valueLabel = "RevenueContribution") => import_v422.default.coerce.bigint({
|
|
3466
|
+
error: `${valueLabel} must represent a bigint.`
|
|
3467
|
+
}).nonnegative({
|
|
3468
|
+
error: `${valueLabel} must not be negative.`
|
|
3469
|
+
});
|
|
3470
|
+
var makeReferralProgramRulesSchema = (valueLabel = "ReferralProgramRules") => import_v422.default.object({
|
|
3271
3471
|
totalAwardPoolValue: makeFiniteNonNegativeNumberSchema(`${valueLabel}.totalAwardPoolValue`),
|
|
3272
3472
|
maxQualifiedReferrers: makeNonNegativeIntegerSchema(`${valueLabel}.maxQualifiedReferrers`),
|
|
3273
3473
|
startTime: makeUnixTimestampSchema(`${valueLabel}.startTime`),
|
|
3274
3474
|
endTime: makeUnixTimestampSchema(`${valueLabel}.endTime`),
|
|
3275
3475
|
subregistryId: makeAccountIdSchema(`${valueLabel}.subregistryId`)
|
|
3276
3476
|
});
|
|
3277
|
-
var makeAwardedReferrerMetricsSchema = (valueLabel = "AwardedReferrerMetrics") =>
|
|
3477
|
+
var makeAwardedReferrerMetricsSchema = (valueLabel = "AwardedReferrerMetrics") => import_v422.default.object({
|
|
3278
3478
|
referrer: makeLowercaseAddressSchema(`${valueLabel}.referrer`),
|
|
3279
3479
|
totalReferrals: makeNonNegativeIntegerSchema(`${valueLabel}.totalReferrals`),
|
|
3280
3480
|
totalIncrementalDuration: makeDurationSchema(`${valueLabel}.totalIncrementalDuration`),
|
|
3481
|
+
totalRevenueContribution: makeRevenueContributionSchema(
|
|
3482
|
+
`${valueLabel}.totalRevenueContribution`
|
|
3483
|
+
),
|
|
3281
3484
|
score: makeFiniteNonNegativeNumberSchema(`${valueLabel}.score`),
|
|
3282
3485
|
rank: makePositiveIntegerSchema(`${valueLabel}.rank`),
|
|
3283
|
-
isQualified:
|
|
3486
|
+
isQualified: import_v422.default.boolean(),
|
|
3284
3487
|
finalScoreBoost: makeFiniteNonNegativeNumberSchema(`${valueLabel}.finalScoreBoost`).max(
|
|
3285
3488
|
1,
|
|
3286
3489
|
`${valueLabel}.finalScoreBoost must be <= 1`
|
|
@@ -3292,13 +3495,16 @@ var makeAwardedReferrerMetricsSchema = (valueLabel = "AwardedReferrerMetrics") =
|
|
|
3292
3495
|
),
|
|
3293
3496
|
awardPoolApproxValue: makeFiniteNonNegativeNumberSchema(`${valueLabel}.awardPoolApproxValue`)
|
|
3294
3497
|
});
|
|
3295
|
-
var makeUnrankedReferrerMetricsSchema = (valueLabel = "UnrankedReferrerMetrics") =>
|
|
3498
|
+
var makeUnrankedReferrerMetricsSchema = (valueLabel = "UnrankedReferrerMetrics") => import_v422.default.object({
|
|
3296
3499
|
referrer: makeLowercaseAddressSchema(`${valueLabel}.referrer`),
|
|
3297
3500
|
totalReferrals: makeNonNegativeIntegerSchema(`${valueLabel}.totalReferrals`),
|
|
3298
3501
|
totalIncrementalDuration: makeDurationSchema(`${valueLabel}.totalIncrementalDuration`),
|
|
3502
|
+
totalRevenueContribution: makeRevenueContributionSchema(
|
|
3503
|
+
`${valueLabel}.totalRevenueContribution`
|
|
3504
|
+
),
|
|
3299
3505
|
score: makeFiniteNonNegativeNumberSchema(`${valueLabel}.score`),
|
|
3300
|
-
rank:
|
|
3301
|
-
isQualified:
|
|
3506
|
+
rank: import_v422.default.null(),
|
|
3507
|
+
isQualified: import_v422.default.literal(false),
|
|
3302
3508
|
finalScoreBoost: makeFiniteNonNegativeNumberSchema(`${valueLabel}.finalScoreBoost`).max(
|
|
3303
3509
|
1,
|
|
3304
3510
|
`${valueLabel}.finalScoreBoost must be <= 1`
|
|
@@ -3310,11 +3516,14 @@ var makeUnrankedReferrerMetricsSchema = (valueLabel = "UnrankedReferrerMetrics")
|
|
|
3310
3516
|
),
|
|
3311
3517
|
awardPoolApproxValue: makeFiniteNonNegativeNumberSchema(`${valueLabel}.awardPoolApproxValue`)
|
|
3312
3518
|
});
|
|
3313
|
-
var makeAggregatedReferrerMetricsSchema = (valueLabel = "AggregatedReferrerMetrics") =>
|
|
3519
|
+
var makeAggregatedReferrerMetricsSchema = (valueLabel = "AggregatedReferrerMetrics") => import_v422.default.object({
|
|
3314
3520
|
grandTotalReferrals: makeNonNegativeIntegerSchema(`${valueLabel}.grandTotalReferrals`),
|
|
3315
3521
|
grandTotalIncrementalDuration: makeDurationSchema(
|
|
3316
3522
|
`${valueLabel}.grandTotalIncrementalDuration`
|
|
3317
3523
|
),
|
|
3524
|
+
grandTotalRevenueContribution: makeRevenueContributionSchema(
|
|
3525
|
+
`${valueLabel}.grandTotalRevenueContribution`
|
|
3526
|
+
),
|
|
3318
3527
|
grandTotalQualifiedReferrersFinalScore: makeFiniteNonNegativeNumberSchema(
|
|
3319
3528
|
`${valueLabel}.grandTotalQualifiedReferrersFinalScore`
|
|
3320
3529
|
),
|
|
@@ -3322,7 +3531,7 @@ var makeAggregatedReferrerMetricsSchema = (valueLabel = "AggregatedReferrerMetri
|
|
|
3322
3531
|
`${valueLabel}.minFinalScoreToQualify`
|
|
3323
3532
|
)
|
|
3324
3533
|
});
|
|
3325
|
-
var makeReferrerLeaderboardPageContextSchema = (valueLabel = "ReferrerLeaderboardPageContext") =>
|
|
3534
|
+
var makeReferrerLeaderboardPageContextSchema = (valueLabel = "ReferrerLeaderboardPageContext") => import_v422.default.object({
|
|
3326
3535
|
page: makePositiveIntegerSchema(`${valueLabel}.page`),
|
|
3327
3536
|
recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
|
|
3328
3537
|
REFERRERS_PER_LEADERBOARD_PAGE_MAX,
|
|
@@ -3330,91 +3539,278 @@ var makeReferrerLeaderboardPageContextSchema = (valueLabel = "ReferrerLeaderboar
|
|
|
3330
3539
|
),
|
|
3331
3540
|
totalRecords: makeNonNegativeIntegerSchema(`${valueLabel}.totalRecords`),
|
|
3332
3541
|
totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
|
|
3333
|
-
hasNext:
|
|
3334
|
-
hasPrev:
|
|
3335
|
-
startIndex:
|
|
3336
|
-
endIndex:
|
|
3542
|
+
hasNext: import_v422.default.boolean(),
|
|
3543
|
+
hasPrev: import_v422.default.boolean(),
|
|
3544
|
+
startIndex: import_v422.default.optional(makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`)),
|
|
3545
|
+
endIndex: import_v422.default.optional(makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`))
|
|
3337
3546
|
});
|
|
3338
|
-
var makeReferrerLeaderboardPageSchema = (valueLabel = "ReferrerLeaderboardPage") =>
|
|
3547
|
+
var makeReferrerLeaderboardPageSchema = (valueLabel = "ReferrerLeaderboardPage") => import_v422.default.object({
|
|
3339
3548
|
rules: makeReferralProgramRulesSchema(`${valueLabel}.rules`),
|
|
3340
|
-
referrers:
|
|
3549
|
+
referrers: import_v422.default.array(makeAwardedReferrerMetricsSchema(`${valueLabel}.referrers[record]`)),
|
|
3341
3550
|
aggregatedMetrics: makeAggregatedReferrerMetricsSchema(`${valueLabel}.aggregatedMetrics`),
|
|
3342
3551
|
pageContext: makeReferrerLeaderboardPageContextSchema(`${valueLabel}.pageContext`),
|
|
3343
3552
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
3344
3553
|
});
|
|
3345
|
-
var makeReferrerLeaderboardPageResponseOkSchema = (valueLabel = "ReferrerLeaderboardPageResponseOk") =>
|
|
3346
|
-
responseCode:
|
|
3554
|
+
var makeReferrerLeaderboardPageResponseOkSchema = (valueLabel = "ReferrerLeaderboardPageResponseOk") => import_v422.default.object({
|
|
3555
|
+
responseCode: import_v422.default.literal(ReferrerLeaderboardPageResponseCodes.Ok),
|
|
3347
3556
|
data: makeReferrerLeaderboardPageSchema(`${valueLabel}.data`)
|
|
3348
3557
|
});
|
|
3349
|
-
var makeReferrerLeaderboardPageResponseErrorSchema = (_valueLabel = "ReferrerLeaderboardPageResponseError") =>
|
|
3350
|
-
responseCode:
|
|
3351
|
-
error:
|
|
3352
|
-
errorMessage:
|
|
3558
|
+
var makeReferrerLeaderboardPageResponseErrorSchema = (_valueLabel = "ReferrerLeaderboardPageResponseError") => import_v422.default.object({
|
|
3559
|
+
responseCode: import_v422.default.literal(ReferrerLeaderboardPageResponseCodes.Error),
|
|
3560
|
+
error: import_v422.default.string(),
|
|
3561
|
+
errorMessage: import_v422.default.string()
|
|
3353
3562
|
});
|
|
3354
|
-
var makeReferrerLeaderboardPageResponseSchema = (valueLabel = "ReferrerLeaderboardPageResponse") =>
|
|
3563
|
+
var makeReferrerLeaderboardPageResponseSchema = (valueLabel = "ReferrerLeaderboardPageResponse") => import_v422.default.union([
|
|
3355
3564
|
makeReferrerLeaderboardPageResponseOkSchema(valueLabel),
|
|
3356
3565
|
makeReferrerLeaderboardPageResponseErrorSchema(valueLabel)
|
|
3357
3566
|
]);
|
|
3358
|
-
var makeReferrerDetailRankedSchema = (valueLabel = "ReferrerDetailRanked") =>
|
|
3359
|
-
type:
|
|
3567
|
+
var makeReferrerDetailRankedSchema = (valueLabel = "ReferrerDetailRanked") => import_v422.default.object({
|
|
3568
|
+
type: import_v422.default.literal(ReferrerDetailTypeIds.Ranked),
|
|
3360
3569
|
rules: makeReferralProgramRulesSchema(`${valueLabel}.rules`),
|
|
3361
3570
|
referrer: makeAwardedReferrerMetricsSchema(`${valueLabel}.referrer`),
|
|
3362
3571
|
aggregatedMetrics: makeAggregatedReferrerMetricsSchema(`${valueLabel}.aggregatedMetrics`),
|
|
3363
3572
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
3364
3573
|
});
|
|
3365
|
-
var makeReferrerDetailUnrankedSchema = (valueLabel = "ReferrerDetailUnranked") =>
|
|
3366
|
-
type:
|
|
3574
|
+
var makeReferrerDetailUnrankedSchema = (valueLabel = "ReferrerDetailUnranked") => import_v422.default.object({
|
|
3575
|
+
type: import_v422.default.literal(ReferrerDetailTypeIds.Unranked),
|
|
3367
3576
|
rules: makeReferralProgramRulesSchema(`${valueLabel}.rules`),
|
|
3368
3577
|
referrer: makeUnrankedReferrerMetricsSchema(`${valueLabel}.referrer`),
|
|
3369
3578
|
aggregatedMetrics: makeAggregatedReferrerMetricsSchema(`${valueLabel}.aggregatedMetrics`),
|
|
3370
3579
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
3371
3580
|
});
|
|
3372
|
-
var makeReferrerDetailResponseOkSchema = (valueLabel = "ReferrerDetailResponse") =>
|
|
3373
|
-
responseCode:
|
|
3374
|
-
data:
|
|
3581
|
+
var makeReferrerDetailResponseOkSchema = (valueLabel = "ReferrerDetailResponse") => import_v422.default.object({
|
|
3582
|
+
responseCode: import_v422.default.literal(ReferrerDetailResponseCodes.Ok),
|
|
3583
|
+
data: import_v422.default.union([
|
|
3375
3584
|
makeReferrerDetailRankedSchema(`${valueLabel}.data`),
|
|
3376
3585
|
makeReferrerDetailUnrankedSchema(`${valueLabel}.data`)
|
|
3377
3586
|
])
|
|
3378
3587
|
});
|
|
3379
|
-
var makeReferrerDetailResponseErrorSchema = (_valueLabel = "ReferrerDetailResponse") =>
|
|
3380
|
-
responseCode:
|
|
3381
|
-
error:
|
|
3382
|
-
errorMessage:
|
|
3588
|
+
var makeReferrerDetailResponseErrorSchema = (_valueLabel = "ReferrerDetailResponse") => import_v422.default.object({
|
|
3589
|
+
responseCode: import_v422.default.literal(ReferrerDetailResponseCodes.Error),
|
|
3590
|
+
error: import_v422.default.string(),
|
|
3591
|
+
errorMessage: import_v422.default.string()
|
|
3383
3592
|
});
|
|
3384
|
-
var makeReferrerDetailResponseSchema = (valueLabel = "ReferrerDetailResponse") =>
|
|
3593
|
+
var makeReferrerDetailResponseSchema = (valueLabel = "ReferrerDetailResponse") => import_v422.default.union([
|
|
3385
3594
|
makeReferrerDetailResponseOkSchema(valueLabel),
|
|
3386
3595
|
makeReferrerDetailResponseErrorSchema(valueLabel)
|
|
3387
3596
|
]);
|
|
3388
3597
|
|
|
3389
3598
|
// src/ensanalytics/deserialize.ts
|
|
3599
|
+
function deserializeRevenueContribution(value) {
|
|
3600
|
+
return BigInt(value);
|
|
3601
|
+
}
|
|
3602
|
+
function deserializeReferralProgramRules(rules) {
|
|
3603
|
+
return rules;
|
|
3604
|
+
}
|
|
3605
|
+
function deserializeAwardedReferrerMetrics(metrics) {
|
|
3606
|
+
return {
|
|
3607
|
+
referrer: metrics.referrer,
|
|
3608
|
+
totalReferrals: metrics.totalReferrals,
|
|
3609
|
+
totalIncrementalDuration: metrics.totalIncrementalDuration,
|
|
3610
|
+
totalRevenueContribution: deserializeRevenueContribution(metrics.totalRevenueContribution),
|
|
3611
|
+
score: metrics.score,
|
|
3612
|
+
rank: metrics.rank,
|
|
3613
|
+
isQualified: metrics.isQualified,
|
|
3614
|
+
finalScoreBoost: metrics.finalScoreBoost,
|
|
3615
|
+
finalScore: metrics.finalScore,
|
|
3616
|
+
awardPoolShare: metrics.awardPoolShare,
|
|
3617
|
+
awardPoolApproxValue: metrics.awardPoolApproxValue
|
|
3618
|
+
};
|
|
3619
|
+
}
|
|
3620
|
+
function deserializeUnrankedReferrerMetrics(metrics) {
|
|
3621
|
+
return {
|
|
3622
|
+
referrer: metrics.referrer,
|
|
3623
|
+
totalReferrals: metrics.totalReferrals,
|
|
3624
|
+
totalIncrementalDuration: metrics.totalIncrementalDuration,
|
|
3625
|
+
totalRevenueContribution: deserializeRevenueContribution(metrics.totalRevenueContribution),
|
|
3626
|
+
score: metrics.score,
|
|
3627
|
+
rank: metrics.rank,
|
|
3628
|
+
isQualified: metrics.isQualified,
|
|
3629
|
+
finalScoreBoost: metrics.finalScoreBoost,
|
|
3630
|
+
finalScore: metrics.finalScore,
|
|
3631
|
+
awardPoolShare: metrics.awardPoolShare,
|
|
3632
|
+
awardPoolApproxValue: metrics.awardPoolApproxValue
|
|
3633
|
+
};
|
|
3634
|
+
}
|
|
3635
|
+
function deserializeAggregatedReferrerMetrics(metrics) {
|
|
3636
|
+
return {
|
|
3637
|
+
grandTotalReferrals: metrics.grandTotalReferrals,
|
|
3638
|
+
grandTotalIncrementalDuration: metrics.grandTotalIncrementalDuration,
|
|
3639
|
+
grandTotalRevenueContribution: deserializeRevenueContribution(
|
|
3640
|
+
metrics.grandTotalRevenueContribution
|
|
3641
|
+
),
|
|
3642
|
+
grandTotalQualifiedReferrersFinalScore: metrics.grandTotalQualifiedReferrersFinalScore,
|
|
3643
|
+
minFinalScoreToQualify: metrics.minFinalScoreToQualify
|
|
3644
|
+
};
|
|
3645
|
+
}
|
|
3646
|
+
function deserializeReferrerLeaderboardPage(page) {
|
|
3647
|
+
return {
|
|
3648
|
+
rules: deserializeReferralProgramRules(page.rules),
|
|
3649
|
+
referrers: page.referrers.map(deserializeAwardedReferrerMetrics),
|
|
3650
|
+
aggregatedMetrics: deserializeAggregatedReferrerMetrics(page.aggregatedMetrics),
|
|
3651
|
+
pageContext: page.pageContext,
|
|
3652
|
+
accurateAsOf: page.accurateAsOf
|
|
3653
|
+
};
|
|
3654
|
+
}
|
|
3655
|
+
function deserializeReferrerDetailRanked(detail) {
|
|
3656
|
+
return {
|
|
3657
|
+
type: detail.type,
|
|
3658
|
+
rules: deserializeReferralProgramRules(detail.rules),
|
|
3659
|
+
referrer: deserializeAwardedReferrerMetrics(detail.referrer),
|
|
3660
|
+
aggregatedMetrics: deserializeAggregatedReferrerMetrics(detail.aggregatedMetrics),
|
|
3661
|
+
accurateAsOf: detail.accurateAsOf
|
|
3662
|
+
};
|
|
3663
|
+
}
|
|
3664
|
+
function deserializeReferrerDetailUnranked(detail) {
|
|
3665
|
+
return {
|
|
3666
|
+
type: detail.type,
|
|
3667
|
+
rules: deserializeReferralProgramRules(detail.rules),
|
|
3668
|
+
referrer: deserializeUnrankedReferrerMetrics(detail.referrer),
|
|
3669
|
+
aggregatedMetrics: deserializeAggregatedReferrerMetrics(detail.aggregatedMetrics),
|
|
3670
|
+
accurateAsOf: detail.accurateAsOf
|
|
3671
|
+
};
|
|
3672
|
+
}
|
|
3390
3673
|
function deserializeReferrerLeaderboardPageResponse(maybeResponse, valueLabel) {
|
|
3674
|
+
let deserialized;
|
|
3675
|
+
switch (maybeResponse.responseCode) {
|
|
3676
|
+
case "ok": {
|
|
3677
|
+
deserialized = {
|
|
3678
|
+
responseCode: maybeResponse.responseCode,
|
|
3679
|
+
data: deserializeReferrerLeaderboardPage(maybeResponse.data)
|
|
3680
|
+
};
|
|
3681
|
+
break;
|
|
3682
|
+
}
|
|
3683
|
+
case "error":
|
|
3684
|
+
deserialized = maybeResponse;
|
|
3685
|
+
break;
|
|
3686
|
+
}
|
|
3391
3687
|
const schema = makeReferrerLeaderboardPageResponseSchema(valueLabel);
|
|
3392
|
-
const parsed = schema.safeParse(
|
|
3688
|
+
const parsed = schema.safeParse(deserialized);
|
|
3393
3689
|
if (parsed.error) {
|
|
3394
3690
|
throw new Error(
|
|
3395
3691
|
`Cannot deserialize SerializedReferrerLeaderboardPageResponse:
|
|
3396
|
-
${(0,
|
|
3692
|
+
${(0, import_v423.prettifyError)(parsed.error)}
|
|
3397
3693
|
`
|
|
3398
3694
|
);
|
|
3399
3695
|
}
|
|
3400
3696
|
return parsed.data;
|
|
3401
3697
|
}
|
|
3402
3698
|
function deserializeReferrerDetailResponse(maybeResponse, valueLabel) {
|
|
3699
|
+
let deserialized;
|
|
3700
|
+
switch (maybeResponse.responseCode) {
|
|
3701
|
+
case "ok": {
|
|
3702
|
+
switch (maybeResponse.data.type) {
|
|
3703
|
+
case "ranked":
|
|
3704
|
+
deserialized = {
|
|
3705
|
+
responseCode: maybeResponse.responseCode,
|
|
3706
|
+
data: deserializeReferrerDetailRanked(maybeResponse.data)
|
|
3707
|
+
};
|
|
3708
|
+
break;
|
|
3709
|
+
case "unranked":
|
|
3710
|
+
deserialized = {
|
|
3711
|
+
responseCode: maybeResponse.responseCode,
|
|
3712
|
+
data: deserializeReferrerDetailUnranked(maybeResponse.data)
|
|
3713
|
+
};
|
|
3714
|
+
break;
|
|
3715
|
+
}
|
|
3716
|
+
break;
|
|
3717
|
+
}
|
|
3718
|
+
case "error":
|
|
3719
|
+
deserialized = maybeResponse;
|
|
3720
|
+
break;
|
|
3721
|
+
}
|
|
3403
3722
|
const schema = makeReferrerDetailResponseSchema(valueLabel);
|
|
3404
|
-
const parsed = schema.safeParse(
|
|
3723
|
+
const parsed = schema.safeParse(deserialized);
|
|
3405
3724
|
if (parsed.error) {
|
|
3406
3725
|
throw new Error(`Cannot deserialize ReferrerDetailResponse:
|
|
3407
|
-
${(0,
|
|
3726
|
+
${(0, import_v423.prettifyError)(parsed.error)}
|
|
3408
3727
|
`);
|
|
3409
3728
|
}
|
|
3410
3729
|
return parsed.data;
|
|
3411
3730
|
}
|
|
3412
3731
|
|
|
3413
3732
|
// src/ensanalytics/serialize.ts
|
|
3733
|
+
function serializeRevenueContribution(revenueContribution) {
|
|
3734
|
+
return revenueContribution.toString();
|
|
3735
|
+
}
|
|
3736
|
+
function serializeReferralProgramRules(rules) {
|
|
3737
|
+
return rules;
|
|
3738
|
+
}
|
|
3739
|
+
function serializeAwardedReferrerMetrics(metrics) {
|
|
3740
|
+
return {
|
|
3741
|
+
referrer: metrics.referrer,
|
|
3742
|
+
totalReferrals: metrics.totalReferrals,
|
|
3743
|
+
totalIncrementalDuration: metrics.totalIncrementalDuration,
|
|
3744
|
+
totalRevenueContribution: serializeRevenueContribution(metrics.totalRevenueContribution),
|
|
3745
|
+
score: metrics.score,
|
|
3746
|
+
rank: metrics.rank,
|
|
3747
|
+
isQualified: metrics.isQualified,
|
|
3748
|
+
finalScoreBoost: metrics.finalScoreBoost,
|
|
3749
|
+
finalScore: metrics.finalScore,
|
|
3750
|
+
awardPoolShare: metrics.awardPoolShare,
|
|
3751
|
+
awardPoolApproxValue: metrics.awardPoolApproxValue
|
|
3752
|
+
};
|
|
3753
|
+
}
|
|
3754
|
+
function serializeUnrankedReferrerMetrics(metrics) {
|
|
3755
|
+
return {
|
|
3756
|
+
referrer: metrics.referrer,
|
|
3757
|
+
totalReferrals: metrics.totalReferrals,
|
|
3758
|
+
totalIncrementalDuration: metrics.totalIncrementalDuration,
|
|
3759
|
+
totalRevenueContribution: serializeRevenueContribution(metrics.totalRevenueContribution),
|
|
3760
|
+
score: metrics.score,
|
|
3761
|
+
rank: metrics.rank,
|
|
3762
|
+
isQualified: metrics.isQualified,
|
|
3763
|
+
finalScoreBoost: metrics.finalScoreBoost,
|
|
3764
|
+
finalScore: metrics.finalScore,
|
|
3765
|
+
awardPoolShare: metrics.awardPoolShare,
|
|
3766
|
+
awardPoolApproxValue: metrics.awardPoolApproxValue
|
|
3767
|
+
};
|
|
3768
|
+
}
|
|
3769
|
+
function serializeAggregatedReferrerMetrics(metrics) {
|
|
3770
|
+
return {
|
|
3771
|
+
grandTotalReferrals: metrics.grandTotalReferrals,
|
|
3772
|
+
grandTotalIncrementalDuration: metrics.grandTotalIncrementalDuration,
|
|
3773
|
+
grandTotalRevenueContribution: serializeRevenueContribution(
|
|
3774
|
+
metrics.grandTotalRevenueContribution
|
|
3775
|
+
),
|
|
3776
|
+
grandTotalQualifiedReferrersFinalScore: metrics.grandTotalQualifiedReferrersFinalScore,
|
|
3777
|
+
minFinalScoreToQualify: metrics.minFinalScoreToQualify
|
|
3778
|
+
};
|
|
3779
|
+
}
|
|
3780
|
+
function serializeReferrerLeaderboardPage(page) {
|
|
3781
|
+
return {
|
|
3782
|
+
rules: serializeReferralProgramRules(page.rules),
|
|
3783
|
+
referrers: page.referrers.map(serializeAwardedReferrerMetrics),
|
|
3784
|
+
aggregatedMetrics: serializeAggregatedReferrerMetrics(page.aggregatedMetrics),
|
|
3785
|
+
pageContext: page.pageContext,
|
|
3786
|
+
accurateAsOf: page.accurateAsOf
|
|
3787
|
+
};
|
|
3788
|
+
}
|
|
3789
|
+
function serializeReferrerDetailRanked(detail) {
|
|
3790
|
+
return {
|
|
3791
|
+
type: detail.type,
|
|
3792
|
+
rules: serializeReferralProgramRules(detail.rules),
|
|
3793
|
+
referrer: serializeAwardedReferrerMetrics(detail.referrer),
|
|
3794
|
+
aggregatedMetrics: serializeAggregatedReferrerMetrics(detail.aggregatedMetrics),
|
|
3795
|
+
accurateAsOf: detail.accurateAsOf
|
|
3796
|
+
};
|
|
3797
|
+
}
|
|
3798
|
+
function serializeReferrerDetailUnranked(detail) {
|
|
3799
|
+
return {
|
|
3800
|
+
type: detail.type,
|
|
3801
|
+
rules: serializeReferralProgramRules(detail.rules),
|
|
3802
|
+
referrer: serializeUnrankedReferrerMetrics(detail.referrer),
|
|
3803
|
+
aggregatedMetrics: serializeAggregatedReferrerMetrics(detail.aggregatedMetrics),
|
|
3804
|
+
accurateAsOf: detail.accurateAsOf
|
|
3805
|
+
};
|
|
3806
|
+
}
|
|
3414
3807
|
function serializeReferrerLeaderboardPageResponse(response) {
|
|
3415
3808
|
switch (response.responseCode) {
|
|
3416
3809
|
case ReferrerLeaderboardPageResponseCodes.Ok:
|
|
3417
|
-
return
|
|
3810
|
+
return {
|
|
3811
|
+
responseCode: response.responseCode,
|
|
3812
|
+
data: serializeReferrerLeaderboardPage(response.data)
|
|
3813
|
+
};
|
|
3418
3814
|
case ReferrerLeaderboardPageResponseCodes.Error:
|
|
3419
3815
|
return response;
|
|
3420
3816
|
}
|
|
@@ -3422,7 +3818,19 @@ function serializeReferrerLeaderboardPageResponse(response) {
|
|
|
3422
3818
|
function serializeReferrerDetailResponse(response) {
|
|
3423
3819
|
switch (response.responseCode) {
|
|
3424
3820
|
case ReferrerDetailResponseCodes.Ok:
|
|
3425
|
-
|
|
3821
|
+
switch (response.data.type) {
|
|
3822
|
+
case "ranked":
|
|
3823
|
+
return {
|
|
3824
|
+
responseCode: response.responseCode,
|
|
3825
|
+
data: serializeReferrerDetailRanked(response.data)
|
|
3826
|
+
};
|
|
3827
|
+
case "unranked":
|
|
3828
|
+
return {
|
|
3829
|
+
responseCode: response.responseCode,
|
|
3830
|
+
data: serializeReferrerDetailUnranked(response.data)
|
|
3831
|
+
};
|
|
3832
|
+
}
|
|
3833
|
+
break;
|
|
3426
3834
|
case ReferrerDetailResponseCodes.Error:
|
|
3427
3835
|
return response;
|
|
3428
3836
|
}
|
|
@@ -3854,6 +4262,7 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3854
4262
|
* const { registrarActions, pageContext } = response;
|
|
3855
4263
|
* console.log(registrarActions);
|
|
3856
4264
|
* console.log(`Page ${pageContext.page} of ${pageContext.totalPages}`);
|
|
4265
|
+
* console.log(`Accurate as of: ${response.accurateAsOf}`);
|
|
3857
4266
|
* }
|
|
3858
4267
|
*
|
|
3859
4268
|
* // Get second page with 25 records per page
|
|
@@ -3884,6 +4293,26 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3884
4293
|
* filters: [registrarActionsFilter.byParentNode(namehash('base.eth'))],
|
|
3885
4294
|
* recordsPerPage: 10
|
|
3886
4295
|
* });
|
|
4296
|
+
*
|
|
4297
|
+
* // get registrar actions within a specific time range
|
|
4298
|
+
* const beginTimestamp = 1764547200; // Dec 1, 2025, 00:00:00 UTC
|
|
4299
|
+
* const endTimestamp = 1767225600; // Jan 1, 2026, 00:00:00 UTC
|
|
4300
|
+
* await client.registrarActions({
|
|
4301
|
+
* filters: [
|
|
4302
|
+
* registrarActionsFilter.beginTimestamp(beginTimestamp),
|
|
4303
|
+
* registrarActionsFilter.endTimestamp(endTimestamp),
|
|
4304
|
+
* ],
|
|
4305
|
+
* });
|
|
4306
|
+
*
|
|
4307
|
+
* // get registrar actions from a specific timestamp onwards
|
|
4308
|
+
* await client.registrarActions({
|
|
4309
|
+
* filters: [registrarActionsFilter.beginTimestamp(1764547200)],
|
|
4310
|
+
* });
|
|
4311
|
+
*
|
|
4312
|
+
* // get registrar actions up to a specific timestamp
|
|
4313
|
+
* await client.registrarActions({
|
|
4314
|
+
* filters: [registrarActionsFilter.endTimestamp(1767225600)],
|
|
4315
|
+
* });
|
|
3887
4316
|
* ```
|
|
3888
4317
|
*/
|
|
3889
4318
|
async registrarActions(request = {}) {
|
|
@@ -3905,6 +4334,18 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3905
4334
|
);
|
|
3906
4335
|
return decodedReferrerFilter ? { key: "decodedReferrer", value: decodedReferrerFilter.value } : null;
|
|
3907
4336
|
};
|
|
4337
|
+
const buildBeginTimestampArg = (filters) => {
|
|
4338
|
+
const beginTimestampFilter = filters?.find(
|
|
4339
|
+
(f) => f.filterType === RegistrarActionsFilterTypes.BeginTimestamp
|
|
4340
|
+
);
|
|
4341
|
+
return beginTimestampFilter ? { key: "beginTimestamp", value: beginTimestampFilter.value.toString() } : null;
|
|
4342
|
+
};
|
|
4343
|
+
const buildEndTimestampArg = (filters) => {
|
|
4344
|
+
const endTimestampFilter = filters?.find(
|
|
4345
|
+
(f) => f.filterType === RegistrarActionsFilterTypes.EndTimestamp
|
|
4346
|
+
);
|
|
4347
|
+
return endTimestampFilter ? { key: "endTimestamp", value: endTimestampFilter.value.toString() } : null;
|
|
4348
|
+
};
|
|
3908
4349
|
const buildOrderArg = (order) => {
|
|
3909
4350
|
switch (order) {
|
|
3910
4351
|
case RegistrarActionsOrders.LatestRegistrarActions: {
|
|
@@ -3935,6 +4376,14 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3935
4376
|
if (decodedReferrerArg) {
|
|
3936
4377
|
url.searchParams.set(decodedReferrerArg.key, decodedReferrerArg.value);
|
|
3937
4378
|
}
|
|
4379
|
+
const beginTimestampArg = buildBeginTimestampArg(request.filters);
|
|
4380
|
+
if (beginTimestampArg) {
|
|
4381
|
+
url.searchParams.set(beginTimestampArg.key, beginTimestampArg.value);
|
|
4382
|
+
}
|
|
4383
|
+
const endTimestampArg = buildEndTimestampArg(request.filters);
|
|
4384
|
+
if (endTimestampArg) {
|
|
4385
|
+
url.searchParams.set(endTimestampArg.key, endTimestampArg.value);
|
|
4386
|
+
}
|
|
3938
4387
|
const response = await fetch(url);
|
|
3939
4388
|
let responseData;
|
|
3940
4389
|
try {
|
|
@@ -3988,7 +4437,7 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3988
4437
|
const url = new URL(`/api/name-tokens`, this.options.url);
|
|
3989
4438
|
if (request.name !== void 0) {
|
|
3990
4439
|
url.searchParams.set("name", request.name);
|
|
3991
|
-
} else {
|
|
4440
|
+
} else if (request.domainId !== void 0) {
|
|
3992
4441
|
url.searchParams.set("domainId", request.domainId);
|
|
3993
4442
|
}
|
|
3994
4443
|
const response = await fetch(url);
|
|
@@ -4013,8 +4462,32 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
4013
4462
|
}
|
|
4014
4463
|
};
|
|
4015
4464
|
|
|
4465
|
+
// src/ensv2/ids-lib.ts
|
|
4466
|
+
var import_viem21 = require("viem");
|
|
4467
|
+
var makeRegistryId = (accountId) => formatAccountId(accountId);
|
|
4468
|
+
var makeENSv1DomainId = (node) => node;
|
|
4469
|
+
var makeENSv2DomainId = (registry, canonicalId) => formatAssetId({
|
|
4470
|
+
assetNamespace: AssetNamespaces.ERC1155,
|
|
4471
|
+
contract: registry,
|
|
4472
|
+
tokenId: canonicalId
|
|
4473
|
+
});
|
|
4474
|
+
var maskLower32Bits = (num) => num ^ num & 0xffffffffn;
|
|
4475
|
+
var getCanonicalId = (input) => {
|
|
4476
|
+
if (typeof input === "bigint") return maskLower32Bits(input);
|
|
4477
|
+
return getCanonicalId((0, import_viem21.hexToBigInt)(input));
|
|
4478
|
+
};
|
|
4479
|
+
var makePermissionsId = (contract) => formatAccountId(contract);
|
|
4480
|
+
var makePermissionsResourceId = (contract, resource) => `${makePermissionsId(contract)}/${resource}`;
|
|
4481
|
+
var makePermissionsUserId = (contract, resource, user) => `${makePermissionsId(contract)}/${resource}/${user}`;
|
|
4482
|
+
var makeResolverId = (contract) => formatAccountId(contract);
|
|
4483
|
+
var makeResolverRecordsId = (resolver, node) => `${makeResolverId(resolver)}/${node}`;
|
|
4484
|
+
var makeLatestRegistrationId = (domainId) => `${domainId}/latest`;
|
|
4485
|
+
var makeRegistrationId = (domainId, index = 0) => `${domainId}/${index}`;
|
|
4486
|
+
var makeLatestRenewalId = (domainId, registrationIndex) => `${makeRegistrationId(domainId, registrationIndex)}/latest`;
|
|
4487
|
+
var makeRenewalId = (domainId, registrationIndex, index = 0) => `${makeRegistrationId(domainId, registrationIndex)}/${index}`;
|
|
4488
|
+
|
|
4016
4489
|
// src/identity/identity.ts
|
|
4017
|
-
var
|
|
4490
|
+
var import_datasources10 = require("@ensnode/datasources");
|
|
4018
4491
|
|
|
4019
4492
|
// src/identity/types.ts
|
|
4020
4493
|
var ResolutionStatusIds = {
|
|
@@ -4041,7 +4514,7 @@ var ResolutionStatusIds = {
|
|
|
4041
4514
|
function buildUnresolvedIdentity(address, namespaceId, chainId) {
|
|
4042
4515
|
return {
|
|
4043
4516
|
resolutionStatus: ResolutionStatusIds.Unresolved,
|
|
4044
|
-
chainId: chainId ?? (0,
|
|
4517
|
+
chainId: chainId ?? (0, import_datasources10.getENSRootChainId)(namespaceId),
|
|
4045
4518
|
address
|
|
4046
4519
|
};
|
|
4047
4520
|
}
|
|
@@ -4051,13 +4524,13 @@ function isResolvedIdentity(identity) {
|
|
|
4051
4524
|
|
|
4052
4525
|
// src/resolution/ensip19-chainid.ts
|
|
4053
4526
|
var import_chains = require("viem/chains");
|
|
4054
|
-
var
|
|
4527
|
+
var import_datasources11 = require("@ensnode/datasources");
|
|
4055
4528
|
var getResolvePrimaryNameChainIdParam = (chainId, namespaceId) => {
|
|
4056
|
-
const ensRootChainId = (0,
|
|
4529
|
+
const ensRootChainId = (0, import_datasources11.getENSRootChainId)(namespaceId);
|
|
4057
4530
|
return chainId === ensRootChainId ? import_chains.mainnet.id : chainId;
|
|
4058
4531
|
};
|
|
4059
4532
|
var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
|
|
4060
|
-
return chainId === DEFAULT_EVM_CHAIN_ID ? (0,
|
|
4533
|
+
return chainId === DEFAULT_EVM_CHAIN_ID ? (0, import_datasources11.getENSRootChainId)(namespaceId) : chainId;
|
|
4061
4534
|
};
|
|
4062
4535
|
|
|
4063
4536
|
// src/resolution/resolver-records-selection.ts
|