@settlemint/sdk-blockscout 1.2.5-pre69ae9a6 → 1.2.5-prf062f171
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 +9 -27
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ For detailed information about using Blockscout with the SettleMint platform, ch
|
|
|
52
52
|
|
|
53
53
|
> **createBlockscoutClient**\<`Setup`\>(`options`, `clientOptions`?): `object`
|
|
54
54
|
|
|
55
|
-
Defined in: [sdk/blockscout/src/blockscout.ts:
|
|
55
|
+
Defined in: [sdk/blockscout/src/blockscout.ts:70](https://github.com/settlemint/sdk/blob/v1.2.5/sdk/blockscout/src/blockscout.ts#L70)
|
|
56
56
|
|
|
57
57
|
Creates a Blockscout GraphQL client with proper type safety using gql.tada
|
|
58
58
|
|
|
@@ -66,7 +66,9 @@ Creates a Blockscout GraphQL client with proper type safety using gql.tada
|
|
|
66
66
|
|
|
67
67
|
| Parameter | Type | Description |
|
|
68
68
|
| ------ | ------ | ------ |
|
|
69
|
-
| `options` |
|
|
69
|
+
| `options` | \{ `accessToken`: `string`; `instance`: `string`; \} | Configuration options for the client |
|
|
70
|
+
| `options.accessToken` | `string` | - |
|
|
71
|
+
| `options.instance`? | `string` | - |
|
|
70
72
|
| `clientOptions`? | `RequestConfig` | Optional GraphQL client configuration options |
|
|
71
73
|
|
|
72
74
|
##### Returns
|
|
@@ -77,8 +79,8 @@ An object containing the GraphQL client and initialized gql.tada function
|
|
|
77
79
|
|
|
78
80
|
| Name | Type | Defined in |
|
|
79
81
|
| ------ | ------ | ------ |
|
|
80
|
-
| `client` | `GraphQLClient` | [sdk/blockscout/src/blockscout.ts:
|
|
81
|
-
| `graphql` | `initGraphQLTada`\<`Setup`\> | [sdk/blockscout/src/blockscout.ts:
|
|
82
|
+
| `client` | `GraphQLClient` | [sdk/blockscout/src/blockscout.ts:74](https://github.com/settlemint/sdk/blob/v1.2.5/sdk/blockscout/src/blockscout.ts#L74) |
|
|
83
|
+
| `graphql` | `initGraphQLTada`\<`Setup`\> | [sdk/blockscout/src/blockscout.ts:75](https://github.com/settlemint/sdk/blob/v1.2.5/sdk/blockscout/src/blockscout.ts#L75) |
|
|
82
84
|
|
|
83
85
|
##### Throws
|
|
84
86
|
|
|
@@ -90,7 +92,6 @@ Will throw an error if the options fail validation
|
|
|
90
92
|
import { createBlockscoutClient } from '@settlemint/sdk-blockscout';
|
|
91
93
|
import type { introspection } from "@schemas/blockscout-env";
|
|
92
94
|
|
|
93
|
-
// Server-side usage
|
|
94
95
|
const { client, graphql } = createBlockscoutClient<{
|
|
95
96
|
introspection: introspection;
|
|
96
97
|
disableMasking: true;
|
|
@@ -109,22 +110,6 @@ const { client, graphql } = createBlockscoutClient<{
|
|
|
109
110
|
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN
|
|
110
111
|
});
|
|
111
112
|
|
|
112
|
-
// Browser-side usage
|
|
113
|
-
const { client, graphql } = createBlockscoutClient<{
|
|
114
|
-
introspection: introspection;
|
|
115
|
-
disableMasking: true;
|
|
116
|
-
scalars: {
|
|
117
|
-
AddressHash: string;
|
|
118
|
-
Data: string;
|
|
119
|
-
DateTime: string;
|
|
120
|
-
Decimal: string;
|
|
121
|
-
FullHash: string;
|
|
122
|
-
Json: string;
|
|
123
|
-
NonceHash: string;
|
|
124
|
-
Wei: string;
|
|
125
|
-
};
|
|
126
|
-
}>({});
|
|
127
|
-
|
|
128
113
|
// Making GraphQL queries
|
|
129
114
|
const query = graphql(`
|
|
130
115
|
query GetTransaction($hash: String!) {
|
|
@@ -148,7 +133,7 @@ const result = await client.request(query, {
|
|
|
148
133
|
|
|
149
134
|
> **ClientOptions** = `z.infer`\<*typeof* [`ClientOptionsSchema`](#clientoptionsschema)\>
|
|
150
135
|
|
|
151
|
-
Defined in: [sdk/blockscout/src/blockscout.ts:
|
|
136
|
+
Defined in: [sdk/blockscout/src/blockscout.ts:23](https://github.com/settlemint/sdk/blob/v1.2.5/sdk/blockscout/src/blockscout.ts#L23)
|
|
152
137
|
|
|
153
138
|
Type definition for client options derived from the ClientOptionsSchema
|
|
154
139
|
|
|
@@ -166,14 +151,11 @@ Type definition for GraphQL client configuration options
|
|
|
166
151
|
|
|
167
152
|
#### ClientOptionsSchema
|
|
168
153
|
|
|
169
|
-
> `const` **ClientOptionsSchema**: `
|
|
154
|
+
> `const` **ClientOptionsSchema**: `ZodObject`\<\{ `accessToken`: `ZodString`; `instance`: `ZodUnion`\<\[`ZodString`, `ZodString`\]\>; \}, `"strip"`, `ZodTypeAny`, \{ `accessToken`: `string`; `instance`: `string`; \}, \{ `accessToken`: `string`; `instance`: `string`; \}\>
|
|
170
155
|
|
|
171
|
-
Defined in: [sdk/blockscout/src/blockscout.ts:
|
|
156
|
+
Defined in: [sdk/blockscout/src/blockscout.ts:15](https://github.com/settlemint/sdk/blob/v1.2.5/sdk/blockscout/src/blockscout.ts#L15)
|
|
172
157
|
|
|
173
158
|
Schema for validating client options for the Blockscout client.
|
|
174
|
-
Defines two possible runtime configurations:
|
|
175
|
-
1. Server-side with instance URL and access token
|
|
176
|
-
2. Browser-side with no additional configuration needed
|
|
177
159
|
|
|
178
160
|
## Contributing
|
|
179
161
|
|
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-prf062f171",
|
|
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-prf062f171",
|
|
56
56
|
"graphql-request": "^7",
|
|
57
57
|
"zod": "^3"
|
|
58
58
|
},
|