@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/browser/portal.d.ts +252 -0
- package/dist/browser/portal.js +294 -0
- package/dist/browser/portal.js.map +1 -0
- package/dist/portal.cjs +265 -154
- package/dist/portal.cjs.map +1 -1
- package/dist/portal.d.cts +100 -72
- package/dist/portal.d.ts +100 -72
- package/dist/portal.js +294 -0
- package/dist/portal.js.map +1 -0
- package/package.json +6 -6
- package/dist/portal.mjs +0 -186
- package/dist/portal.mjs.map +0 -1
package/dist/portal.d.cts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { AbstractSetupSchema, initGraphQLTada } from
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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({
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
83
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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>({
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
|
|
221
|
-
|
|
246
|
+
client: GraphQLClient;
|
|
247
|
+
graphql: initGraphQLTada<Setup>;
|
|
222
248
|
};
|
|
223
249
|
|
|
224
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { TransactionReceipt as TransactionReceipt$1
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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({
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
83
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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>({
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
|
|
221
|
-
|
|
246
|
+
client: GraphQLClient;
|
|
247
|
+
graphql: initGraphQLTada<Setup>;
|
|
222
248
|
};
|
|
223
249
|
|
|
224
|
-
|
|
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
|