@settlemint/sdk-blockscout 2.3.2-pr3dad35bd → 2.3.2-pr472d8b55

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.
@@ -1,2 +1,112 @@
1
- "use strict";var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var r in e)p(t,r,{get:e[r],enumerable:!0})},g=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of S(e))!d.call(t,o)&&o!==r&&p(t,o,{get:()=>e[o],enumerable:!(n=u(e,o))||n.enumerable});return t};var x=t=>g(p({},"__esModule",{value:!0}),t);var y={};C(y,{ClientOptionsSchema:()=>f,createBlockscoutClient:()=>O,readFragment:()=>h.readFragment});module.exports=x(y);var i=require("@settlemint/sdk-utils/http"),s=require("@settlemint/sdk-utils/runtime"),a=require("@settlemint/sdk-utils/validation"),c=require("gql.tada"),l=require("graphql-request"),m=require("zod/v4"),h=require("gql.tada"),f=m.z.object({instance:a.UrlOrPathSchema,accessToken:a.ApplicationAccessTokenSchema.optional()});function O(t,e){(0,s.ensureServer)();let r=(0,a.validate)(f,t),n=(0,c.initGraphQLTada)(),o=new URL(r.instance).toString();return{client:new l.GraphQLClient(o,{...e,headers:(0,i.appendHeaders)(e?.headers,{"x-auth-token":r.accessToken})}),graphql:n}}0&&(module.exports={ClientOptionsSchema,createBlockscoutClient,readFragment});
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ const __settlemint_sdk_utils_http = __toESM(require("@settlemint/sdk-utils/http"));
25
+ const __settlemint_sdk_utils_runtime = __toESM(require("@settlemint/sdk-utils/runtime"));
26
+ const __settlemint_sdk_utils_validation = __toESM(require("@settlemint/sdk-utils/validation"));
27
+ const gql_tada = __toESM(require("gql.tada"));
28
+ const graphql_request = __toESM(require("graphql-request"));
29
+ const zod_v4 = __toESM(require("zod/v4"));
30
+
31
+ //#region src/blockscout.ts
32
+ /**
33
+ * Schema for validating client options for the Blockscout client.
34
+ */
35
+ const ClientOptionsSchema = zod_v4.z.object({
36
+ instance: __settlemint_sdk_utils_validation.UrlOrPathSchema,
37
+ accessToken: __settlemint_sdk_utils_validation.ApplicationAccessTokenSchema.optional()
38
+ });
39
+ /**
40
+ * Creates a Blockscout GraphQL client with proper type safety using gql.tada
41
+ *
42
+ * @param options - Configuration options for the client
43
+ * @param clientOptions - Optional GraphQL client configuration options
44
+ * @returns An object containing the GraphQL client and initialized gql.tada function
45
+ * @throws Will throw an error if the options fail validation
46
+ * @example
47
+ * import { createBlockscoutClient } from '@settlemint/sdk-blockscout';
48
+ * import type { introspection } from "@schemas/blockscout-env";
49
+ * import { createLogger, requestLogger } from '@settlemint/sdk-utils/logging';
50
+ *
51
+ * const logger = createLogger();
52
+ *
53
+ * const { client, graphql } = createBlockscoutClient<{
54
+ * introspection: introspection;
55
+ * disableMasking: true;
56
+ * scalars: {
57
+ * AddressHash: string;
58
+ * Data: string;
59
+ * DateTime: string;
60
+ * Decimal: string;
61
+ * FullHash: string;
62
+ * Json: string;
63
+ * NonceHash: string;
64
+ * Wei: string;
65
+ * };
66
+ * }>({
67
+ * instance: process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT,
68
+ * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN
69
+ * }, {
70
+ * fetch: requestLogger(logger, "blockscout", fetch) as typeof fetch,
71
+ * });
72
+ *
73
+ * // Making GraphQL queries
74
+ * const query = graphql(`
75
+ * query GetTransaction($hash: String!) {
76
+ * transaction(hash: $hash) {
77
+ * hash
78
+ * blockNumber
79
+ * value
80
+ * gasUsed
81
+ * }
82
+ * }
83
+ * `);
84
+ *
85
+ * const result = await client.request(query, {
86
+ * hash: "0x123abc..."
87
+ * });
88
+ */
89
+ function createBlockscoutClient(options, clientOptions) {
90
+ (0, __settlemint_sdk_utils_runtime.ensureServer)();
91
+ const validatedOptions = (0, __settlemint_sdk_utils_validation.validate)(ClientOptionsSchema, options);
92
+ const graphql = (0, gql_tada.initGraphQLTada)();
93
+ const fullUrl = new URL(validatedOptions.instance).toString();
94
+ return {
95
+ client: new graphql_request.GraphQLClient(fullUrl, {
96
+ ...clientOptions,
97
+ headers: (0, __settlemint_sdk_utils_http.appendHeaders)(clientOptions?.headers, { "x-auth-token": validatedOptions.accessToken })
98
+ }),
99
+ graphql
100
+ };
101
+ }
102
+
103
+ //#endregion
104
+ exports.ClientOptionsSchema = ClientOptionsSchema;
105
+ exports.createBlockscoutClient = createBlockscoutClient;
106
+ Object.defineProperty(exports, 'readFragment', {
107
+ enumerable: true,
108
+ get: function () {
109
+ return gql_tada.readFragment;
110
+ }
111
+ });
2
112
  //# sourceMappingURL=blockscout.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/blockscout.ts"],"sourcesContent":["import { appendHeaders } from \"@settlemint/sdk-utils/http\";\nimport { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport { type AbstractSetupSchema, initGraphQLTada } from \"gql.tada\";\nimport { GraphQLClient } from \"graphql-request\";\nimport { z } from \"zod/v4\";\n\n/**\n * Type definition for GraphQL client configuration options\n */\nexport type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];\n\n/**\n * Schema for validating client options for the Blockscout client.\n */\nexport const ClientOptionsSchema = z.object({\n instance: UrlOrPathSchema,\n accessToken: ApplicationAccessTokenSchema.optional(),\n});\n\n/**\n * Type definition for client options derived from the ClientOptionsSchema\n */\nexport type ClientOptions = z.infer<typeof ClientOptionsSchema>;\n\n/**\n * Creates a Blockscout GraphQL client with proper type safety using gql.tada\n *\n * @param options - Configuration options for the client\n * @param clientOptions - Optional GraphQL client configuration options\n * @returns An object containing the GraphQL client and initialized gql.tada function\n * @throws Will throw an error if the options fail validation\n * @example\n * import { createBlockscoutClient } from '@settlemint/sdk-blockscout';\n * import type { introspection } from \"@schemas/blockscout-env\";\n * import { createLogger, requestLogger } from '@settlemint/sdk-utils/logging';\n *\n * const logger = createLogger();\n *\n * const { client, graphql } = createBlockscoutClient<{\n * introspection: introspection;\n * disableMasking: true;\n * scalars: {\n * AddressHash: string;\n * Data: string;\n * DateTime: string;\n * Decimal: string;\n * FullHash: string;\n * Json: string;\n * NonceHash: string;\n * Wei: string;\n * };\n * }>({\n * instance: process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN\n * }, {\n * fetch: requestLogger(logger, \"blockscout\", fetch) as typeof fetch,\n * });\n *\n * // Making GraphQL queries\n * const query = graphql(`\n * query GetTransaction($hash: String!) {\n * transaction(hash: $hash) {\n * hash\n * blockNumber\n * value\n * gasUsed\n * }\n * }\n * `);\n *\n * const result = await client.request(query, {\n * hash: \"0x123abc...\"\n * });\n */\nexport function createBlockscoutClient<const Setup extends AbstractSetupSchema>(\n options: ClientOptions,\n clientOptions?: RequestConfig,\n): {\n client: GraphQLClient;\n graphql: initGraphQLTada<Setup>;\n} {\n ensureServer();\n const validatedOptions = validate(ClientOptionsSchema, options);\n const graphql = initGraphQLTada<Setup>();\n const fullUrl = new URL(validatedOptions.instance).toString();\n\n return {\n client: new GraphQLClient(fullUrl, {\n ...clientOptions,\n headers: appendHeaders(clientOptions?.headers, { \"x-auth-token\": validatedOptions.accessToken }),\n }),\n graphql,\n };\n}\n\nexport { readFragment } from \"gql.tada\";\nexport type { FragmentOf, ResultOf, VariablesOf } from \"gql.tada\";\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,2BAAAC,EAAA,iDAAAC,EAAAJ,GAAA,IAAAK,EAA8B,sCAC9BC,EAA6B,yCAC7BC,EAAwE,4CACxEC,EAA0D,oBAC1DC,EAA8B,2BAC9BC,EAAkB,kBA2FlBF,EAA6B,oBAjFhBG,EAAsB,IAAE,OAAO,CAC1C,SAAU,kBACV,YAAa,+BAA6B,SAAS,CACrD,CAAC,EAyDM,SAASC,EACdC,EACAC,EAIA,IACA,gBAAa,EACb,IAAMC,KAAmB,YAASJ,EAAqBE,CAAO,EACxDG,KAAU,mBAAuB,EACjCC,EAAU,IAAI,IAAIF,EAAiB,QAAQ,EAAE,SAAS,EAE5D,MAAO,CACL,OAAQ,IAAI,gBAAcE,EAAS,CACjC,GAAGH,EACH,WAAS,iBAAcA,GAAe,QAAS,CAAE,eAAgBC,EAAiB,WAAY,CAAC,CACjG,CAAC,EACD,QAAAC,CACF,CACF","names":["blockscout_exports","__export","ClientOptionsSchema","createBlockscoutClient","__toCommonJS","import_http","import_runtime","import_validation","import_gql","import_graphql_request","import_v4","ClientOptionsSchema","createBlockscoutClient","options","clientOptions","validatedOptions","graphql","fullUrl"]}
