@settlemint/sdk-portal 2.3.2-prfd3a56ad → 2.3.3

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,137 +1,94 @@
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 { Address, TransactionReceipt, Hex } 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
8
  /**
9
- * Options for handling a wallet verification challenge
10
- *
11
- * @typedef {Object} HandleWalletVerificationChallengeOptions
12
- * @template {AbstractSetupSchema} Setup - The GraphQL schema setup type
13
- * @property {GraphQLClient} portalClient - The portal client instance
14
- * @property {initGraphQLTada<Setup>} portalGraphql - The GraphQL query builder
15
- * @property {string} verificationId - The ID of the verification challenge
16
- * @property {Address} userWalletAddress - The wallet address to verify
17
- * @property {string | number} code - The verification code provided by the user
18
- * @property {"otp" | "secret-code" | "pincode"} verificationType - The type of verification being performed
19
- */
20
- interface HandleWalletVerificationChallengeOptions<Setup extends AbstractSetupSchema> {
21
- portalClient: GraphQLClient;
22
- portalGraphql: initGraphQLTada<Setup>;
23
- verificationId: string;
24
- userWalletAddress: Address;
25
- code: string | number;
26
- verificationType: "otp" | "secret-code" | "pincode";
27
- }
28
- /**
29
- * Handles a wallet verification challenge by generating an appropriate response
30
- *
31
- * @param options - The options for handling the wallet verification challenge
32
- * @returns Promise resolving to an object containing the challenge response and optionally the verification ID
33
- * @throws {ChallengeError} If the challenge cannot be created or is invalid
34
- * @example
35
- * import { createPortalClient } from "@settlemint/sdk-portal";
36
- * import { handleWalletVerificationChallenge } from "@settlemint/sdk-portal";
37
- *
38
- * const { client, graphql } = createPortalClient({
39
- * instance: "https://portal.example.com/graphql",
40
- * accessToken: "your-access-token"
41
- * });
42
- *
43
- * const result = await handleWalletVerificationChallenge({
44
- * portalClient: client,
45
- * portalGraphql: graphql,
46
- * verificationId: "verification-123",
47
- * userWalletAddress: "0x123...",
48
- * code: "123456",
49
- * verificationType: "otp"
50
- * });
51
- */
52
- declare function handleWalletVerificationChallenge<const Setup extends AbstractSetupSchema>({ portalClient, portalGraphql, verificationId, userWalletAddress, code, verificationType, }: HandleWalletVerificationChallengeOptions<Setup>): Promise<{
53
- challengeResponse: string;
54
- verificationId?: string;
55
- }>;
56
-
9
+ * Options for the GraphQL WebSocket client
10
+ */
57
11
  /**
58
12
  * Options for the GraphQL WebSocket client
59
- *
60
- * @typedef {Object} WebsocketClientOptions
61
- * @property {string} portalGraphqlEndpoint - The GraphQL endpoint URL for the Portal API
62
- * @property {string} accessToken - The access token for authentication with the Portal API
63
13
  */
64
14
  interface WebsocketClientOptions {
65
- portalGraphqlEndpoint: string;
66
- 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;
67
23
  }
68
24
  /**
69
25
  * Creates a GraphQL WebSocket client for the Portal API
70
26
  *
71
27
  * @param {WebsocketClientOptions} options - The options for the client
72
- * @param {string} options.portalGraphqlEndpoint - The GraphQL endpoint URL for the Portal API
73
- * @param {string} options.accessToken - The access token for authentication with the Portal API
74
28
  * @returns {Client} The GraphQL WebSocket client
29
+ * @example
30
+ * import { getWebsocketClient } from "@settlemint/sdk-portal";
31
+ *
32
+ * const client = getWebsocketClient({
33
+ * portalGraphqlEndpoint: "https://portal.settlemint.com/graphql",
34
+ * accessToken: "your-access-token",
35
+ * });
75
36
  */
76
- declare function getWebsocketClient({ portalGraphqlEndpoint, accessToken }: WebsocketClientOptions): graphql_ws.Client;
37
+ declare function getWebsocketClient({
38
+ portalGraphqlEndpoint,
39
+ accessToken
40
+ }: WebsocketClientOptions): graphql_ws0.Client;
77
41
 
