@settlemint/sdk-portal 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.
package/dist/portal.d.cts CHANGED
@@ -1,22 +1,25 @@
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';
5
- import { TransactionReceipt as TransactionReceipt$1, Hex, Address } from 'viem';
6
- import * as graphql_ws from 'graphql-ws';
1
+ import { AbstractSetupSchema, FragmentOf, ResultOf, VariablesOf, initGraphQLTada, readFragment } from "gql.tada";
2
+ import { GraphQLClient } from "graphql-request";
3
+ import { z } from "zod/v4";
4
+ import { Address, Hex, TransactionReceipt as TransactionReceipt$1 } from "viem";
5
+ import * as graphql_ws0 from "graphql-ws";
7
6
 
7
+ //#region src/utils/websocket-client.d.ts
8
+ /**
9
+ * Options for the GraphQL WebSocket client
10
+ */
8
11
  /**
9
12
  * Options for the GraphQL WebSocket client
10
13
  */
11
14
  interface WebsocketClientOptions {
12
- /**
13
- * The GraphQL endpoint URL for the Portal API
14
- */
15
- portalGraphqlEndpoint: string;
16
- /**
17
- * The access token for authentication with the Portal API
18
- */
19
- accessToken?: string;
15
+ /**
16
+ * The GraphQL endpoint URL for the Portal API
17
+ */
18
+ portalGraphqlEndpoint: string;
19
+ /**
20
+ * The access token for authentication with the Portal API
21
+ */
22
+ accessToken?: string;
20
23
  }
21
24
  /**
22
25
  * Creates a GraphQL WebSocket client for the Portal API
@@ -31,56 +34,61 @@ interface WebsocketClientOptions {
31
34
  * accessToken: "your-access-token",
32
35
  * });
33
36
  */
34
- declare function getWebsocketClient({ portalGraphqlEndpoint, accessToken }: WebsocketClientOptions): graphql_ws.Client;
37
+ declare function getWebsocketClient({
38
+ portalGraphqlEndpoint,
39
+ accessToken
40
+ }: WebsocketClientOptions): graphql_ws0.Client;
35
41
 
42
+ //#endregion
43
+ //#region src/utils/wait-for-transaction-receipt.d.ts
36
44
  /**
37
45
  * Represents an event emitted during a transaction execution
38
46
  */
39
47
  interface TransactionEvent {
40
- /** The name of the event that was emitted */
41
- eventName: string;
42
- /** The arguments emitted by the event */
43
- args: Record<string, unknown>;
44
- /** Indexed event parameters used for filtering and searching */
45
- topics: Hex[];
48
+ /** The name of the event that was emitted */
49
+ eventName: string;
50
+ /** The arguments emitted by the event */
51
+ args: Record<string, unknown>;
52
+ /** Indexed event parameters used for filtering and searching */
53
+ topics: Hex[];
46
54
  }
47
55
  /**
48
56
  * Represents the structure of a blockchain transaction receipt
49
57
  */
50
58
  interface TransactionReceipt extends TransactionReceipt$1<string, number, "Success" | "Reverted"> {
51
- /** The raw reason for transaction reversion, if applicable */
52
- revertReason: string;
53
- /** Human-readable version of the revert reason */
54
- revertReasonDecoded: string;
55
- /** Array of events emitted during the transaction */
56
- events: TransactionEvent[];
57
- /** The address of the contract deployed in the transaction */
58
- contractAddress: Address;
59
+ /** The raw reason for transaction reversion, if applicable */
60
+ revertReason: string;
61
+ /** Human-readable version of the revert reason */
62
+ revertReasonDecoded: string;
63
+ /** Array of events emitted during the transaction */
64
+ events: TransactionEvent[];
65
+ /** The address of the contract deployed in the transaction */
66
+ contractAddress: Address;
59
67
  }
60
68
  /**
61
69
  * Represents the structure of a blockchain transaction with its receipt
62
70
  */
