@ensnode/ensnode-sdk 0.0.0-next-20260430162059 → 0.0.0-next-20260501114932
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +37 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -3
- package/dist/index.d.ts +44 -3
- package/dist/index.js +37 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -129,6 +129,7 @@ __export(index_exports, {
|
|
|
129
129
|
deserializeIndexingStatusResponse: () => deserializeIndexingStatusResponse,
|
|
130
130
|
deserializeOmnichainIndexingStatusSnapshot: () => deserializeOmnichainIndexingStatusSnapshot,
|
|
131
131
|
deserializePriceDai: () => deserializePriceDai,
|
|
132
|
+
deserializePriceEnsTokens: () => deserializePriceEnsTokens,
|
|
132
133
|
deserializePriceEth: () => deserializePriceEth,
|
|
133
134
|
deserializePriceUsdc: () => deserializePriceUsdc,
|
|
134
135
|
deserializeRealtimeIndexingStatusProjection: () => deserializeRealtimeIndexingStatusProjection,
|
|
@@ -204,11 +205,13 @@ __export(index_exports, {
|
|
|
204
205
|
parseAccountId: () => parseAccountId,
|
|
205
206
|
parseAssetId: () => parseAssetId,
|
|
206
207
|
parseDai: () => parseDai,
|
|
208
|
+
parseEnsTokens: () => parseEnsTokens,
|
|
207
209
|
parseEth: () => parseEth,
|
|
208
210
|
parseNonNegativeInteger: () => parseNonNegativeInteger,
|
|
209
211
|
parseTimestamp: () => parseTimestamp,
|
|
210
212
|
parseUsdc: () => parseUsdc,
|
|
211
213
|
priceDai: () => priceDai,
|
|
214
|
+
priceEnsTokens: () => priceEnsTokens,
|
|
212
215
|
priceEth: () => priceEth,
|
|
213
216
|
priceUsdc: () => priceUsdc,
|
|
214
217
|
registrarActionsFilter: () => registrarActionsFilter,
|
|
@@ -241,6 +244,7 @@ __export(index_exports, {
|
|
|
241
244
|
serializeOmnichainIndexingStatusSnapshot: () => serializeOmnichainIndexingStatusSnapshot,
|
|
242
245
|
serializePrice: () => serializePrice,
|
|
243
246
|
serializePriceDai: () => serializePriceDai,
|
|
247
|
+
serializePriceEnsTokens: () => serializePriceEnsTokens,
|
|
244
248
|
serializePriceEth: () => serializePriceEth,
|
|
245
249
|
serializePriceUsdc: () => serializePriceUsdc,
|
|
246
250
|
serializeRealtimeIndexingStatusProjection: () => serializeRealtimeIndexingStatusProjection,
|
|
@@ -345,7 +349,8 @@ function scaleBigintByNumber(value, scaleFactor) {
|
|
|
345
349
|
var CurrencyIds = {
|
|
346
350
|
ETH: "ETH",
|
|
347
351
|
USDC: "USDC",
|
|
348
|
-
DAI: "DAI"
|
|
352
|
+
DAI: "DAI",
|
|
353
|
+
ENSTokens: "ENSTokens"
|
|
349
354
|
};
|
|
350
355
|
var currencyInfo = {
|
|
351
356
|
[CurrencyIds.ETH]: {
|
|
@@ -362,6 +367,11 @@ var currencyInfo = {
|
|
|
362
367
|
id: CurrencyIds.DAI,
|
|
363
368
|
name: "Dai Stablecoin",
|
|
364
369
|
decimals: 18
|
|
370
|
+
},
|
|
371
|
+
[CurrencyIds.ENSTokens]: {
|
|
372
|
+
id: CurrencyIds.ENSTokens,
|
|
373
|
+
name: "$ENS Tokens",
|
|
374
|
+
decimals: 18
|
|
365
375
|
}
|
|
366
376
|
};
|
|
367
377
|
function getCurrencyInfo(currencyId) {
|
|
@@ -385,6 +395,12 @@ function priceDai(amount) {
|
|
|
385
395
|
currency: CurrencyIds.DAI
|
|
386
396
|
};
|
|
387
397
|
}
|
|
398
|
+
function priceEnsTokens(amount) {
|
|
399
|
+
return {
|
|
400
|
+
amount,
|
|
401
|
+
currency: CurrencyIds.ENSTokens
|
|
402
|
+
};
|
|
403
|
+
}
|
|
388
404
|
function isPriceCurrencyEqual(priceA, priceB) {
|
|
389
405
|
return priceA.currency === priceB.currency;
|
|
390
406
|
}
|
|
@@ -472,6 +488,12 @@ function parseDai(value) {
|
|
|
472
488
|
const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
|
|
473
489
|
return priceDai(amount);
|
|
474
490
|
}
|
|
491
|
+
function parseEnsTokens(value) {
|
|
492
|
+
validateAmountToParse(value);
|
|
493
|
+
const currencyInfo2 = getCurrencyInfo(CurrencyIds.ENSTokens);
|
|
494
|
+
const amount = (0, import_viem.parseUnits)(value, currencyInfo2.decimals);
|
|
495
|
+
return priceEnsTokens(amount);
|
|
496
|
+
}
|
|
475
497
|
|
|
476
498
|
// src/shared/zod-schemas.ts
|
|
477
499
|
var makeIntegerSchema = (valueLabel = "Value") => import_v4.z.int({
|
|
@@ -532,6 +554,7 @@ var makePriceCurrencySchema = (currency, valueLabel = "Price Currency") => impor
|
|
|
532
554
|
var makePriceEthSchema = (valueLabel = "Price ETH") => makePriceCurrencySchema(CurrencyIds.ETH, valueLabel).transform((v) => v);
|
|
533
555
|
var makePriceUsdcSchema = (valueLabel = "Price USDC") => makePriceCurrencySchema(CurrencyIds.USDC, valueLabel).transform((v) => v);
|
|
534
556
|
var makePriceDaiSchema = (valueLabel = "Price DAI") => makePriceCurrencySchema(CurrencyIds.DAI, valueLabel).transform((v) => v);
|
|
557
|
+
var makePriceEnsTokensSchema = (valueLabel = "Price ENSTokens") => makePriceCurrencySchema(CurrencyIds.ENSTokens, valueLabel).transform((v) => v);
|
|
535
558
|
var makeAccountIdSchema = (valueLabel = "AccountId") => import_v4.z.strictObject({
|
|
536
559
|
chainId: makeChainIdSchema(`${valueLabel} chain ID`),
|
|
537
560
|
address: makeNormalizedAddressSchema(`${valueLabel} address`)
|
|
@@ -1908,6 +1931,9 @@ function serializePriceUsdc(price) {
|
|
|
1908
1931
|
function serializePriceDai(price) {
|
|
1909
1932
|
return serializePrice(price);
|
|
1910
1933
|
}
|
|
1934
|
+
function serializePriceEnsTokens(price) {
|
|
1935
|
+
return serializePrice(price);
|
|
1936
|
+
}
|
|
1911
1937
|
|
|
1912
1938
|
// src/indexing-status/serialize/chain-indexing-status-snapshot.ts
|
|
1913
1939
|
function serializeChainIndexingSnapshots(chains) {
|
|
@@ -4577,6 +4603,16 @@ ${(0, import_v447.prettifyError)(parsed.error)}
|
|
|
4577
4603
|
}
|
|
4578
4604
|
return parsed.data;
|
|
4579
4605
|
}
|
|
4606
|
+
function deserializePriceEnsTokens(maybePrice, valueLabel) {
|
|
4607
|
+
const schema = makePriceEnsTokensSchema(valueLabel);
|
|
4608
|
+
const parsed = schema.safeParse(maybePrice);
|
|
4609
|
+
if (parsed.error) {
|
|
4610
|
+
throw new Error(`Cannot deserialize PriceEnsTokens:
|
|
4611
|
+
${(0, import_v447.prettifyError)(parsed.error)}
|
|
4612
|
+
`);
|
|
4613
|
+
}
|
|
4614
|
+
return parsed.data;
|
|
4615
|
+
}
|
|
4580
4616
|
|
|
4581
4617
|
// src/shared/datetime.ts
|
|
4582
4618
|
function durationBetween(start, end) {
|