42
+ //#endregion
43
+ //#region src/utils/wait-for-transaction-receipt.d.ts
78
44
  /**
79
45
  * Represents an event emitted during a transaction execution
80
- *
81
- * @typedef {Object} TransactionEvent
82
- * @property {string} eventName - The name of the event that was emitted
83
- * @property {Record<string, unknown>} args - The arguments emitted by the event
84
- * @property {Hex[]} topics - Indexed event parameters used for filtering and searching
85
46
  */
86
47
  interface TransactionEvent {
87
- eventName: string;
88
- args: Record<string, unknown>;
89
- 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[];
54
+ }
55
+ /**
56
+ * Represents the structure of a blockchain transaction receipt
57
+ */
58
+ interface TransactionReceipt extends TransactionReceipt$1<string, number, "Success" | "Reverted"> {
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;
90
67
  }
91
68
  /**
92
69
  * Represents the structure of a blockchain transaction with its receipt
93
- *
94
- * @typedef {Object} Transaction
95
- * @property {Object} receipt - The transaction receipt details
96
- * @property {string} receipt.transactionHash - The hash of the transaction
97
- * @property {string} receipt.to - The recipient address of the transaction
98
- * @property {string} receipt.status - The status of the transaction (success/failure)
99
- * @property {string} receipt.from - The sender address of the transaction
100
- * @property {string} receipt.type - The type of the transaction
101
- * @property {string} receipt.revertReason - The reason for transaction reversion, if applicable
102
- * @property {string} receipt.revertReasonDecoded - Human-readable version of the revert reason
103
- * @property {string} receipt.contractAddress - The address of the contract deployed in the transaction
104
- * @property {string[]} receipt.logs - Array of log entries generated by the transaction
105
- * @property {TransactionEvent[]} receipt.events - Array of events emitted during the transaction
106
- * @property {string} transactionHash - The hash of the transaction (duplicate of receipt.transactionHash)
107
- * @property {string} from - The sender address (duplicate of receipt.from)
108
- * @property {string} createdAt - Timestamp when the transaction was created
109
- * @property {string} address - The contract address involved in the transaction
110
- * @property {string} functionName - The name of the function called in the transaction
111
- * @property {boolean} isContract - Whether the transaction is a contract deployment
112
70
  */
113
71
  interface Transaction {
114
- receipt: TransactionReceipt<string, number, "Success" | "Reverted"> & {
115
- revertReason: string;
116
- revertReasonDecoded: string;
117
- events: TransactionEvent[];
118
- contractAddress: string;
119
- };
120
- transactionHash: string;
121
- from: string;
122
- createdAt: string;
123
- address: string;
124
- functionName: string;
125
- 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;
126
85
  }
127
86
  /**
128
87
  * Options for waiting for a transaction receipt
129
- *
130
- * @typedef {Object} WaitForTransactionReceiptOptions
131
- * @property {number} [timeout] - Optional timeout in milliseconds before the operation fails
132
88
  */
133
89
  interface WaitForTransactionReceiptOptions extends WebsocketClientOptions {
134
- timeout?: number;
90
+ /** Optional timeout in milliseconds before the operation fails */
91
+ timeout?: number;
135
92
  }
136
93
  /**
137
94
  * Waits for a blockchain transaction receipt by subscribing to transaction updates via GraphQL.
@@ -153,6 +110,70 @@ interface WaitForTransactionReceiptOptions extends WebsocketClientOptions {
153
110
  */
154
111
  declare function waitForTransactionReceipt(transactionHash: string, options: WaitForTransactionReceiptOptions): Promise<Transaction>;