63
71
  interface Transaction {
64
- receipt: TransactionReceipt;
65
- /** The hash of the transaction (duplicate of receipt.transactionHash) */
66
- transactionHash: string;
67
- /** The sender address (duplicate of receipt.from) */
68
- from: string;
69
- /** Timestamp when the transaction was created */
70
- createdAt: string;
71
- /** The contract address involved in the transaction */
72
- address: string;
73
- /** The name of the function called in the transaction */
74
- functionName: string;
75
- /** Whether the transaction is a contract deployment */
76
- isContract: boolean;
72
+ receipt: TransactionReceipt;
73
+ /** The hash of the transaction (duplicate of receipt.transactionHash) */
74
+ transactionHash: string;
75
+ /** The sender address (duplicate of receipt.from) */
76
+ from: string;
77
+ /** Timestamp when the transaction was created */
78
+ createdAt: string;
79
+ /** The contract address involved in the transaction */
80
+ address: string;
81
+ /** The name of the function called in the transaction */
82
+ functionName: string;
83
+ /** Whether the transaction is a contract deployment */
84
+ isContract: boolean;
77
85
  }
78
86
  /**
79
87
  * Options for waiting for a transaction receipt
80
88
  */
81
89
  interface WaitForTransactionReceiptOptions extends WebsocketClientOptions {
82
- /** Optional timeout in milliseconds before the operation fails */
83
- timeout?: number;
90
+ /** Optional timeout in milliseconds before the operation fails */
91
+ timeout?: number;
84
92
  }
85
93
  /**
86
94
  * Waits for a blockchain transaction receipt by subscribing to transaction updates via GraphQL.
@@ -102,22 +110,31 @@ interface WaitForTransactionReceiptOptions extends WebsocketClientOptions {
102
110
  */
103
111
  declare function waitForTransactionReceipt(transactionHash: string, options: WaitForTransactionReceiptOptions): Promise<Transaction>;
104
112
 
113
+ //#endregion
114
+ //#region src/utils/wallet-verification-challenge.d.ts
115
+ /**
116
+ * Custom error class for challenge-related errors
117
+ */
118
+ declare class ChallengeError extends Error {
119
+ readonly code: string;
120
+ constructor(message: string, code: string);
121
+ }
105
122
  /**
106
123
  * Options for handling a wallet verification challenge
107
124
  */
108
125
  interface HandleWalletVerificationChallengeOptions<Setup extends AbstractSetupSchema> {
109
- /** The portal client instance */
110
- portalClient: GraphQLClient;
111
- /** The GraphQL query builder */
112
- portalGraphql: initGraphQLTada<Setup>;
113
- /** The ID of the verification challenge */
114
- verificationId: string;
115
- /** The wallet address to verify */
116
- userWalletAddress: Address;
117
- /** The verification code provided by the user */
118
- code: string | number;
119
- /** The type of verification being performed */
120
- verificationType: "otp" | "secret-code" | "pincode";
126
+ /** The portal client instance */
127
+ portalClient: GraphQLClient;
128
+ /** The GraphQL query builder */
129
+ portalGraphql: initGraphQLTada<Setup>;
130
+ /** The ID of the verification challenge */
131
+ verificationId: string;
132
+ /** The wallet address to verify */
133
+ userWalletAddress: Address;
134
+ /** The verification code provided by the user */
135
+ code: string | number;
136
+ /** The type of verification being performed */
137
+ verificationType: "otp" | "secret-code" | "pincode";
121
138
  }
122
139
  /**
123
140
  * Handles a wallet verification challenge by generating an appropriate response
@@ -143,11 +160,20 @@ interface HandleWalletVerificationChallengeOptions<Setup extends AbstractSetupSc
143
160
  * verificationType: "otp"
144
161
  * });
145
162
  */
146
- declare function handleWalletVerificationChallenge<const Setup extends AbstractSetupSchema>({ portalClient, portalGraphql, verificationId, userWalletAddress, code, verificationType, }: HandleWalletVerificationChallengeOptions<Setup>): Promise<{
147
- challengeResponse: string;
148
- verificationId?: string;
163
+ declare function handleWalletVerificationChallenge<const Setup extends AbstractSetupSchema>({
164
+ portalClient,
165
+ portalGraphql,
166
+ verificationId,
167
+ userWalletAddress,
168
+ code,
169
+ verificationType
170
+ }: HandleWalletVerificationChallengeOptions<Setup>): Promise<{
171
+ challengeResponse: string;
172
+ verificationId?: string;
149
173
  }>;
150
174
 
175
+ //#endregion
176
+ //#region src/portal.d.ts
151
177
  /**
152
178
  * Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.
153
179
  */
@@ -156,16 +182,16 @@ type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];
156
182
  * Schema for validating Portal client configuration options.
157
183
  */