1
+ {"version":3,"file":"blockscout.cjs","names":["UrlOrPathSchema","options: ClientOptions","clientOptions?: RequestConfig","GraphQLClient"],"sources":["../src/blockscout.ts"],"sourcesContent":["import { appendHeaders } from \"@settlemint/sdk-utils/http\";\nimport { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport { type AbstractSetupSchema, initGraphQLTada } from \"gql.tada\";\nimport { GraphQLClient } from \"graphql-request\";\nimport { z } from \"zod/v4\";\n\n/**\n * Type definition for GraphQL client configuration options\n */\nexport type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];\n\n/**\n * Schema for validating client options for the Blockscout client.\n */\nexport const ClientOptionsSchema = z.object({\n instance: UrlOrPathSchema,\n accessToken: ApplicationAccessTokenSchema.optional(),\n});\n\n/**\n * Type definition for client options derived from the ClientOptionsSchema\n */\nexport type ClientOptions = z.infer<typeof ClientOptionsSchema>;\n\n/**\n * Creates a Blockscout GraphQL client with proper type safety using gql.tada\n *\n * @param options - Configuration options for the client\n * @param clientOptions - Optional GraphQL client configuration options\n * @returns An object containing the GraphQL client and initialized gql.tada function\n * @throws Will throw an error if the options fail validation\n * @example\n * import { createBlockscoutClient } from '@settlemint/sdk-blockscout';\n * import type { introspection } from \"@schemas/blockscout-env\";\n * import { createLogger, requestLogger } from '@settlemint/sdk-utils/logging';\n *\n * const logger = createLogger();\n *\n * const { client, graphql } = createBlockscoutClient<{\n * introspection: introspection;\n * disableMasking: true;\n * scalars: {\n * AddressHash: string;\n * Data: string;\n * DateTime: string;\n * Decimal: string;\n * FullHash: string;\n * Json: string;\n * NonceHash: string;\n * Wei: string;\n * };\n * }>({\n * instance: process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN\n * }, {\n * fetch: requestLogger(logger, \"blockscout\", fetch) as typeof fetch,\n * });\n *\n * // Making GraphQL queries\n * const query = graphql(`\n * query GetTransaction($hash: String!) {\n * transaction(hash: $hash) {\n * hash\n * blockNumber\n * value\n * gasUsed\n * }\n * }\n * `);\n *\n * const result = await client.request(query, {\n * hash: \"0x123abc...\"\n * });\n */\nexport function createBlockscoutClient<const Setup extends AbstractSetupSchema>(\n options: ClientOptions,\n clientOptions?: RequestConfig,\n): {\n client: GraphQLClient;\n graphql: initGraphQLTada<Setup>;\n} {\n ensureServer();\n const validatedOptions = validate(ClientOptionsSchema, options);\n const graphql = initGraphQLTada<Setup>();\n const fullUrl = new URL(validatedOptions.instance).toString();\n\n return {\n client: new GraphQLClient(fullUrl, {\n ...clientOptions,\n headers: appendHeaders(clientOptions?.headers, { \"x-auth-token\": validatedOptions.accessToken }),\n }),\n graphql,\n };\n}\n\nexport { readFragment } from \"gql.tada\";\nexport type { FragmentOf, ResultOf, VariablesOf } from \"gql.tada\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAa,sBAAsB,SAAE,OAAO;CAC1C,UAAUA;CACV,aAAa,+DAA6B,UAAU;AACrD,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDF,SAAgB,uBACdC,SACAC,eAIA;AACA,mDAAc;CACd,MAAM,mBAAmB,gDAAS,qBAAqB,QAAQ;CAC/D,MAAM,UAAU,+BAAwB;CACxC,MAAM,UAAU,IAAI,IAAI,iBAAiB,UAAU,UAAU;AAE7D,QAAO;EACL,QAAQ,IAAIC,8BAAc,SAAS;GACjC,GAAG;GACH,SAAS,+CAAc,eAAe,SAAS,EAAE,gBAAgB,iBAAiB,YAAa,EAAC;EACjG;EACD;CACD;AACF"}
@@ -1,8 +1,11 @@
1
- import { AbstractSetupSchema, initGraphQLTada } from 'gql.tada';
2
- export { FragmentOf, ResultOf, VariablesOf, readFragment } from 'gql.tada';
3
- import { GraphQLClient } from 'graphql-request';
4
- import { z } from 'zod/v4';
1
+ import { AbstractSetupSchema, FragmentOf, ResultOf, VariablesOf, initGraphQLTada, readFragment } from "gql.tada";
2
+ import { GraphQLClient } from "graphql-request";
3
+ import { z } from "zod/v4";
5
4
 
5
+ //#region src/blockscout.d.ts
6
+ /**
7
+ * Type definition for GraphQL client configuration options
8
+ */
6
9
  /**
7
10
  * Type definition for GraphQL client configuration options
8
11
  */
@@ -11,8 +14,8 @@ type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];
11
14
  * Schema for validating client options for the Blockscout client.