155
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
+ }
122
+ /**
123
+ * Options for handling a wallet verification challenge
124
+ */
125
+ interface HandleWalletVerificationChallengeOptions<Setup extends AbstractSetupSchema> {
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";
138
+ }
139
+ /**
140
+ * Handles a wallet verification challenge by generating an appropriate response
141
+ *
142
+ * @param options - The options for handling the wallet verification challenge
143
+ * @returns Promise resolving to an object containing the challenge response and optionally the verification ID
144
+ * @throws {ChallengeError} If the challenge cannot be created or is invalid
145
+ * @example
146
+ * import { createPortalClient } from "@settlemint/sdk-portal";
147
+ * import { handleWalletVerificationChallenge } from "@settlemint/sdk-portal";
148
+ *
149
+ * const { client, graphql } = createPortalClient({
150
+ * instance: "https://portal.example.com/graphql",
151
+ * accessToken: "your-access-token"
152
+ * });
153
+ *
154
+ * const result = await handleWalletVerificationChallenge({
155
+ * portalClient: client,
156
+ * portalGraphql: graphql,
157
+ * verificationId: "verification-123",
158
+ * userWalletAddress: "0x123...",
159
+ * code: "123456",
160
+ * verificationType: "otp"
161
+ * });
162
+ */
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;
173
+ }>;
174
+
175
+ //#endregion
176
+ //#region src/portal.d.ts
156
177
  /**
157
178
  * Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.
158
179
  */
@@ -161,16 +182,16 @@ type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];
161
182
  * Schema for validating Portal client configuration options.
162
183
  */
163
184
  declare const ClientOptionsSchema: z.ZodObject<{
164
- instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
165
- accessToken: z.ZodOptional<z.ZodString>;
166
- cache: z.ZodOptional<z.ZodEnum<{
167
- default: "default";
168
- "force-cache": "force-cache";
169
- "no-cache": "no-cache";
170
- "no-store": "no-store";
171
- "only-if-cached": "only-if-cached";
172
- reload: "reload";
173
- }>>;
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
+ }>>;
174
195
  }, z.core.$strip>;
175
196
  /**
176
197
  * Type representing the validated client options.
@@ -222,8 +243,10 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
222
243
  * const result = await portalClient.request(query);
223
244
  */
224
245
  declare function createPortalClient<const Setup extends AbstractSetupSchema>(options: ClientOptions, clientOptions?: RequestConfig): {
225
- client: GraphQLClient;
226
- graphql: initGraphQLTada<Setup>;
246
+ client: GraphQLClient;
247
+ graphql: initGraphQLTada<Setup>;
227
248
  };
228
249
 