158
184
  declare const ClientOptionsSchema: z.ZodObject<{
159
- instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
160
- accessToken: z.ZodOptional<z.ZodString>;
161
- cache: z.ZodOptional<z.ZodEnum<{
162
- default: "default";
163
- "force-cache": "force-cache";
164
- "no-cache": "no-cache";
165
- "no-store": "no-store";
166
- "only-if-cached": "only-if-cached";
167
- reload: "reload";
168
- }>>;
185
+ instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
186
+ accessToken: z.ZodOptional<z.ZodString>;
187
+ cache: z.ZodOptional<z.ZodEnum<{
188
+ default: "default";
189
+ "force-cache": "force-cache";
190
+ "no-cache": "no-cache";
191
+ "no-store": "no-store";
192
+ "only-if-cached": "only-if-cached";
193
+ reload: "reload";
194
+ }>>;
169
195
  }, z.core.$strip>;
170
196
  /**
171
197
  * Type representing the validated client options.
@@ -217,8 +243,10 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
217
243
  * const result = await portalClient.request(query);
218
244
  */
219
245
  declare function createPortalClient<const Setup extends AbstractSetupSchema>(options: ClientOptions, clientOptions?: RequestConfig): {
220
- client: GraphQLClient;
221
- graphql: initGraphQLTada<Setup>;
246
+ client: GraphQLClient;
247
+ graphql: initGraphQLTada<Setup>;
222
248
  };
223
249
 
224
- export { type ClientOptions, ClientOptionsSchema, type HandleWalletVerificationChallengeOptions, type RequestConfig, type Transaction, type TransactionEvent, type TransactionReceipt, type WaitForTransactionReceiptOptions, type WebsocketClientOptions, createPortalClient, getWebsocketClient, handleWalletVerificationChallenge, waitForTransactionReceipt };
250
+ //#endregion
251
+ export { ClientOptions, ClientOptionsSchema, FragmentOf, HandleWalletVerificationChallengeOptions, RequestConfig, ResultOf, Transaction, TransactionEvent, TransactionReceipt, VariablesOf, WaitForTransactionReceiptOptions, WebsocketClientOptions, createPortalClient, getWebsocketClient, handleWalletVerificationChallenge, readFragment, waitForTransactionReceipt };
252
+ //# sourceMappingURL=portal.d.cts.map
package/dist/portal.d.ts CHANGED
@@ -1,22 +1,25 @@
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';
5
- import { TransactionReceipt as TransactionReceipt$1, Hex, Address } from 'viem';
6
- import * as graphql_ws from 'graphql-ws';
1
+ import { AbstractSetupSchema, FragmentOf, ResultOf, VariablesOf, initGraphQLTada, readFragment } from "gql.tada";
2
+ import { GraphQLClient } from "graphql-request";
3
+ import { z } from "zod/v4";
4
+ import * as graphql_ws0 from "graphql-ws";
5
+ import { Address, Hex, TransactionReceipt as TransactionReceipt$1 } from "viem";
7
6
 
7
+ //#region src/utils/websocket-client.d.ts
8
+ /**
9
+ * Options for the GraphQL WebSocket client
10
+ */
8
11
  /**
9
12
  * Options for the GraphQL WebSocket client
10
13
  */
11
14
  interface WebsocketClientOptions {
12
- /**
13
- * The GraphQL endpoint URL for the Portal API
14
- */
15
- portalGraphqlEndpoint: string;
16
- /**
17
- * The access token for authentication with the Portal API
18
- */
19
- accessToken?: string;
15
+ /**
16
+ * The GraphQL endpoint URL for the Portal API
17
+ */
18
+ portalGraphqlEndpoint: string;
19
+ /**
20
+ * The access token for authentication with the Portal API
21
+ */
22
+ accessToken?: string;
20
23
  }
21
24
  /**
22
25
  * Creates a GraphQL WebSocket client for the Portal API
@@ -31,56 +34,61 @@ interface WebsocketClientOptions {
31
34
  * accessToken: "your-access-token",
32
35
  * });
33
36
  */
34
- declare function getWebsocketClient({ portalGraphqlEndpoint, accessToken }: WebsocketClientOptions): graphql_ws.Client;
37
+ declare function getWebsocketClient({
38
+ portalGraphqlEndpoint,
39
+ accessToken
40
+ }: WebsocketClientOptions): graphql_ws0.Client;
35
41
 
42
+ //#endregion
43
+ //#region src/utils/wait-for-transaction-receipt.d.ts
36
44
  /**
37
45
  * Represents an event emitted during a transaction execution
38
46
  */
