@settlemint/sdk-blockscout 1.2.5-prbe4cc6dc → 1.2.5-prbee6b57d
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/blockscout.cjs +1 -1
- package/dist/blockscout.cjs.map +1 -1
- package/dist/blockscout.d.cts +3 -32
- package/dist/blockscout.d.ts +3 -32
- package/dist/blockscout.mjs +1 -1
- package/dist/blockscout.mjs.map +1 -1
- package/package.json +2 -2
package/dist/blockscout.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var r in e)p(t,r,{get:e[r],enumerable:!0})},d=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of u(e))!S.call(t,n)&&n!==r&&p(t,n,{get:()=>e[n],enumerable:!(a=h(e,n))||a.enumerable});return t};var g=t=>d(p({},"__esModule",{value:!0}),t);var O={};C(O,{ClientOptionsSchema:()=>m,createBlockscoutClient:()=>x,readFragment:()=>f.readFragment});module.exports=g(O);var i=require("@settlemint/sdk-utils/runtime"),o=require("@settlemint/sdk-utils/validation"),s=require("gql.tada"),c=require("graphql-request"),l=require("zod"),f=require("gql.tada"),m=l.z.object({instance:o.UrlOrPathSchema,accessToken:o.ApplicationAccessTokenSchema});function x(t,e){(0,i.ensureServer)();let r=(0,o.validate)(m,t),a=(0,s.initGraphQLTada)(),n=new URL(r.instance).toString();return{client:new c.GraphQLClient(n,{...e,headers:{...e?.headers??{},"x-auth-token":r.accessToken}}),graphql:a}}0&&(module.exports={ClientOptionsSchema,createBlockscoutClient,readFragment});
|
|
2
2
|
//# sourceMappingURL=blockscout.cjs.map
|
package/dist/blockscout.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/blockscout.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../src/blockscout.ts"],"sourcesContent":["import { 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\";\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,\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 *\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 *\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: {\n ...(clientOptions?.headers ?? {}),\n \"x-auth-token\": validatedOptions.accessToken,\n },\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,EAA6B,yCAC7BC,EAAwE,4CACxEC,EAA0D,oBAC1DC,EAA8B,2BAC9BC,EAAkB,eAyFlBF,EAA6B,oBA/EhBG,EAAsB,IAAE,OAAO,CAC1C,SAAU,kBACV,YAAa,8BACf,CAAC,EAoDM,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,QAAS,CACP,GAAIA,GAAe,SAAW,CAAC,EAC/B,eAAgBC,EAAiB,WACnC,CACF,CAAC,EACD,QAAAC,CACF,CACF","names":["blockscout_exports","__export","ClientOptionsSchema","createBlockscoutClient","__toCommonJS","import_runtime","import_validation","import_gql","import_graphql_request","import_zod","ClientOptionsSchema","createBlockscoutClient","options","clientOptions","validatedOptions","graphql","fullUrl"]}
|
package/dist/blockscout.d.cts
CHANGED
|
@@ -9,29 +9,17 @@ import { z } from 'zod';
|
|
|
9
9
|
type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];
|
|
10
10
|
/**
|
|
11
11
|
* Schema for validating client options for the Blockscout client.
|
|
12
|
-
* Defines two possible runtime configurations:
|
|
13
|
-
* 1. Server-side with instance URL and access token
|
|
14
|
-
* 2. Browser-side with no additional configuration needed
|
|
15
12
|
*/
|
|
16
|
-
declare const ClientOptionsSchema: z.
|
|
13
|
+
declare const ClientOptionsSchema: z.ZodObject<{
|
|
17
14
|
instance: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
18
|
-
runtime: z.ZodLiteral<"server">;
|
|
19
15
|
accessToken: z.ZodString;
|
|
20
16
|
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
runtime: "server";
|
|
22
17
|
instance: string;
|
|
23
18
|
accessToken: string;
|
|
24
19
|
}, {
|
|
25
|
-
runtime: "server";
|
|
26
20
|
instance: string;
|
|
27
21
|
accessToken: string;
|
|
28
|
-
}
|
|
29
|
-
runtime: z.ZodLiteral<"browser">;
|
|
30
|
-
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
runtime: "browser";
|
|
32
|
-
}, {
|
|
33
|
-
runtime: "browser";
|
|
34
|
-
}>]>;
|
|
22
|
+
}>;
|
|
35
23
|
/**
|
|
36
24
|
* Type definition for client options derived from the ClientOptionsSchema
|
|
37
25
|
*/
|
|
@@ -47,7 +35,6 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
|
|
|
47
35
|
* import { createBlockscoutClient } from '@settlemint/sdk-blockscout';
|
|
48
36
|
* import type { introspection } from "@schemas/blockscout-env";
|
|
49
37
|
*
|
|
50
|
-
* // Server-side usage
|
|
51
38
|
* const { client, graphql } = createBlockscoutClient<{
|
|
52
39
|
* introspection: introspection;
|
|
53
40
|
* disableMasking: true;
|
|
@@ -66,22 +53,6 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
|
|
|
66
53
|
* accessToken: process.env.SETTLEMINT_ACCESS_TOKEN
|
|
67
54
|
* });
|
|
68
55
|
*
|
|
69
|
-
* // Browser-side usage
|
|
70
|
-
* const { client, graphql } = createBlockscoutClient<{
|
|
71
|
-
* introspection: introspection;
|
|
72
|
-
* disableMasking: true;
|
|
73
|
-
* scalars: {
|
|
74
|
-
* AddressHash: string;
|
|
75
|
-
* Data: string;
|
|
76
|
-
* DateTime: string;
|
|
77
|
-
* Decimal: string;
|
|
78
|
-
* FullHash: string;
|
|
79
|
-
* Json: string;
|
|
80
|
-
* NonceHash: string;
|
|
81
|
-
* Wei: string;
|
|
82
|
-
* };
|
|
83
|
-
* }>({});
|
|
84
|
-
*
|
|
85
56
|
* // Making GraphQL queries
|
|
86
57
|
* const query = graphql(`
|
|
87
58
|
* query GetTransaction($hash: String!) {
|
|
@@ -98,7 +69,7 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
|
|
|
98
69
|
* hash: "0x123abc..."
|
|
99
70
|
* });
|
|
100
71
|
*/
|
|
101
|
-
declare function createBlockscoutClient<const Setup extends AbstractSetupSchema>(options:
|
|
72
|
+
declare function createBlockscoutClient<const Setup extends AbstractSetupSchema>(options: ClientOptions, clientOptions?: RequestConfig): {
|
|
102
73
|
client: GraphQLClient;
|
|
103
74
|
graphql: initGraphQLTada<Setup>;
|
|
104
75
|
};
|
package/dist/blockscout.d.ts
CHANGED
|
@@ -9,29 +9,17 @@ import { z } from 'zod';
|
|
|
9
9
|
type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];
|
|
10
10
|
/**
|
|
11
11
|
* Schema for validating client options for the Blockscout client.
|
|
12
|
-
* Defines two possible runtime configurations:
|
|
13
|
-
* 1. Server-side with instance URL and access token
|
|
14
|
-
* 2. Browser-side with no additional configuration needed
|
|
15
12
|
*/
|
|
16
|
-
declare const ClientOptionsSchema: z.
|
|
13
|
+
declare const ClientOptionsSchema: z.ZodObject<{
|
|
17
14
|
instance: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
18
|
-
runtime: z.ZodLiteral<"server">;
|
|
19
15
|
accessToken: z.ZodString;
|
|
20
16
|
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
runtime: "server";
|
|
22
17
|
instance: string;
|
|
23
18
|
accessToken: string;
|
|
24
19
|
}, {
|
|
25
|
-
runtime: "server";
|
|
26
20
|
instance: string;
|
|
27
21
|
accessToken: string;
|
|
28
|
-
}
|
|
29
|
-
runtime: z.ZodLiteral<"browser">;
|
|
30
|
-
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
runtime: "browser";
|
|
32
|
-
}, {
|
|
33
|
-
runtime: "browser";
|
|
34
|
-
}>]>;
|
|
22
|
+
}>;
|
|
35
23
|
/**
|
|
36
24
|
* Type definition for client options derived from the ClientOptionsSchema
|
|
37
25
|
*/
|
|
@@ -47,7 +35,6 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
|
|
|
47
35
|
* import { createBlockscoutClient } from '@settlemint/sdk-blockscout';
|
|
48
36
|
* import type { introspection } from "@schemas/blockscout-env";
|
|
49
37
|
*
|
|
50
|
-
* // Server-side usage
|
|
51
38
|
* const { client, graphql } = createBlockscoutClient<{
|
|
52
39
|
* introspection: introspection;
|
|
53
40
|
* disableMasking: true;
|
|
@@ -66,22 +53,6 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
|
|
|
66
53
|
* accessToken: process.env.SETTLEMINT_ACCESS_TOKEN
|
|
67
54
|
* });
|
|
68
55
|
*
|
|
69
|
-
* // Browser-side usage
|
|
70
|
-
* const { client, graphql } = createBlockscoutClient<{
|
|
71
|
-
* introspection: introspection;
|
|
72
|
-
* disableMasking: true;
|
|
73
|
-
* scalars: {
|
|
74
|
-
* AddressHash: string;
|
|
75
|
-
* Data: string;
|
|
76
|
-
* DateTime: string;
|
|
77
|
-
* Decimal: string;
|
|
78
|
-
* FullHash: string;
|
|
79
|
-
* Json: string;
|
|
80
|
-
* NonceHash: string;
|
|
81
|
-
* Wei: string;
|
|
82
|
-
* };
|
|
83
|
-
* }>({});
|
|
84
|
-
*
|
|
85
56
|
* // Making GraphQL queries
|
|
86
57
|
* const query = graphql(`
|
|
87
58
|
* query GetTransaction($hash: String!) {
|
|
@@ -98,7 +69,7 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
|
|
|
98
69
|
* hash: "0x123abc..."
|
|
99
70
|
* });
|
|
100
71
|
*/
|
|
101
|
-
declare function createBlockscoutClient<const Setup extends AbstractSetupSchema>(options:
|
|
72
|
+
declare function createBlockscoutClient<const Setup extends AbstractSetupSchema>(options: ClientOptions, clientOptions?: RequestConfig): {
|
|
102
73
|
client: GraphQLClient;
|
|
103
74
|
graphql: initGraphQLTada<Setup>;
|
|
104
75
|
};
|
package/dist/blockscout.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ensureServer as a}from"@settlemint/sdk-utils/runtime";import{ApplicationAccessTokenSchema as p,UrlOrPathSchema as i,validate as s}from"@settlemint/sdk-utils/validation";import{initGraphQLTada as c}from"gql.tada";import{GraphQLClient as l}from"graphql-request";import{z as m}from"zod";import{readFragment as q}from"gql.tada";var f=m.object({instance:i,accessToken:p});function O(r,e){a();let t=s(f,r),n=c(),o=new URL(t.instance).toString();return{client:new l(o,{...e,headers:{...e?.headers??{},"x-auth-token":t.accessToken}}),graphql:n}}export{f as ClientOptionsSchema,O as createBlockscoutClient,q as readFragment};
|
|
2
2
|
//# sourceMappingURL=blockscout.mjs.map
|
package/dist/blockscout.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/blockscout.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../src/blockscout.ts"],"sourcesContent":["import { 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\";\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,\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 *\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 *\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: {\n ...(clientOptions?.headers ?? {}),\n \"x-auth-token\": validatedOptions.accessToken,\n },\n }),\n graphql,\n };\n}\n\nexport { readFragment } from \"gql.tada\";\nexport type { FragmentOf, ResultOf, VariablesOf } from \"gql.tada\";\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,gCAC7B,OAAS,gCAAAC,EAA8B,mBAAAC,EAAiB,YAAAC,MAAgB,mCACxE,OAAmC,mBAAAC,MAAuB,WAC1D,OAAS,iBAAAC,MAAqB,kBAC9B,OAAS,KAAAC,MAAS,MAyFlB,OAAS,gBAAAC,MAAoB,WA/EtB,IAAMC,EAAsBF,EAAE,OAAO,CAC1C,SAAUJ,EACV,YAAaD,CACf,CAAC,EAoDM,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,QAAS,CACP,GAAIA,GAAe,SAAW,CAAC,EAC/B,eAAgBC,EAAiB,WACnC,CACF,CAAC,EACD,QAAAC,CACF,CACF","names":["ensureServer","ApplicationAccessTokenSchema","UrlOrPathSchema","validate","initGraphQLTada","GraphQLClient","z","readFragment","ClientOptionsSchema","createBlockscoutClient","options","clientOptions","validatedOptions","graphql","fullUrl"]}
|
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": "1.2.5-
|
|
4
|
+
"version": "1.2.5-prbee6b57d",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"license": "FSL-1.1-MIT",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"devDependencies": {},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"gql.tada": "^1",
|
|
55
|
-
"@settlemint/sdk-utils": "1.2.5-
|
|
55
|
+
"@settlemint/sdk-utils": "1.2.5-prbee6b57d",
|
|
56
56
|
"graphql-request": "^7",
|
|
57
57
|
"zod": "^3"
|
|
58
58
|
},
|