229
- export { type ClientOptions, ClientOptionsSchema, type HandleWalletVerificationChallengeOptions, type RequestConfig, type Transaction, type TransactionEvent, 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,137 +1,94 @@
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 { Address, TransactionReceipt, Hex } 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
8
  /**
9
- * Options for handling a wallet verification challenge
10
- *
11
- * @typedef {Object} HandleWalletVerificationChallengeOptions
12
- * @template {AbstractSetupSchema} Setup - The GraphQL schema setup type
13
- * @property {GraphQLClient} portalClient - The portal client instance
14
- * @property {initGraphQLTada<Setup>} portalGraphql - The GraphQL query builder
15
- * @property {string} verificationId - The ID of the verification challenge
16
- * @property {Address} userWalletAddress - The wallet address to verify
17
- * @property {string | number} code - The verification code provided by the user
18
- * @property {"otp" | "secret-code" | "pincode"} verificationType - The type of verification being performed
19
- */
20
- interface HandleWalletVerificationChallengeOptions<Setup extends AbstractSetupSchema> {
21
- portalClient: GraphQLClient;
22
- portalGraphql: initGraphQLTada<Setup>;
23
- verificationId: string;
24
- userWalletAddress: Address;
25
- code: string | number;
26
- verificationType: "otp" | "secret-code" | "pincode";
27
- }
28
- /**
29
- * Handles a wallet verification challenge by generating an appropriate response
30
- *
31
- * @param options - The options for handling the wallet verification challenge
32
- * @returns Promise resolving to an object containing the challenge response and optionally the verification ID
33
- * @throws {ChallengeError} If the challenge cannot be created or is invalid
34
- * @example
35
- * import { createPortalClient } from "@settlemint/sdk-portal";
36
- * import { handleWalletVerificationChallenge } from "@settlemint/sdk-portal";
37
- *
38
- * const { client, graphql } = createPortalClient({
39
- * instance: "https://portal.example.com/graphql",
40
- * accessToken: "your-access-token"
41
- * });
42
- *
43
- * const result = await handleWalletVerificationChallenge({
44
- * portalClient: client,
45
- * portalGraphql: graphql,
46
- * verificationId: "verification-123",
47
- * userWalletAddress: "0x123...",
48
- * code: "123456",
49
- * verificationType: "otp"
50
- * });
51
- */
52
- declare function handleWalletVerificationChallenge<const Setup extends AbstractSetupSchema>({ portalClient, portalGraphql, verificationId, userWalletAddress, code, verificationType, }: HandleWalletVerificationChallengeOptions<Setup>): Promise<{
53
- challengeResponse: string;
54
- verificationId?: string;
55
- }>;
56
-
9
+ * Options for the GraphQL WebSocket client
10
+ */
57
11
  /**
58
12
  * Options for the GraphQL WebSocket client
59
- *
60
- * @typedef {Object} WebsocketClientOptions
61
- * @property {string} portalGraphqlEndpoint - The GraphQL endpoint URL for the Portal API
62
- * @property {string} accessToken - The access token for authentication with the Portal API
63
13
  */
64
14
  interface WebsocketClientOptions {
65
- portalGraphqlEndpoint: string;
66
- 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;
67
23
  }
68
24
  /**
69
25
  * Creates a GraphQL WebSocket client for the Portal API
70
26
  *
71
27
  * @param {WebsocketClientOptions} options - The options for the client
72
- * @param {string} options.portalGraphqlEndpoint - The GraphQL endpoint URL for the Portal API
73
- * @param {string} options.accessToken - The access token for authentication with the Portal API
74
28
  * @returns {Client} The GraphQL WebSocket client
29
+ * @example
30
+ * import { getWebsocketClient } from "@settlemint/sdk-portal";
31
+ *
32
+ * const client = getWebsocketClient({
33
+ * portalGraphqlEndpoint: "https://portal.settlemint.com/graphql",
34
+ * accessToken: "your-access-token",
35
+ * });
75
36
  */
76
- declare function getWebsocketClient({ portalGraphqlEndpoint, accessToken }: WebsocketClientOptions): graphql_ws.Client;
37
+ declare function getWebsocketClient({
38
+ portalGraphqlEndpoint,
39
+ accessToken
40
+ }: WebsocketClientOptions): graphql_ws0.Client;
77
41
 
42
+ //#endregion
43
+ //#region src/utils/wait-for-transaction-receipt.d.ts
78
44
  /**
79
45
  * Represents an event emitted during a transaction execution
80
- *
81
- * @typedef {Object} TransactionEvent
82
- * @property {string} eventName - The name of the event that was emitted
83
- * @property {Record<string, unknown>} args - The arguments emitted by the event
84
- * @property {Hex[]} topics - Indexed event parameters used for filtering and searching
85
46
  */
86
47
  interface TransactionEvent {
87
- eventName: string;
88
- args: Record<string, unknown>;
89
- 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[];
54
+ }
55
+ /**
56
+ * Represents the structure of a blockchain transaction receipt
57
+ */
58
+ interface TransactionReceipt extends TransactionReceipt$1<string, number, "Success" | "Reverted"> {
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;
90
67
  }
91
68
  /**
92
69
  * Represents the structure of a blockchain transaction with its receipt
93
- *
94
- * @typedef {Object} Transaction
95
- * @property {Object} receipt - The transaction receipt details
96
- * @property {string} receipt.transactionHash - The hash of the transaction
97
- * @property {string} receipt.to - The recipient address of the transaction
98
- * @property {string} receipt.status - The status of the transaction (success/failure)
99
- * @property {string} receipt.from - The sender address of the transaction
100
- * @property {string} receipt.type - The type of the transaction
101
- * @property {string} receipt.revertReason - The reason for transaction reversion, if applicable
102
- * @property {string} receipt.revertReasonDecoded - Human-readable version of the revert reason
103
- * @property {string} receipt.contractAddress - The address of the contract deployed in the transaction
104
- * @property {string[]} receipt.logs - Array of log entries generated by the transaction
105
- * @property {TransactionEvent[]} receipt.events - Array of events emitted during the transaction
106
- * @property {string} transactionHash - The hash of the transaction (duplicate of receipt.transactionHash)
107
- * @property {string} from - The sender address (duplicate of receipt.from)
108
- * @property {string} createdAt - Timestamp when the transaction was created
109
- * @property {string} address - The contract address involved in the transaction
110
- * @property {string} functionName - The name of the function called in the transaction
111
- * @property {boolean} isContract - Whether the transaction is a contract deployment
112
70
  */
113
71
  interface Transaction {
114
- receipt: TransactionReceipt<string, number, "Success" | "Reverted"> & {
115
- revertReason: string;
116
- revertReasonDecoded: string;
117
- events: TransactionEvent[];
118
- contractAddress: string;
119
- };
120
- transactionHash: string;
121
- from: string;
122
- createdAt: string;
123
- address: string;
124
- functionName: string;
125
- 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;
126
85
  }
127
86
  /**
128
87
  * Options for waiting for a transaction receipt
129
- *
130
- * @typedef {Object} WaitForTransactionReceiptOptions
131
- * @property {number} [timeout] - Optional timeout in milliseconds before the operation fails
132
88
  */
133
89
  interface WaitForTransactionReceiptOptions extends WebsocketClientOptions {
134
- timeout?: number;
90
+ /** Optional timeout in milliseconds before the operation fails */
91
+ timeout?: number;
135
92
  }
136
93
  /**
137
94
  * Waits for a blockchain transaction receipt by subscribing to transaction updates via GraphQL.
@@ -153,6 +110,70 @@ interface WaitForTransactionReceiptOptions extends WebsocketClientOptions {
153
110
  */
154
111
  declare function waitForTransactionReceipt(transactionHash: string, options: WaitForTransactionReceiptOptions): Promise<Transaction>;
155
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
+ }
122
+ /**
123
+ * Options for handling a wallet verification challenge
124
+ */
125
+ interface HandleWalletVerificationChallengeOptions<Setup extends AbstractSetupSchema> {
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";
138
+ }
139
+ /**
140
+ * Handles a wallet verification challenge by generating an appropriate response
141
+ *
142
+ * @param options - The options for handling the wallet verification challenge
143
+ * @returns Promise resolving to an object containing the challenge response and optionally the verification ID
144
+ * @throws {ChallengeError} If the challenge cannot be created or is invalid
145
+ * @example
146
+ * import { createPortalClient } from "@settlemint/sdk-portal";
147
+ * import { handleWalletVerificationChallenge } from "@settlemint/sdk-portal";
148
+ *
149
+ * const { client, graphql } = createPortalClient({
150
+ * instance: "https://portal.example.com/graphql",
151
+ * accessToken: "your-access-token"
152
+ * });
153
+ *
154
+ * const result = await handleWalletVerificationChallenge({
155
+ * portalClient: client,
156
+ * portalGraphql: graphql,
157
+ * verificationId: "verification-123",
158
+ * userWalletAddress: "0x123...",
159
+ * code: "123456",
160
+ * verificationType: "otp"
161
+ * });
162
+ */
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;
173
+ }>;
174
+
175
+ //#endregion
176
+ //#region src/portal.d.ts
156
177
  /**
157
178
  * Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.
158
179
  */