12
15
  */
13
16
  declare const ClientOptionsSchema: z.ZodObject<{
14
- instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
15
- accessToken: z.ZodOptional<z.ZodString>;
17
+ instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
18
+ accessToken: z.ZodOptional<z.ZodString>;
16
19
  }, z.core.$strip>;
17
20
  /**
18
21
  * Type definition for client options derived from the ClientOptionsSchema
@@ -69,8 +72,10 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
69
72
  * });
70
73
  */
71
74
  declare function createBlockscoutClient<const Setup extends AbstractSetupSchema>(options: ClientOptions, clientOptions?: RequestConfig): {
72
- client: GraphQLClient;
73
- graphql: initGraphQLTada<Setup>;
75
+ client: GraphQLClient;
76
+ graphql: initGraphQLTada<Setup>;
74
77
  };
75
78
 
76
- export { type ClientOptions, ClientOptionsSchema, type RequestConfig, createBlockscoutClient };
79
+ //#endregion
80
+ export { ClientOptions, ClientOptionsSchema, FragmentOf, RequestConfig, ResultOf, VariablesOf, createBlockscoutClient, readFragment };
81
+ //# sourceMappingURL=blockscout.d.cts.map
@@ -1,8 +1,11 @@
1
- import { AbstractSetupSchema, initGraphQLTada } from 'gql.tada';
2
- export { FragmentOf, ResultOf, VariablesOf, readFragment } from 'gql.tada';
3
- import { GraphQLClient } from 'graphql-request';
4
- import { z } from 'zod/v4';
1
+ import { AbstractSetupSchema, FragmentOf, ResultOf, VariablesOf, initGraphQLTada, readFragment } from "gql.tada";
2
+ import { GraphQLClient } from "graphql-request";
3
+ import { z } from "zod/v4";
5
4
 