39
47
  interface TransactionEvent {
40
- /** The name of the event that was emitted */
41
- eventName: string;
42
- /** The arguments emitted by the event */
43
- args: Record<string, unknown>;
44
- /** Indexed event parameters used for filtering and searching */
45
- topics: Hex[];
48
+ /** The name of the event that was emitted */
49
+ eventName: string;
50
+ /** The arguments emitted by the event */
51
+ args: Record<string, unknown>;
52
+ /** Indexed event parameters used for filtering and searching */
53
+ topics: Hex[];
46
54
  }
47
55
  /**
48
56
  * Represents the structure of a blockchain transaction receipt
49
57
  */
50
58
  interface TransactionReceipt extends TransactionReceipt$1<string, number, "Success" | "Reverted"> {
51
- /** The raw reason for transaction reversion, if applicable */
52
- revertReason: string;
53
- /** Human-readable version of the revert reason */
54
- revertReasonDecoded: string;
55
- /** Array of events emitted during the transaction */
56
- events: TransactionEvent[];
57
- /** The address of the contract deployed in the transaction */
58
- contractAddress: Address;
59
+ /** The raw reason for transaction reversion, if applicable */
60
+ revertReason: string;
61
+ /** Human-readable version of the revert reason */
62
+ revertReasonDecoded: string;
63
+ /** Array of events emitted during the transaction */
64
+ events: TransactionEvent[];
65
+ /** The address of the contract deployed in the transaction */
66
+ contractAddress: Address;
59
67
  }
60
68
  /**
61
69
  * Represents the structure of a blockchain transaction with its receipt
62
70
  */
63
71
  interface Transaction {
64
- receipt: TransactionReceipt;
65
- /** The hash of the transaction (duplicate of receipt.transactionHash) */
66
- transactionHash: string;
67
- /** The sender address (duplicate of receipt.from) */
68
- from: string;
69
- /** Timestamp when the transaction was created */
70
- createdAt: string;
71
- /** The contract address involved in the transaction */
72
- address: string;
73
- /** The name of the function called in the transaction */
74
- functionName: string;
75
- /** Whether the transaction is a contract deployment */
76
- isContract: boolean;
72
+ receipt: TransactionReceipt;
73
+ /** The hash of the transaction (duplicate of receipt.transactionHash) */
74
+ transactionHash: string;
75
+ /** The sender address (duplicate of receipt.from) */
76
+ from: string;
77
+ /** Timestamp when the transaction was created */
78
+ createdAt: string;
79
+ /** The contract address involved in the transaction */
80
+ address: string;
81
+ /** The name of the function called in the transaction */
82
+ functionName: string;
83
+ /** Whether the transaction is a contract deployment */
84
+ isContract: boolean;
77
85
  }
78
86
  /**
79
87
  * Options for waiting for a transaction receipt
80
88
  */
81
89
  interface WaitForTransactionReceiptOptions extends WebsocketClientOptions {
82
- /** Optional timeout in milliseconds before the operation fails */
83
- timeout?: number;
90
+ /** Optional timeout in milliseconds before the operation fails */
91
+ timeout?: number;
84
92
  }
85
93
  /**
86
94
  * Waits for a blockchain transaction receipt by subscribing to transaction updates via GraphQL.
@@ -102,22 +110,31 @@ interface WaitForTransactionReceiptOptions extends WebsocketClientOptions {
102
110
  */
103
111
  declare function waitForTransactionReceipt(transactionHash: string, options: WaitForTransactionReceiptOptions): Promise<Transaction>;
104
112
 
113
+ //#endregion
114
+ //#region src/utils/wallet-verification-challenge.d.ts
115
+ /**
116
+ * Custom error class for challenge-related errors
117
+ */
118
+ declare class ChallengeError extends Error {
119
+ readonly code: string;
120
+ constructor(message: string, code: string);
121
+ }
105
122
  /**
106
123
  * Options for handling a wallet verification challenge
107
124
  */