@@ -161,16 +182,16 @@ type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];
161
182
  * Schema for validating Portal client configuration options.
162
183
  */
163
184
  declare const ClientOptionsSchema: z.ZodObject<{
164
- instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
165
- accessToken: z.ZodOptional<z.ZodString>;
166
- cache: z.ZodOptional<z.ZodEnum<{
167
- default: "default";
168
- "force-cache": "force-cache";
169
- "no-cache": "no-cache";
170
- "no-store": "no-store";
171
- "only-if-cached": "only-if-cached";
172
- reload: "reload";
173
- }>>;
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
+ }>>;
174
195
  }, z.core.$strip>;
175
196
  /**
176
197
  * Type representing the validated client options.
@@ -222,8 +243,10 @@ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
222
243
  * const result = await portalClient.request(query);
223
244
  */
224
245
  declare function createPortalClient<const Setup extends AbstractSetupSchema>(options: ClientOptions, clientOptions?: RequestConfig): {
225
- client: GraphQLClient;
226
- graphql: initGraphQLTada<Setup>;
246
+ client: GraphQLClient;
247
+ graphql: initGraphQLTada<Setup>;
227
248
  };
228
249
 
229
- export { type ClientOptions, ClientOptionsSchema, type HandleWalletVerificationChallengeOptions, type RequestConfig, type Transaction, type TransactionEvent, 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