5
+ //#region src/blockscout.d.ts
6
+ /**
7
+ * Type definition for GraphQL client configuration options
8
+ */
6
9
  /**
7
10
  * Type definition for GraphQL client configuration options
8
11
  */
@@ -11,8 +14,8 @@ type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];
11
14
  * Schema for validating client options for the Blockscout client.
12
15
  */
13
16
  declare const ClientOptionsSchema: z.ZodObject<{
14
- instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
15
- accessToken: z.ZodOptional<z.ZodString>;
17
+ instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
18
+ accessToken: z.ZodOptional<z.ZodString>;
16
19
  }, z.core.$strip>;
17
20
  /**
18
21
  * Type definition for client options derived from the ClientOptionsSchema
@@ -69,8 +72,10 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
69
72
  * });
70
73
  */
71
74
  declare function createBlockscoutClient<const Setup extends AbstractSetupSchema>(options: ClientOptions, clientOptions?: RequestConfig): {
72
- client: GraphQLClient;
73
- graphql: initGraphQLTada<Setup>;
75
+ client: GraphQLClient;
76
+ graphql: initGraphQLTada<Setup>;
74
77
  };
75
78
 
76
- export { type ClientOptions, ClientOptionsSchema, type RequestConfig, createBlockscoutClient };
79
+ //#endregion
80
+ export { ClientOptions, ClientOptionsSchema, FragmentOf, RequestConfig, ResultOf, VariablesOf, createBlockscoutClient, readFragment };
81
+ //# sourceMappingURL=blockscout.d.ts.map
@@ -0,0 +1,82 @@
1
+ import { appendHeaders } from "@settlemint/sdk-utils/http";
2
+ import { ensureServer } from "@settlemint/sdk-utils/runtime";
3
+ import { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from "@settlemint/sdk-utils/validation";
4
+ import { initGraphQLTada, readFragment } from "gql.tada";
5
+ import { GraphQLClient } from "graphql-request";
6
+ import { z } from "zod/v4";
7
+
8
+ //#region src/blockscout.ts
9
+ /**
10
+ * Schema for validating client options for the Blockscout client.
11
+ */
12
+ const ClientOptionsSchema = z.object({
13
+ instance: UrlOrPathSchema,
14
+ accessToken: ApplicationAccessTokenSchema.optional()
15
+ });
16
+ /**
17
+ * Creates a Blockscout GraphQL client with proper type safety using gql.tada
18
+ *
19
+ * @param options - Configuration options for the client
20
+ * @param clientOptions - Optional GraphQL client configuration options
21
+ * @returns An object containing the GraphQL client and initialized gql.tada function
22
+ * @throws Will throw an error if the options fail validation
23
+ * @example
24
+ * import { createBlockscoutClient } from '@settlemint/sdk-blockscout';
25
+ * import type { introspection } from "@schemas/blockscout-env";
26
+ * import { createLogger, requestLogger } from '@settlemint/sdk-utils/logging';
27
+ *
28
+ * const logger = createLogger();
29
+ *
30
+ * const { client, graphql } = createBlockscoutClient<{
31
+ * introspection: introspection;
32
+ * disableMasking: true;
33
+ * scalars: {
34
+ * AddressHash: string;
35
+ * Data: string;
36
+ * DateTime: string;
37
+ * Decimal: string;
38
+ * FullHash: string;
39
+ * Json: string;
40
+ * NonceHash: string;
41
+ * Wei: string;
42
+ * };
43
+ * }>({
44
+ * instance: process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT,
45
+ * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN
46
+ * }, {
47
+ * fetch: requestLogger(logger, "blockscout", fetch) as typeof fetch,
48
+ * });
49
+ *
50
+ * // Making GraphQL queries
51
+ * const query = graphql(`
52
+ * query GetTransaction($hash: String!) {
53
+ * transaction(hash: $hash) {
54
+ * hash
55
+ * blockNumber
56
+ * value
57
+ * gasUsed
58
+ * }
59
+ * }
60
+ * `);
61
+ *
62
+ * const result = await client.request(query, {
63
+ * hash: "0x123abc..."
64
+ * });
65
+ */
66
+ function createBlockscoutClient(options, clientOptions) {
67
+ ensureServer();
68
+ const validatedOptions = validate(ClientOptionsSchema, options);
69
+ const graphql = initGraphQLTada();
70
+ const fullUrl = new URL(validatedOptions.instance).toString();
71
+ return {
72
+ client: new GraphQLClient(fullUrl, {
73
+ ...clientOptions,
74
+ headers: appendHeaders(clientOptions?.headers, { "x-auth-token": validatedOptions.accessToken })
75
+ }),
76
+ graphql
77
+ };
78
+ }
79
+
80
+ //#endregion
81
+ export { ClientOptionsSchema, createBlockscoutClient, readFragment };
82
+ //# sourceMappingURL=blockscout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockscout.js","names":["options: ClientOptions","clientOptions?: RequestConfig"],"sources":["../src/blockscout.ts"],"sourcesContent":["import { appendHeaders } from \"@settlemint/sdk-utils/http\";\nimport { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport { type AbstractSetupSchema, initGraphQLTada } from \"gql.tada\";\nimport { GraphQLClient } from \"graphql-request\";\nimport { z } from \"zod/v4\";\n\n/**\n * Type definition for GraphQL client configuration options\n */\nexport type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];\n\n/**\n * Schema for validating client options for the Blockscout client.\n */\nexport const ClientOptionsSchema = z.object({\n instance: UrlOrPathSchema,\n accessToken: ApplicationAccessTokenSchema.optional(),\n});\n\n/**\n * Type definition for client options derived from the ClientOptionsSchema\n */\nexport type ClientOptions = z.infer<typeof ClientOptionsSchema>;\n\n/**\n * Creates a Blockscout GraphQL client with proper type safety using gql.tada\n *\n * @param options - Configuration options for the client\n * @param clientOptions - Optional GraphQL client configuration options\n * @returns An object containing the GraphQL client and initialized gql.tada function\n * @throws Will throw an error if the options fail validation\n * @example\n * import { createBlockscoutClient } from '@settlemint/sdk-blockscout';\n * import type { introspection } from \"@schemas/blockscout-env\";\n * import { createLogger, requestLogger } from '@settlemint/sdk-utils/logging';\n *\n * const logger = createLogger();\n *\n * const { client, graphql } = createBlockscoutClient<{\n * introspection: introspection;\n * disableMasking: true;\n * scalars: {\n * AddressHash: string;\n * Data: string;\n * DateTime: string;\n * Decimal: string;\n * FullHash: string;\n * Json: string;\n * NonceHash: string;\n * Wei: string;\n * };\n * }>({\n * instance: process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN\n * }, {\n * fetch: requestLogger(logger, \"blockscout\", fetch) as typeof fetch,\n * });\n *\n * // Making GraphQL queries\n * const query = graphql(`\n * query GetTransaction($hash: String!) {\n * transaction(hash: $hash) {\n * hash\n * blockNumber\n * value\n * gasUsed\n * }\n * }\n * `);\n *\n * const result = await client.request(query, {\n * hash: \"0x123abc...\"\n * });\n */\nexport function createBlockscoutClient<const Setup extends AbstractSetupSchema>(\n options: ClientOptions,\n clientOptions?: RequestConfig,\n): {\n client: GraphQLClient;\n graphql: initGraphQLTada<Setup>;\n} {\n ensureServer();\n const validatedOptions = validate(ClientOptionsSchema, options);\n const graphql = initGraphQLTada<Setup>();\n const fullUrl = new URL(validatedOptions.instance).toString();\n\n return {\n client: new GraphQLClient(fullUrl, {\n ...clientOptions,\n headers: appendHeaders(clientOptions?.headers, { \"x-auth-token\": validatedOptions.accessToken }),\n }),\n graphql,\n };\n}\n\nexport { readFragment } from \"gql.tada\";\nexport type { FragmentOf, ResultOf, VariablesOf } from \"gql.tada\";\n"],"mappings":";;;;;;;;;;;AAeA,MAAa,sBAAsB,EAAE,OAAO;CAC1C,UAAU;CACV,aAAa,6BAA6B,UAAU;AACrD,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDF,SAAgB,uBACdA,SACAC,eAIA;AACA,eAAc;CACd,MAAM,mBAAmB,SAAS,qBAAqB,QAAQ;CAC/D,MAAM,UAAU,iBAAwB;CACxC,MAAM,UAAU,IAAI,IAAI,iBAAiB,UAAU,UAAU;AAE7D,QAAO;EACL,QAAQ,IAAI,cAAc,SAAS;GACjC,GAAG;GACH,SAAS,cAAc,eAAe,SAAS,EAAE,gBAAgB,iBAAiB,YAAa,EAAC;EACjG;EACD;CACD;AACF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@settlemint/sdk-blockscout",
3
3
  "description": "Blockscout integration module for SettleMint SDK, enabling blockchain explorer and analytics functionality",
4
- "version": "2.3.2-pr3dad35bd",
4
+ "version": "2.3.2-pr472d8b55",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "license": "FSL-1.1-MIT",
@@ -22,14 +22,14 @@
22
22
  },