108
125
  interface HandleWalletVerificationChallengeOptions<Setup extends AbstractSetupSchema> {
109
- /** The portal client instance */
110
- portalClient: GraphQLClient;
111
- /** The GraphQL query builder */
112
- portalGraphql: initGraphQLTada<Setup>;
113
- /** The ID of the verification challenge */
114
- verificationId: string;
115
- /** The wallet address to verify */
116
- userWalletAddress: Address;
117
- /** The verification code provided by the user */
118
- code: string | number;
119
- /** The type of verification being performed */
120
- verificationType: "otp" | "secret-code" | "pincode";
126
+ /** The portal client instance */
127
+ portalClient: GraphQLClient;
128
+ /** The GraphQL query builder */
129
+ portalGraphql: initGraphQLTada<Setup>;
130
+ /** The ID of the verification challenge */
131
+ verificationId: string;
132
+ /** The wallet address to verify */
133
+ userWalletAddress: Address;
134
+ /** The verification code provided by the user */
135
+ code: string | number;
136
+ /** The type of verification being performed */
137
+ verificationType: "otp" | "secret-code" | "pincode";
121
138
  }
122
139
  /**
123
140
  * Handles a wallet verification challenge by generating an appropriate response
@@ -143,11 +160,20 @@ interface HandleWalletVerificationChallengeOptions<Setup extends AbstractSetupSc
143
160
  * verificationType: "otp"
144
161
  * });
145
162
  */
146
- declare function handleWalletVerificationChallenge<const Setup extends AbstractSetupSchema>({ portalClient, portalGraphql, verificationId, userWalletAddress, code, verificationType, }: HandleWalletVerificationChallengeOptions<Setup>): Promise<{
147
- challengeResponse: string;
148
- verificationId?: string;
163
+ declare function handleWalletVerificationChallenge<const Setup extends AbstractSetupSchema>({
164
+ portalClient,
165
+ portalGraphql,
166
+ verificationId,
167
+ userWalletAddress,
168
+ code,
169
+ verificationType
170
+ }: HandleWalletVerificationChallengeOptions<Setup>): Promise<{
171
+ challengeResponse: string;
172
+ verificationId?: string;
149
173
  }>;
150
174
 
175
+ //#endregion
176
+ //#region src/portal.d.ts
151
177
  /**
152
178
  * Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.
153
179
  */
@@ -156,16 +182,16 @@ type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];
156
182
  * Schema for validating Portal client configuration options.
157
183
  */
158
184
  declare const ClientOptionsSchema: z.ZodObject<{
159
- instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
160
- accessToken: z.ZodOptional<z.ZodString>;
161
- cache: z.ZodOptional<z.ZodEnum<{
162
- default: "default";
163
- "force-cache": "force-cache";
164
- "no-cache": "no-cache";
165
- "no-store": "no-store";
166
- "only-if-cached": "only-if-cached";
167
- reload: "reload";
168
- }>>;
185
+ instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
186
+ accessToken: z.ZodOptional<z.ZodString>;
187
+ cache: z.ZodOptional<z.ZodEnum<{
188
+ default: "default";
189
+ "force-cache": "force-cache";
190
+ "no-cache": "no-cache";
191
+ "no-store": "no-store";
192
+ "only-if-cached": "only-if-cached";
193
+ reload: "reload";
194
+ }>>;
169
195
  }, z.core.$strip>;
170
196
  /**
171
197
  * Type representing the validated client options.
@@ -217,8 +243,10 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
217
243
  * const result = await portalClient.request(query);
218
244
  */
219
245
  declare function createPortalClient<const Setup extends AbstractSetupSchema>(options: ClientOptions, clientOptions?: RequestConfig): {
220
- client: GraphQLClient;
221
- graphql: initGraphQLTada<Setup>;
246
+ client: GraphQLClient;
247
+ graphql: initGraphQLTada<Setup>;
222
248
  };
223
249
 
224
- export { type ClientOptions, ClientOptionsSchema, type HandleWalletVerificationChallengeOptions, type RequestConfig, type Transaction, type TransactionEvent, type TransactionReceipt, type WaitForTransactionReceiptOptions, type WebsocketClientOptions, createPortalClient, getWebsocketClient, handleWalletVerificationChallenge, waitForTransactionReceipt };
250
+ //#endregion
251
+ export { ClientOptions, ClientOptionsSchema, FragmentOf, HandleWalletVerificationChallengeOptions, RequestConfig, ResultOf, Transaction, TransactionEvent, TransactionReceipt, VariablesOf, WaitForTransactionReceiptOptions, WebsocketClientOptions, createPortalClient, getWebsocketClient, handleWalletVerificationChallenge, readFragment, waitForTransactionReceipt };
252
+ //# sourceMappingURL=portal.d.ts.map