@settlemint/sdk-portal 2.3.2 → 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/README.md +337 -19
- 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 +281 -172
- package/dist/portal.cjs.map +1 -1
- package/dist/portal.d.cts +145 -115
- package/dist/portal.d.ts +145 -115
- package/dist/portal.js +294 -0
- package/dist/portal.js.map +1 -0
- package/package.json +6 -6
- package/dist/portal.mjs +0 -188
- package/dist/portal.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
- [Examples](#examples)
|
|
31
31
|
- [Deploy contract](#deploy-contract)
|
|
32
32
|
- [Get pending transactions](#get-pending-transactions)
|
|
33
|
+
- [Monitoring alerting](#monitoring-alerting)
|
|
33
34
|
- [Send transaction using hd wallet](#send-transaction-using-hd-wallet)
|
|
34
35
|
- [API Reference](#api-reference)
|
|
35
36
|
- [Functions](#functions)
|
|
@@ -40,6 +41,8 @@
|
|
|
40
41
|
- [Interfaces](#interfaces)
|
|
41
42
|
- [HandleWalletVerificationChallengeOptions\<Setup\>](#handlewalletverificationchallengeoptionssetup)
|
|
42
43
|
- [Transaction](#transaction)
|
|
44
|
+
- [TransactionEvent](#transactionevent)
|
|
45
|
+
- [TransactionReceipt](#transactionreceipt)
|
|
43
46
|
- [WaitForTransactionReceiptOptions](#waitfortransactionreceiptoptions)
|
|
44
47
|
- [WebsocketClientOptions](#websocketclientoptions)
|
|
45
48
|
- [Type Aliases](#type-aliases)
|
|
@@ -219,6 +222,236 @@ const query = portalGraphql(`
|
|
|
219
222
|
const result = await portalClient.request(query);
|
|
220
223
|
console.log(`There are ${result.getPendingTransactions?.count} pending transactions`);
|
|
221
224
|
|
|
225
|
+
```
|
|
226
|
+
### Monitoring alerting
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
/**
|
|
230
|
+
* This example demonstrates how to implement real-time transaction monitoring and alerting.
|
|
231
|
+
*
|
|
232
|
+
* The process involves:
|
|
233
|
+
* 1. Creating a WebSocket subscription to monitor all blockchain transactions
|
|
234
|
+
* 2. Setting up custom handlers for different monitoring scenarios
|
|
235
|
+
* 3. Processing transactions in real-time as they are confirmed
|
|
236
|
+
* 4. Implementing specific monitoring functions for addresses, events, and failures
|
|
237
|
+
* 5. Triggering alerts based on predefined conditions
|
|
238
|
+
*
|
|
239
|
+
* This pattern is useful for applications that need to:
|
|
240
|
+
* - Detect suspicious activities for security purposes
|
|
241
|
+
* - Track high-value transfers or specific contract interactions
|
|
242
|
+
* - Monitor for failed transactions that require attention
|
|
243
|
+
* - Implement compliance reporting and audit trails
|
|
244
|
+
* - Build automated workflows that respond to on-chain events
|
|
245
|
+
* - Provide real-time notifications to stakeholders
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
import type { FormattedExecutionResult } from "graphql";
|
|
249
|
+
import { type Transaction, type WebsocketClientOptions, getWebsocketClient } from "../portal.js"; // Replace this path with "@settlemint/sdk-portal"
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Handlers for different monitoring scenarios
|
|
253
|
+
* You can implement your own handlers
|
|
254
|
+
*/
|
|
255
|
+
export type AlertHandlers = {
|
|
256
|
+
onAddressActivity: (transaction: Transaction, addresses: string[]) => void;
|
|
257
|
+
onEvent: (transaction: Transaction, eventNames: string[]) => void;
|
|
258
|
+
onFailure: (transaction: Transaction) => void;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Monitors all blockchain transactions by subscribing to transaction updates via GraphQL.
|
|
263
|
+
* This function continuously logs all transaction receipts as they are received.
|
|
264
|
+
*
|
|
265
|
+
* @param options - Configuration options for connecting to the Portal API
|
|
266
|
+
* @param handlers - Optional handlers for different monitoring scenarios
|
|
267
|
+
* @throws Error if the subscription fails
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* import { monitorAllTransactions } from "@settlemint/sdk-portal";
|
|
271
|
+
*
|
|
272
|
+
* monitorAllTransactions({
|
|
273
|
+
* portalGraphqlEndpoint: "https://example.settlemint.com/graphql",
|
|
274
|
+
* accessToken: "your-access-token"
|
|
275
|
+
* }, {
|
|
276
|
+
* onAddressActivity: (tx, address) => {
|
|
277
|
+
* console.log(`Address ${address} was involved in transaction ${tx.transactionHash}`);
|
|
278
|
+
* },
|
|
279
|
+
* onEvent: (tx, eventName) => {
|
|
280
|
+
* console.log(`Event ${eventName} detected in transaction ${tx.transactionHash}`);
|
|
281
|
+
* },
|
|
282
|
+
* onFailure: (tx, reason) => {
|
|
283
|
+
* console.log(`Transaction ${tx.transactionHash} failed: ${reason}`);
|
|
284
|
+
* }
|
|
285
|
+
* });
|
|
286
|
+
*/
|
|
287
|
+
export function monitorAllTransactions(options: WebsocketClientOptions, handlers: AlertHandlers) {
|
|
288
|
+
const wsClient = getWebsocketClient(options);
|
|
289
|
+
|
|
290
|
+
const subscription = wsClient.iterate<{
|
|
291
|
+
getProcessedTransactions: {
|
|
292
|
+
records: Transaction[];
|
|
293
|
+
};
|
|
294
|
+
}>({
|
|
295
|
+
query: `subscription getProcessedTransactions {
|
|
296
|
+
getProcessedTransactions(pageSize: 1) {
|
|
297
|
+
records {
|
|
298
|
+
receipt {
|
|
299
|
+
transactionHash
|
|
300
|
+
to
|
|
301
|
+
status
|
|
302
|
+
from
|
|
303
|
+
type
|
|
304
|
+
revertReason
|
|
305
|
+
revertReasonDecoded
|
|
306
|
+
logs
|
|
307
|
+
events
|
|
308
|
+
contractAddress
|
|
309
|
+
}
|
|
310
|
+
transactionHash
|
|
311
|
+
from
|
|
312
|
+
createdAt
|
|
313
|
+
address
|
|
314
|
+
functionName
|
|
315
|
+
isContract
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}`,
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
// Start the monitoring process
|
|
322
|
+
processSubscription(subscription, handlers);
|
|
323
|
+
|
|
324
|
+
return subscription;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Internal helper to process the subscription stream
|
|
329
|
+
*/
|
|
330
|
+
async function processSubscription(
|
|
331
|
+
subscription: AsyncIterable<
|
|
332
|
+
FormattedExecutionResult<
|
|
333
|
+
{
|
|
334
|
+
getProcessedTransactions: {
|
|
335
|
+
records: Transaction[];
|
|
336
|
+
};
|
|
337
|
+
},
|
|
338
|
+
unknown
|
|
339
|
+
>
|
|
340
|
+
>,
|
|
341
|
+
handlers: AlertHandlers,
|
|
342
|
+
) {
|
|
343
|
+
(async () => {
|
|
344
|
+
for await (const result of subscription) {
|
|
345
|
+
if (result?.data?.getProcessedTransactions?.records) {
|
|
346
|
+
const records = result.data.getProcessedTransactions.records;
|
|
347
|
+
const transaction = records.at(-1);
|
|
348
|
+
|
|
349
|
+
if (transaction) {
|
|
350
|
+
processTransaction(transaction, handlers);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
})();
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Process a single transaction with the configured handlers
|
|
359
|
+
*/
|
|
360
|
+
function processTransaction(transaction: Transaction, handlers: AlertHandlers) {
|
|
361
|
+
// Monitor specific addresses (example addresses)
|
|
362
|
+
handlers.onAddressActivity(transaction, ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e"]);
|
|
363
|
+
|
|
364
|
+
// Monitor for specific events
|
|
365
|
+
handlers.onEvent(transaction, ["Transfer", "Approval"]);
|
|
366
|
+
|
|
367
|
+
// Monitor for failed transactions
|
|
368
|
+
handlers.onFailure(transaction);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Monitors transactions from or to specific addresses.
|
|
373
|
+
*
|
|
374
|
+
* @param transaction - The transaction to check
|
|
375
|
+
* @param addresses - The addresses to monitor
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* import { monitorSpecificAddresses } from "@settlemint/sdk-portal";
|
|
379
|
+
*
|
|
380
|
+
* monitorSpecificAddresses(transaction, ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e"]);
|
|
381
|
+
*/
|
|
382
|
+
export function monitorSpecificAddresses(transaction: Transaction, addresses: string[]) {
|
|
383
|
+
const { from, address } = transaction;
|
|
384
|
+
const { to } = transaction.receipt;
|
|
385
|
+
const isInvolved = addresses.some((address) => [from, to].includes(address));
|
|
386
|
+
|
|
387
|
+
if (isInvolved) {
|
|
388
|
+
notify(`[ADDRESS] Address ${address} was involved in transaction ${transaction.transactionHash}`);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Monitors transactions for specific contract events.
|
|
394
|
+
*
|
|
395
|
+
* @param transaction - The transaction to check
|
|
396
|
+
* @param eventNames - The event names to monitor
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* import { monitorContractEvents } from "@settlemint/sdk-portal";
|
|
400
|
+
*
|
|
401
|
+
* monitorContractEvents(transaction, ["Transfer", "Approval"]);
|
|
402
|
+
*/
|
|
403
|
+
export function monitorContractEvents(transaction: Transaction, eventNames: string[]) {
|
|
404
|
+
const events = transaction.receipt.events;
|
|
405
|
+
|
|
406
|
+
const eventDetected = events.find((event) => eventNames.includes(event.eventName));
|
|
407
|
+
if (eventDetected) {
|
|
408
|
+
notify(`[EVENT] Event ${eventDetected.eventName} detected in transaction ${transaction.transactionHash}`);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Monitors for failed transactions that require attention.
|
|
414
|
+
*
|
|
415
|
+
* @param transaction - The transaction to check
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* import { monitorFailedTransactions } from "@settlemint/sdk-portal";
|
|
419
|
+
*
|
|
420
|
+
* monitorFailedTransactions(transaction, "Unknown reason");
|
|
421
|
+
*/
|
|
422
|
+
export function monitorFailedTransactions(transaction: Transaction) {
|
|
423
|
+
const status = transaction.receipt?.status;
|
|
424
|
+
|
|
425
|
+
if (status === "Reverted") {
|
|
426
|
+
const reason = transaction.receipt.revertReasonDecoded;
|
|
427
|
+
notify(`[FAILED] Transaction ${transaction.transactionHash} failed: ${reason}`);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
const notify = (message: string) => {
|
|
432
|
+
console.log(message);
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Example usage - monitoring specific on-chain activity
|
|
437
|
+
*/
|
|
438
|
+
export function runMonitoringExample() {
|
|
439
|
+
// Basic usage
|
|
440
|
+
monitorAllTransactions(
|
|
441
|
+
{
|
|
442
|
+
portalGraphqlEndpoint: "https://example.settlemint.com/graphql",
|
|
443
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN!,
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
onAddressActivity: monitorSpecificAddresses,
|
|
447
|
+
onEvent: monitorContractEvents,
|
|
448
|
+
onFailure: monitorFailedTransactions,
|
|
449
|
+
},
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
runMonitoringExample();
|
|
454
|
+
|
|
222
455
|
```
|
|
223
456
|
### Send transaction using hd wallet
|
|
224
457
|
|
|
@@ -368,7 +601,7 @@ console.log("Transaction hash:", result.StableCoinFactoryCreate?.transactionHash
|
|
|
368
601
|
|
|
369
602
|
> **createPortalClient**\<`Setup`\>(`options`, `clientOptions?`): `object`
|
|
370
603
|
|
|
371
|
-
Defined in: [sdk/portal/src/portal.ts:
|
|
604
|
+
Defined in: [sdk/portal/src/portal.ts:72](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/portal.ts#L72)
|
|
372
605
|
|
|
373
606
|
Creates a Portal GraphQL client with the provided configuration.
|
|
374
607
|
|
|
@@ -382,8 +615,8 @@ Creates a Portal GraphQL client with the provided configuration.
|
|
|
382
615
|
|
|
383
616
|
| Parameter | Type | Description |
|
|
384
617
|
| ------ | ------ | ------ |
|
|
385
|
-
| `options` | \{ `accessToken
|
|
386
|
-
| `options.accessToken
|
|
618
|
+
| `options` | \{ `accessToken?`: `string`; `cache?`: `"default"` \| `"force-cache"` \| `"no-cache"` \| `"no-store"` \| `"only-if-cached"` \| `"reload"`; `instance`: `string`; \} | Configuration options for the Portal client |
|
|
619
|
+
| `options.accessToken?` | `string` | - |
|
|
387
620
|
| `options.cache?` | `"default"` \| `"force-cache"` \| `"no-cache"` \| `"no-store"` \| `"only-if-cached"` \| `"reload"` | - |
|
|
388
621
|
| `options.instance?` | `string` | - |
|
|
389
622
|
| `clientOptions?` | `RequestConfig` | Additional GraphQL client configuration options |
|
|
@@ -396,8 +629,8 @@ An object containing the configured GraphQL client and graphql helper function
|
|
|
396
629
|
|
|
397
630
|
| Name | Type | Defined in |
|
|
398
631
|
| ------ | ------ | ------ |
|
|
399
|
-
| `client` | `GraphQLClient` | [sdk/portal/src/portal.ts:
|
|
400
|
-
| `graphql` | `initGraphQLTada`\<`Setup`\> | [sdk/portal/src/portal.ts:
|
|
632
|
+
| `client` | `GraphQLClient` | [sdk/portal/src/portal.ts:76](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/portal.ts#L76) |
|
|
633
|
+
| `graphql` | `initGraphQLTada`\<`Setup`\> | [sdk/portal/src/portal.ts:77](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/portal.ts#L77) |
|
|
401
634
|
|
|
402
635
|
##### Throws
|
|
403
636
|
|
|
@@ -449,7 +682,7 @@ const result = await portalClient.request(query);
|
|
|
449
682
|
|
|
450
683
|
> **getWebsocketClient**(`options`): `Client`
|
|
451
684
|
|
|
452
|
-
Defined in: [sdk/portal/src/utils/websocket-client.ts:
|
|
685
|
+
Defined in: [sdk/portal/src/utils/websocket-client.ts:30](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/websocket-client.ts#L30)
|
|
453
686
|
|
|
454
687
|
Creates a GraphQL WebSocket client for the Portal API
|
|
455
688
|
|
|
@@ -465,13 +698,24 @@ Creates a GraphQL WebSocket client for the Portal API
|
|
|
465
698
|
|
|
466
699
|
The GraphQL WebSocket client
|
|
467
700
|
|
|
701
|
+
##### Example
|
|
702
|
+
|
|
703
|
+
```ts
|
|
704
|
+
import { getWebsocketClient } from "@settlemint/sdk-portal";
|
|
705
|
+
|
|
706
|
+
const client = getWebsocketClient({
|
|
707
|
+
portalGraphqlEndpoint: "https://portal.settlemint.com/graphql",
|
|
708
|
+
accessToken: "your-access-token",
|
|
709
|
+
});
|
|
710
|
+
```
|
|
711
|
+
|
|
468
712
|
***
|
|
469
713
|
|
|
470
714
|
#### handleWalletVerificationChallenge()
|
|
471
715
|
|
|
472
716
|
> **handleWalletVerificationChallenge**\<`Setup`\>(`options`): `Promise`\<\{ `challengeResponse`: `string`; `verificationId?`: `string`; \}\>
|
|
473
717
|
|
|
474
|
-
Defined in: [sdk/portal/src/utils/wallet-verification-challenge.ts:
|
|
718
|
+
Defined in: [sdk/portal/src/utils/wallet-verification-challenge.ts:103](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wallet-verification-challenge.ts#L103)
|
|
475
719
|
|
|
476
720
|
Handles a wallet verification challenge by generating an appropriate response
|
|
477
721
|
|
|
@@ -524,7 +768,7 @@ const result = await handleWalletVerificationChallenge({
|
|
|
524
768
|
|
|
525
769
|
> **waitForTransactionReceipt**(`transactionHash`, `options`): `Promise`\<[`Transaction`](#transaction)\>
|
|
526
770
|
|
|
527
|
-
Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:
|
|
771
|
+
Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:80](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L80)
|
|
528
772
|
|
|
529
773
|
Waits for a blockchain transaction receipt by subscribing to transaction updates via GraphQL.
|
|
530
774
|
This function polls until the transaction is confirmed or the timeout is reached.
|
|
@@ -562,29 +806,88 @@ const transaction = await waitForTransactionReceipt("0x123...", {
|
|
|
562
806
|
|
|
563
807
|
#### HandleWalletVerificationChallengeOptions\<Setup\>
|
|
564
808
|
|
|
565
|
-
Defined in: [sdk/portal/src/utils/wallet-verification-challenge.ts:
|
|
809
|
+
Defined in: [sdk/portal/src/utils/wallet-verification-challenge.ts:64](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wallet-verification-challenge.ts#L64)
|
|
566
810
|
|
|
567
811
|
Options for handling a wallet verification challenge
|
|
568
812
|
|
|
569
813
|
##### Type Parameters
|
|
570
814
|
|
|
571
|
-
| Type Parameter |
|
|
572
|
-
| ------ |
|
|
573
|
-
| `Setup` *extends* `AbstractSetupSchema` |
|
|
815
|
+
| Type Parameter |
|
|
816
|
+
| ------ |
|
|
817
|
+
| `Setup` *extends* `AbstractSetupSchema` |
|
|
818
|
+
|
|
819
|
+
##### Properties
|
|
820
|
+
|
|
821
|
+
| Property | Type | Description | Defined in |
|
|
822
|
+
| ------ | ------ | ------ | ------ |
|
|
823
|
+
| <a id="code"></a> `code` | `string` \| `number` | The verification code provided by the user | [sdk/portal/src/utils/wallet-verification-challenge.ts:74](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wallet-verification-challenge.ts#L74) |
|
|
824
|
+
| <a id="portalclient"></a> `portalClient` | `GraphQLClient` | The portal client instance | [sdk/portal/src/utils/wallet-verification-challenge.ts:66](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wallet-verification-challenge.ts#L66) |
|
|
825
|
+
| <a id="portalgraphql"></a> `portalGraphql` | `initGraphQLTada`\<`Setup`\> | The GraphQL query builder | [sdk/portal/src/utils/wallet-verification-challenge.ts:68](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wallet-verification-challenge.ts#L68) |
|
|
826
|
+
| <a id="userwalletaddress"></a> `userWalletAddress` | `` `0x${string}` `` | The wallet address to verify | [sdk/portal/src/utils/wallet-verification-challenge.ts:72](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wallet-verification-challenge.ts#L72) |
|
|
827
|
+
| <a id="verificationid"></a> `verificationId` | `string` | The ID of the verification challenge | [sdk/portal/src/utils/wallet-verification-challenge.ts:70](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wallet-verification-challenge.ts#L70) |
|
|
828
|
+
| <a id="verificationtype"></a> `verificationType` | `"otp"` \| `"secret-code"` \| `"pincode"` | The type of verification being performed | [sdk/portal/src/utils/wallet-verification-challenge.ts:76](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wallet-verification-challenge.ts#L76) |
|
|
574
829
|
|
|
575
830
|
***
|
|
576
831
|
|
|
577
832
|
#### Transaction
|
|
578
833
|
|
|
579
|
-
Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:
|
|
834
|
+
Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:34](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L34)
|
|
580
835
|
|
|
581
836
|
Represents the structure of a blockchain transaction with its receipt
|
|
582
837
|
|
|
838
|
+
##### Properties
|
|
839
|
+
|
|
840
|
+
| Property | Type | Description | Defined in |
|
|
841
|
+
| ------ | ------ | ------ | ------ |
|
|
842
|
+
| <a id="address"></a> `address` | `string` | The contract address involved in the transaction | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:43](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L43) |
|
|
843
|
+
| <a id="createdat"></a> `createdAt` | `string` | Timestamp when the transaction was created | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:41](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L41) |
|
|
844
|
+
| <a id="from"></a> `from` | `string` | The sender address (duplicate of receipt.from) | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:39](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L39) |
|
|
845
|
+
| <a id="functionname"></a> `functionName` | `string` | The name of the function called in the transaction | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:45](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L45) |
|
|
846
|
+
| <a id="iscontract"></a> `isContract` | `boolean` | Whether the transaction is a contract deployment | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:47](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L47) |
|
|
847
|
+
| <a id="transactionhash"></a> `transactionHash` | `string` | The hash of the transaction (duplicate of receipt.transactionHash) | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:37](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L37) |
|
|
848
|
+
|
|
849
|
+
***
|
|
850
|
+
|
|
851
|
+
#### TransactionEvent
|
|
852
|
+
|
|
853
|
+
Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:8](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L8)
|
|
854
|
+
|
|
855
|
+
Represents an event emitted during a transaction execution
|
|
856
|
+
|
|
857
|
+
##### Properties
|
|
858
|
+
|
|
859
|
+
| Property | Type | Description | Defined in |
|
|
860
|
+
| ------ | ------ | ------ | ------ |
|
|
861
|
+
| <a id="args"></a> `args` | `Record`\<`string`, `unknown`\> | The arguments emitted by the event | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:12](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L12) |
|
|
862
|
+
| <a id="eventname"></a> `eventName` | `string` | The name of the event that was emitted | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:10](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L10) |
|
|
863
|
+
| <a id="topics"></a> `topics` | `` `0x${string}` ``[] | Indexed event parameters used for filtering and searching | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:14](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L14) |
|
|
864
|
+
|
|
865
|
+
***
|
|
866
|
+
|
|
867
|
+
#### TransactionReceipt
|
|
868
|
+
|
|
869
|
+
Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:20](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L20)
|
|
870
|
+
|
|
871
|
+
Represents the structure of a blockchain transaction receipt
|
|
872
|
+
|
|
873
|
+
##### Extends
|
|
874
|
+
|
|
875
|
+
- `TransactionReceipt`\<`string`, `number`, `"Success"` \| `"Reverted"`\>
|
|
876
|
+
|
|
877
|
+
##### Properties
|
|
878
|
+
|
|
879
|
+
| Property | Type | Description | Overrides | Defined in |
|
|
880
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
881
|
+
| <a id="contractaddress"></a> `contractAddress` | `` `0x${string}` `` | The address of the contract deployed in the transaction | `TransactionReceiptViem.contractAddress` | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:28](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L28) |
|
|
882
|
+
| <a id="events"></a> `events` | [`TransactionEvent`](#transactionevent)[] | Array of events emitted during the transaction | - | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:26](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L26) |
|
|
883
|
+
| <a id="revertreason"></a> `revertReason` | `string` | The raw reason for transaction reversion, if applicable | - | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:22](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L22) |
|
|
884
|
+
| <a id="revertreasondecoded"></a> `revertReasonDecoded` | `string` | Human-readable version of the revert reason | - | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:24](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L24) |
|
|
885
|
+
|
|
583
886
|
***
|
|
584
887
|
|
|
585
888
|
#### WaitForTransactionReceiptOptions
|
|
586
889
|
|
|
587
|
-
Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:57](https://github.com/settlemint/sdk/blob/v2.3.
|
|
890
|
+
Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:57](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L57)
|
|
588
891
|
|
|
589
892
|
Options for waiting for a transaction receipt
|
|
590
893
|
|
|
@@ -592,11 +895,19 @@ Options for waiting for a transaction receipt
|
|
|
592
895
|
|
|
593
896
|
- [`WebsocketClientOptions`](#websocketclientoptions)
|
|
594
897
|
|
|
898
|
+
##### Properties
|
|
899
|
+
|
|
900
|
+
| Property | Type | Description | Inherited from | Defined in |
|
|
901
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
902
|
+
| <a id="accesstoken"></a> `accessToken?` | `string` | The access token for authentication with the Portal API | [`WebsocketClientOptions`](#websocketclientoptions).[`accessToken`](#accesstoken-1) | [sdk/portal/src/utils/websocket-client.ts:14](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/websocket-client.ts#L14) |
|
|
903
|
+
| <a id="portalgraphqlendpoint"></a> `portalGraphqlEndpoint` | `string` | The GraphQL endpoint URL for the Portal API | [`WebsocketClientOptions`](#websocketclientoptions).[`portalGraphqlEndpoint`](#portalgraphqlendpoint-1) | [sdk/portal/src/utils/websocket-client.ts:10](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/websocket-client.ts#L10) |
|
|
904
|
+
| <a id="timeout"></a> `timeout?` | `number` | Optional timeout in milliseconds before the operation fails | - | [sdk/portal/src/utils/wait-for-transaction-receipt.ts:59](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L59) |
|
|
905
|
+
|
|
595
906
|
***
|
|
596
907
|
|
|
597
908
|
#### WebsocketClientOptions
|
|
598
909
|
|
|
599
|
-
Defined in: [sdk/portal/src/utils/websocket-client.ts:
|
|
910
|
+
Defined in: [sdk/portal/src/utils/websocket-client.ts:6](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/websocket-client.ts#L6)
|
|
600
911
|
|
|
601
912
|
Options for the GraphQL WebSocket client
|
|
602
913
|
|
|
@@ -604,13 +915,20 @@ Options for the GraphQL WebSocket client
|
|
|
604
915
|
|
|
605
916
|
- [`WaitForTransactionReceiptOptions`](#waitfortransactionreceiptoptions)
|
|
606
917
|
|
|
918
|
+
##### Properties
|
|
919
|
+
|
|
920
|
+
| Property | Type | Description | Defined in |
|
|
921
|
+
| ------ | ------ | ------ | ------ |
|
|
922
|
+
| <a id="accesstoken-1"></a> `accessToken?` | `string` | The access token for authentication with the Portal API | [sdk/portal/src/utils/websocket-client.ts:14](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/websocket-client.ts#L14) |
|
|
923
|
+
| <a id="portalgraphqlendpoint-1"></a> `portalGraphqlEndpoint` | `string` | The GraphQL endpoint URL for the Portal API | [sdk/portal/src/utils/websocket-client.ts:10](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/utils/websocket-client.ts#L10) |
|
|
924
|
+
|
|
607
925
|
### Type Aliases
|
|
608
926
|
|
|
609
927
|
#### ClientOptions
|
|
610
928
|
|
|
611
929
|
> **ClientOptions** = `z.infer`\<*typeof* [`ClientOptionsSchema`](#clientoptionsschema)\>
|
|
612
930
|
|
|
613
|
-
Defined in: [sdk/portal/src/portal.ts:
|
|
931
|
+
Defined in: [sdk/portal/src/portal.ts:25](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/portal.ts#L25)
|
|
614
932
|
|
|
615
933
|
Type representing the validated client options.
|
|
616
934
|
|
|
@@ -620,7 +938,7 @@ Type representing the validated client options.
|
|
|
620
938
|
|
|
621
939
|
> **RequestConfig** = `ConstructorParameters`\<*typeof* `GraphQLClient`\>\[`1`\]
|
|
622
940
|
|
|
623
|
-
Defined in: [sdk/portal/src/portal.ts:
|
|
941
|
+
Defined in: [sdk/portal/src/portal.ts:11](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/portal.ts#L11)
|
|
624
942
|
|
|
625
943
|
Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.
|
|
626
944
|
|
|
@@ -628,9 +946,9 @@ Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.
|
|
|
628
946
|
|
|
629
947
|
#### ClientOptionsSchema
|
|
630
948
|
|
|
631
|
-
> `const` **ClientOptionsSchema**: `ZodObject`\<\{ `accessToken`: `ZodString
|
|
949
|
+
> `const` **ClientOptionsSchema**: `ZodObject`\<\{ `accessToken`: `ZodOptional`\<`ZodString`\>; `cache`: `ZodOptional`\<`ZodEnum`\<\{ `default`: `"default"`; `force-cache`: `"force-cache"`; `no-cache`: `"no-cache"`; `no-store`: `"no-store"`; `only-if-cached`: `"only-if-cached"`; `reload`: `"reload"`; \}\>\>; `instance`: `ZodUnion`\<readonly \[`ZodString`, `ZodString`\]\>; \}, `$strip`\>
|
|
632
950
|
|
|
633
|
-
Defined in: [sdk/portal/src/portal.ts:
|
|
951
|
+
Defined in: [sdk/portal/src/portal.ts:16](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/portal/src/portal.ts#L16)
|
|
634
952
|
|
|
635
953
|
Schema for validating Portal client configuration options.
|
|
636
954
|
|