@ensnode/ensnode-sdk 0.0.0-next-20260216164355 → 0.0.0-next-20260216171758
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 +71 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +222 -215
- package/dist/index.d.ts +222 -215
- package/dist/index.js +64 -61
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -47,7 +47,8 @@ __export(index_exports, {
|
|
|
47
47
|
DEFAULT_EVM_COIN_TYPE: () => DEFAULT_EVM_COIN_TYPE,
|
|
48
48
|
ENCODED_REFERRER_BYTE_LENGTH: () => ENCODED_REFERRER_BYTE_LENGTH,
|
|
49
49
|
ENCODED_REFERRER_BYTE_OFFSET: () => ENCODED_REFERRER_BYTE_OFFSET,
|
|
50
|
-
|
|
50
|
+
ENSApiClient: () => ENSApiClient,
|
|
51
|
+
ENSNamespaceIds: () => import_datasources.ENSNamespaceIds,
|
|
51
52
|
ENSNodeClient: () => ENSNodeClient,
|
|
52
53
|
ENS_ROOT: () => ENS_ROOT,
|
|
53
54
|
ETH_COIN_TYPE: () => ETH_COIN_TYPE,
|
|
@@ -149,7 +150,7 @@ __export(index_exports, {
|
|
|
149
150
|
getCurrencyInfo: () => getCurrencyInfo,
|
|
150
151
|
getDatasourceContract: () => getDatasourceContract,
|
|
151
152
|
getDefaultEnsNodeUrl: () => getDefaultEnsNodeUrl,
|
|
152
|
-
getENSRootChainId: () =>
|
|
153
|
+
getENSRootChainId: () => import_datasources2.getENSRootChainId,
|
|
153
154
|
getENSv1Registry: () => getENSv1Registry,
|
|
154
155
|
getENSv2RootRegistry: () => getENSv2RootRegistry,
|
|
155
156
|
getENSv2RootRegistryId: () => getENSv2RootRegistryId,
|
|
@@ -276,56 +277,8 @@ __export(index_exports, {
|
|
|
276
277
|
});
|
|
277
278
|
module.exports = __toCommonJS(index_exports);
|
|
278
279
|
|
|
279
|
-
// src/client-error.ts
|
|
280
|
-
var ClientError = class _ClientError extends Error {
|
|
281
|
-
details;
|
|
282
|
-
constructor(message, details) {
|
|
283
|
-
super(message);
|
|
284
|
-
this.name = "ClientError";
|
|
285
|
-
this.details = details;
|
|
286
|
-
}
|
|
287
|
-
static fromErrorResponse({ message, details }) {
|
|
288
|
-
return new _ClientError(message, details);
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
// src/deployments.ts
|
|
293
|
-
var import_datasources = require("@ensnode/datasources");
|
|
294
|
-
var DEFAULT_ENSNODE_API_URL_MAINNET = "https://api.alpha.ensnode.io";
|
|
295
|
-
var DEFAULT_ENSNODE_API_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
|
|
296
|
-
var getDefaultEnsNodeUrl = (namespace) => {
|
|
297
|
-
const effectiveNamespace = namespace ?? import_datasources.ENSNamespaceIds.Mainnet;
|
|
298
|
-
switch (effectiveNamespace) {
|
|
299
|
-
case import_datasources.ENSNamespaceIds.Mainnet:
|
|
300
|
-
return new URL(DEFAULT_ENSNODE_API_URL_MAINNET);
|
|
301
|
-
case import_datasources.ENSNamespaceIds.Sepolia:
|
|
302
|
-
return new URL(DEFAULT_ENSNODE_API_URL_SEPOLIA);
|
|
303
|
-
default:
|
|
304
|
-
throw new Error(
|
|
305
|
-
`ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
// src/ensapi/config/deserialize.ts
|
|
311
|
-
var import_v45 = require("zod/v4");
|
|
312
|
-
|
|
313
|
-
// src/ensapi/config/zod-schemas.ts
|
|
314
|
-
var import_v44 = require("zod/v4");
|
|
315
|
-
|
|
316
|
-
// src/ensindexer/config/zod-schemas.ts
|
|
317
|
-
var import_v42 = require("zod/v4");
|
|
318
|
-
|
|
319
|
-
// src/shared/collections.ts
|
|
320
|
-
var uniq = (arr) => [...new Set(arr)];
|
|
321
|
-
|
|
322
|
-
// src/shared/zod-schemas.ts
|
|
323
|
-
var import_caip = require("caip");
|
|
324
|
-
var import_viem8 = require("viem");
|
|
325
|
-
var import_v4 = require("zod/v4");
|
|
326
|
-
|
|
327
280
|
// src/ens/index.ts
|
|
328
|
-
var
|
|
281
|
+
var import_datasources2 = require("@ensnode/datasources");
|
|
329
282
|
|
|
330
283
|
// src/ens/coin-type.ts
|
|
331
284
|
var import_utils = require("@ensdomains/address-encoder/utils");
|
|
@@ -514,7 +467,24 @@ var makeSubdomainNode = (labelHash, node) => (0, import_viem5.keccak256)((0, imp
|
|
|
514
467
|
var uint256ToHex32 = (num) => (0, import_viem5.toHex)(num, { size: 32 });
|
|
515
468
|
|
|
516
469
|
// src/ens/types.ts
|
|
517
|
-
var
|
|
470
|
+
var import_datasources = require("@ensnode/datasources");
|
|
471
|
+
|
|
472
|
+
// src/ensapi/config/deserialize.ts
|
|
473
|
+
var import_v45 = require("zod/v4");
|
|
474
|
+
|
|
475
|
+
// src/ensapi/config/zod-schemas.ts
|
|
476
|
+
var import_v44 = require("zod/v4");
|
|
477
|
+
|
|
478
|
+
// src/ensindexer/config/zod-schemas.ts
|
|
479
|
+
var import_v42 = require("zod/v4");
|
|
480
|
+
|
|
481
|
+
// src/shared/collections.ts
|
|
482
|
+
var uniq = (arr) => [...new Set(arr)];
|
|
483
|
+
|
|
484
|
+
// src/shared/zod-schemas.ts
|
|
485
|
+
var import_caip = require("caip");
|
|
486
|
+
var import_viem8 = require("viem");
|
|
487
|
+
var import_v4 = require("zod/v4");
|
|
518
488
|
|
|
519
489
|
// src/shared/currencies.ts
|
|
520
490
|
var import_viem6 = require("viem");
|
|
@@ -745,9 +715,9 @@ var makeBlockRefSchema = (valueLabel = "Value") => import_v4.z.strictObject(
|
|
|
745
715
|
error: `${valueLabel} must be a valid BlockRef object.`
|
|
746
716
|
}
|
|
747
717
|
);
|
|
748
|
-
var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => import_v4.z.enum(
|
|
718
|
+
var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => import_v4.z.enum(import_datasources.ENSNamespaceIds, {
|
|
749
719
|
error() {
|
|
750
|
-
return `Invalid ${valueLabel}. Supported ENS namespace IDs are: ${Object.keys(
|
|
720
|
+
return `Invalid ${valueLabel}. Supported ENS namespace IDs are: ${Object.keys(import_datasources.ENSNamespaceIds).join(", ")}`;
|
|
751
721
|
}
|
|
752
722
|
});
|
|
753
723
|
var makePriceAmountSchema = (valueLabel = "Amount") => import_v4.z.coerce.bigint({
|
|
@@ -810,7 +780,7 @@ var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_
|
|
|
810
780
|
}).transform(reinterpretName);
|
|
811
781
|
|
|
812
782
|
// src/ensindexer/config/is-subgraph-compatible.ts
|
|
813
|
-
var
|
|
783
|
+
var import_datasources3 = require("@ensnode/datasources");
|
|
814
784
|
|
|
815
785
|
// src/ensindexer/config/types.ts
|
|
816
786
|
var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
@@ -830,7 +800,7 @@ function isSubgraphCompatible(config) {
|
|
|
830
800
|
const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
|
|
831
801
|
const isSubgraphLabelSet = config.labelSet.labelSetId === "subgraph" && config.labelSet.labelSetVersion === 0;
|
|
832
802
|
const isEnsTestEnvLabelSet = config.labelSet.labelSetId === "ens-test-env" && config.labelSet.labelSetVersion === 0;
|
|
833
|
-
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace ===
|
|
803
|
+
const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === import_datasources3.ENSNamespaceIds.EnsTestEnv && isEnsTestEnvLabelSet;
|
|
834
804
|
return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
|
|
835
805
|
}
|
|
836
806
|
|
|
@@ -2041,7 +2011,7 @@ var import_v419 = require("zod/v4");
|
|
|
2041
2011
|
|
|
2042
2012
|
// src/tokenscope/name-token.ts
|
|
2043
2013
|
var import_viem13 = require("viem");
|
|
2044
|
-
var
|
|
2014
|
+
var import_datasources5 = require("@ensnode/datasources");
|
|
2045
2015
|
|
|
2046
2016
|
// src/shared/account-id.ts
|
|
2047
2017
|
var import_viem10 = require("viem");
|
|
@@ -2050,9 +2020,9 @@ var accountIdEqual = (a, b) => {
|
|
|
2050
2020
|
};
|
|
2051
2021
|
|
|
2052
2022
|
// src/shared/datasource-contract.ts
|
|
2053
|
-
var
|
|
2023
|
+
var import_datasources4 = require("@ensnode/datasources");
|
|
2054
2024
|
var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
2055
|
-
const datasource = (0,
|
|
2025
|
+
const datasource = (0, import_datasources4.maybeGetDatasource)(namespaceId, datasourceName);
|
|
2056
2026
|
if (!datasource) return void 0;
|
|
2057
2027
|
const address = datasource.contracts[contractName]?.address;
|
|
2058
2028
|
if (address === void 0 || Array.isArray(address)) return void 0;
|
|
@@ -2447,12 +2417,12 @@ function serializeNameToken(nameToken) {
|
|
|
2447
2417
|
function getNameWrapperAccounts(namespaceId) {
|
|
2448
2418
|
const ethnamesNameWrapperAccount = getDatasourceContract(
|
|
2449
2419
|
namespaceId,
|
|
2450
|
-
|
|
2420
|
+
import_datasources5.DatasourceNames.ENSRoot,
|
|
2451
2421
|
"NameWrapper"
|
|
2452
2422
|
);
|
|
2453
2423
|
const lineanamesNameWrapperAccount = maybeGetDatasourceContract(
|
|
2454
2424
|
namespaceId,
|
|
2455
|
-
|
|
2425
|
+
import_datasources5.DatasourceNames.Lineanames,
|
|
2456
2426
|
"NameWrapper"
|
|
2457
2427
|
);
|
|
2458
2428
|
const nameWrapperAccounts = [
|
|
@@ -3193,8 +3163,39 @@ function buildPageContext(page, recordsPerPage, totalRecords) {
|
|
|
3193
3163
|
};
|
|
3194
3164
|
}
|
|
3195
3165
|
|
|
3196
|
-
// src/client.ts
|
|
3197
|
-
var
|
|
3166
|
+
// src/ensapi/client-error.ts
|
|
3167
|
+
var ClientError = class _ClientError extends Error {
|
|
3168
|
+
details;
|
|
3169
|
+
constructor(message, details) {
|
|
3170
|
+
super(message);
|
|
3171
|
+
this.name = "ClientError";
|
|
3172
|
+
this.details = details;
|
|
3173
|
+
}
|
|
3174
|
+
static fromErrorResponse({ message, details }) {
|
|
3175
|
+
return new _ClientError(message, details);
|
|
3176
|
+
}
|
|
3177
|
+
};
|
|
3178
|
+
|
|
3179
|
+
// src/ensapi/deployments.ts
|
|
3180
|
+
var import_datasources6 = require("@ensnode/datasources");
|
|
3181
|
+
var DEFAULT_ENSNODE_API_URL_MAINNET = "https://api.alpha.ensnode.io";
|
|
3182
|
+
var DEFAULT_ENSNODE_API_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
|
|
3183
|
+
var getDefaultEnsNodeUrl = (namespace) => {
|
|
3184
|
+
const effectiveNamespace = namespace ?? import_datasources6.ENSNamespaceIds.Mainnet;
|
|
3185
|
+
switch (effectiveNamespace) {
|
|
3186
|
+
case import_datasources6.ENSNamespaceIds.Mainnet:
|
|
3187
|
+
return new URL(DEFAULT_ENSNODE_API_URL_MAINNET);
|
|
3188
|
+
case import_datasources6.ENSNamespaceIds.Sepolia:
|
|
3189
|
+
return new URL(DEFAULT_ENSNODE_API_URL_SEPOLIA);
|
|
3190
|
+
default:
|
|
3191
|
+
throw new Error(
|
|
3192
|
+
`ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
|
|
3193
|
+
);
|
|
3194
|
+
}
|
|
3195
|
+
};
|
|
3196
|
+
|
|
3197
|
+
// src/ensapi/client.ts
|
|
3198
|
+
var ENSApiClient = class _ENSApiClient {
|
|
3198
3199
|
options;
|
|
3199
3200
|
static defaultOptions() {
|
|
3200
3201
|
return {
|
|
@@ -3203,7 +3204,7 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3203
3204
|
}
|
|
3204
3205
|
constructor(options = {}) {
|
|
3205
3206
|
this.options = {
|
|
3206
|
-
...
|
|
3207
|
+
..._ENSApiClient.defaultOptions(),
|
|
3207
3208
|
...options
|
|
3208
3209
|
};
|
|
3209
3210
|
}
|
|
@@ -3448,11 +3449,11 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3448
3449
|
* ```ts
|
|
3449
3450
|
* import {
|
|
3450
3451
|
* registrarActionsFilter,
|
|
3451
|
-
*
|
|
3452
|
+
* ENSApiClient,
|
|
3452
3453
|
* } from "@ensnode/ensnode-sdk";
|
|
3453
3454
|
* import { namehash } from "viem/ens";
|
|
3454
3455
|
*
|
|
3455
|
-
* const client:
|
|
3456
|
+
* const client: ENSApiClient;
|
|
3456
3457
|
*
|
|
3457
3458
|
* // Get first page with default page size (10 records)
|
|
3458
3459
|
* const response = await client.registrarActions();
|
|
@@ -3615,11 +3616,11 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3615
3616
|
* @example
|
|
3616
3617
|
* ```ts
|
|
3617
3618
|
* import {
|
|
3618
|
-
*
|
|
3619
|
+
* ENSApiClient,
|
|
3619
3620
|
* } from "@ensnode/ensnode-sdk";
|
|
3620
3621
|
* import { namehash } from "viem/ens";
|
|
3621
3622
|
*
|
|
3622
|
-
* const client:
|
|
3623
|
+
* const client: ENSApiClient;
|
|
3623
3624
|
*
|
|
3624
3625
|
* // get latest name token records from the indexed subregistry based on the requested name
|
|
3625
3626
|
* const response = await client.nameTokens({
|
|
@@ -3659,6 +3660,8 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
3659
3660
|
return deserializedNameTokensResponse(responseData);
|
|
3660
3661
|
}
|
|
3661
3662
|
};
|
|
3663
|
+
var ENSNodeClient = class extends ENSApiClient {
|
|
3664
|
+
};
|
|
3662
3665
|
|
|
3663
3666
|
// src/ensv2/ids-lib.ts
|
|
3664
3667
|
var import_viem16 = require("viem");
|