23
23
  "files": ["dist"],
24
24
  "main": "./dist/blockscout.cjs",
25
- "module": "./dist/blockscout.mjs",
25
+ "module": "./dist/blockscout.js",
26
26
  "types": "./dist/blockscout.d.ts",
27
27
  "exports": {
28
28
  "./package.json": "./package.json",
29
29
  ".": {
30
30
  "import": {
31
31
  "types": "./dist/blockscout.d.ts",
32
- "default": "./dist/blockscout.mjs"
32
+ "default": "./dist/blockscout.js"
33
33
  },
34
34
  "require": {
35
35
  "types": "./dist/blockscout.d.cts",
@@ -38,8 +38,8 @@
38
38
  }
39
39
  },
40
40
  "scripts": {
41
- "build": "tsup-node",
42
- "dev": "tsup-node --watch",
41
+ "build": "tsdown",
42
+ "dev": "tsdown --watch",
43
43
  "publint": "publint run --strict",
44
44
  "attw": "attw --pack .",
45
45
  "test": "bun test",
@@ -52,7 +52,7 @@
52
52
  "devDependencies": {},
53
53
  "dependencies": {
54
54
  "gql.tada": "^1",
55
- "@settlemint/sdk-utils": "2.3.2-pr3dad35bd",
55
+ "@settlemint/sdk-utils": "2.3.2-pr472d8b55",
56
56
  "graphql-request": "^7",
57
57
  "zod": "^3.25.0"
58
58
  },
@@ -1,2 +0,0 @@
1
- import{appendHeaders as n}from"@settlemint/sdk-utils/http";import{ensureServer as p}from"@settlemint/sdk-utils/runtime";import{ApplicationAccessTokenSchema as i,UrlOrPathSchema as s,validate as c}from"@settlemint/sdk-utils/validation";import{initGraphQLTada as l}from"gql.tada";import{GraphQLClient as m}from"graphql-request";import{z as f}from"zod/v4";import{readFragment as Q}from"gql.tada";var h=f.object({instance:s,accessToken:i.optional()});function L(r,e){p();let t=c(h,r),o=l(),a=new URL(t.instance).toString();return{client:new m(a,{...e,headers:n(e?.headers,{"x-auth-token":t.accessToken})}),graphql:o}}export{h as ClientOptionsSchema,L as createBlockscoutClient,Q as readFragment};
2
- //# sourceMappingURL=blockscout.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/blockscout.ts"],"sourcesContent":["import { appendHeaders } from \"@settlemint/sdk-utils/http\";\nimport { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport { type AbstractSetupSchema, initGraphQLTada } from \"gql.tada\";\nimport { GraphQLClient } from \"graphql-request\";\nimport { z } from \"zod/v4\";\n\n/**\n * Type definition for GraphQL client configuration options\n */\nexport type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];\n\n/**\n * Schema for validating client options for the Blockscout client.\n */\nexport const ClientOptionsSchema = z.object({\n instance: UrlOrPathSchema,\n accessToken: ApplicationAccessTokenSchema.optional(),\n});\n\n/**\n * Type definition for client options derived from the ClientOptionsSchema\n */\nexport type ClientOptions = z.infer<typeof ClientOptionsSchema>;\n\n/**\n * Creates a Blockscout GraphQL client with proper type safety using gql.tada\n *\n * @param options - Configuration options for the client\n * @param clientOptions - Optional GraphQL client configuration options\n * @returns An object containing the GraphQL client and initialized gql.tada function\n * @throws Will throw an error if the options fail validation\n * @example\n * import { createBlockscoutClient } from '@settlemint/sdk-blockscout';\n * import type { introspection } from \"@schemas/blockscout-env\";\n * import { createLogger, requestLogger } from '@settlemint/sdk-utils/logging';\n *\n * const logger = createLogger();\n *\n * const { client, graphql } = createBlockscoutClient<{\n * introspection: introspection;\n * disableMasking: true;\n * scalars: {\n * AddressHash: string;\n * Data: string;\n * DateTime: string;\n * Decimal: string;\n * FullHash: string;\n * Json: string;\n * NonceHash: string;\n * Wei: string;\n * };\n * }>({\n * instance: process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN\n * }, {\n * fetch: requestLogger(logger, \"blockscout\", fetch) as typeof fetch,\n * });\n *\n * // Making GraphQL queries\n * const query = graphql(`\n * query GetTransaction($hash: String!) {\n * transaction(hash: $hash) {\n * hash\n * blockNumber\n * value\n * gasUsed\n * }\n * }\n * `);\n *\n * const result = await client.request(query, {\n * hash: \"0x123abc...\"\n * });\n */\nexport function createBlockscoutClient<const Setup extends AbstractSetupSchema>(\n options: ClientOptions,\n clientOptions?: RequestConfig,\n): {\n client: GraphQLClient;\n graphql: initGraphQLTada<Setup>;\n} {\n ensureServer();\n const validatedOptions = validate(ClientOptionsSchema, options);\n const graphql = initGraphQLTada<Setup>();\n const fullUrl = new URL(validatedOptions.instance).toString();\n\n return {\n client: new GraphQLClient(fullUrl, {\n ...clientOptions,\n headers: appendHeaders(clientOptions?.headers, { \"x-auth-token\": validatedOptions.accessToken }),\n }),\n graphql,\n };\n}\n\nexport { readFragment } from \"gql.tada\";\nexport type { FragmentOf, ResultOf, VariablesOf } from \"gql.tada\";\n"],"mappings":"AAAA,OAAS,iBAAAA,MAAqB,6BAC9B,OAAS,gBAAAC,MAAoB,gCAC7B,OAAS,gCAAAC,EAA8B,mBAAAC,EAAiB,YAAAC,MAAgB,mCACxE,OAAmC,mBAAAC,MAAuB,WAC1D,OAAS,iBAAAC,MAAqB,kBAC9B,OAAS,KAAAC,MAAS,SA2FlB,OAAS,gBAAAC,MAAoB,WAjFtB,IAAMC,EAAsBF,EAAE,OAAO,CAC1C,SAAUJ,EACV,YAAaD,EAA6B,SAAS,CACrD,CAAC,EAyDM,SAASQ,EACdC,EACAC,EAIA,CACAX,EAAa,EACb,IAAMY,EAAmBT,EAASK,EAAqBE,CAAO,EACxDG,EAAUT,EAAuB,EACjCU,EAAU,IAAI,IAAIF,EAAiB,QAAQ,EAAE,SAAS,EAE5D,MAAO,CACL,OAAQ,IAAIP,EAAcS,EAAS,CACjC,GAAGH,EACH,QAASZ,EAAcY,GAAe,QAAS,CAAE,eAAgBC,EAAiB,WAAY,CAAC,CACjG,CAAC,EACD,QAAAC,CACF,CACF","names":["appendHeaders","ensureServer","ApplicationAccessTokenSchema","UrlOrPathSchema","validate","initGraphQLTada","GraphQLClient","z","readFragment","ClientOptionsSchema","createBlockscoutClient","options","clientOptions","validatedOptions","graphql","fullUrl"]}