@settlemint/sdk-portal 2.3.2-prebafe7cb → 2.3.2-prede7bc05

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 CHANGED
@@ -42,6 +42,7 @@
42
42
  - [HandleWalletVerificationChallengeOptions\<Setup\>](#handlewalletverificationchallengeoptionssetup)
43
43
  - [Transaction](#transaction)
44
44
  - [TransactionEvent](#transactionevent)
45
+ - [TransactionReceipt](#transactionreceipt)
45
46
  - [WaitForTransactionReceiptOptions](#waitfortransactionreceiptoptions)
46
47
  - [WebsocketClientOptions](#websocketclientoptions)
47
48
  - [Type Aliases](#type-aliases)
@@ -600,7 +601,7 @@ console.log("Transaction hash:", result.StableCoinFactoryCreate?.transactionHash
600
601
 
601
602
  > **createPortalClient**\<`Setup`\>(`options`, `clientOptions?`): `object`
602
603
 
603
- Defined in: [sdk/portal/src/portal.ts:71](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L71)
604
+ Defined in: [sdk/portal/src/portal.ts:72](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L72)
604
605
 
605
606
  Creates a Portal GraphQL client with the provided configuration.
606
607
 
@@ -614,8 +615,8 @@ Creates a Portal GraphQL client with the provided configuration.
614
615
 
615
616
  | Parameter | Type | Description |
616
617
  | ------ | ------ | ------ |
617
- | `options` | \{ `accessToken`: `string`; `cache?`: `"default"` \| `"force-cache"` \| `"no-cache"` \| `"no-store"` \| `"only-if-cached"` \| `"reload"`; `instance`: `string`; \} | Configuration options for the Portal client |
618
- | `options.accessToken` | `string` | - |
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` | - |
619
620
  | `options.cache?` | `"default"` \| `"force-cache"` \| `"no-cache"` \| `"no-store"` \| `"only-if-cached"` \| `"reload"` | - |
620
621
  | `options.instance?` | `string` | - |
621
622
  | `clientOptions?` | `RequestConfig` | Additional GraphQL client configuration options |
@@ -628,8 +629,8 @@ An object containing the configured GraphQL client and graphql helper function
628
629
 
629
630
  | Name | Type | Defined in |
630
631
  | ------ | ------ | ------ |
631
- | `client` | `GraphQLClient` | [sdk/portal/src/portal.ts:75](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L75) |
632
- | `graphql` | `initGraphQLTada`\<`Setup`\> | [sdk/portal/src/portal.ts:76](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L76) |
632
+ | `client` | `GraphQLClient` | [sdk/portal/src/portal.ts:76](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L76) |
633
+ | `graphql` | `initGraphQLTada`\<`Setup`\> | [sdk/portal/src/portal.ts:77](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L77) |
633
634
 
634
635
  ##### Throws
635
636
 
@@ -681,7 +682,7 @@ const result = await portalClient.request(query);
681
682
 
682
683
  > **getWebsocketClient**(`options`): `Client`
683
684
 
684
- Defined in: [sdk/portal/src/utils/websocket-client.ts:23](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/websocket-client.ts#L23)
685
+ Defined in: [sdk/portal/src/utils/websocket-client.ts:30](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/websocket-client.ts#L30)
685
686
 
686
687
  Creates a GraphQL WebSocket client for the Portal API
687
688
 
@@ -697,13 +698,24 @@ Creates a GraphQL WebSocket client for the Portal API
697
698
 
698
699
  The GraphQL WebSocket client
699
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
+
700
712
  ***
701
713
 
702
714
  #### handleWalletVerificationChallenge()
703
715
 
704
716
  > **handleWalletVerificationChallenge**\<`Setup`\>(`options`): `Promise`\<\{ `challengeResponse`: `string`; `verificationId?`: `string`; \}\>
705
717
 
706
- Defined in: [sdk/portal/src/utils/wallet-verification-challenge.ts:106](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wallet-verification-challenge.ts#L106)
718
+ Defined in: [sdk/portal/src/utils/wallet-verification-challenge.ts:103](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wallet-verification-challenge.ts#L103)
707
719
 
708
720
  Handles a wallet verification challenge by generating an appropriate response
709
721
 
@@ -756,7 +768,7 @@ const result = await handleWalletVerificationChallenge({
756
768
 
757
769
  > **waitForTransactionReceipt**(`transactionHash`, `options`): `Promise`\<[`Transaction`](#transaction)\>
758
770
 
759
- Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:90](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L90)
771
+ Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:80](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L80)
760
772
 
761
773
  Waits for a blockchain transaction receipt by subscribing to transaction updates via GraphQL.
762
774
  This function polls until the transaction is confirmed or the timeout is reached.
@@ -794,37 +806,88 @@ const transaction = await waitForTransactionReceipt("0x123...", {
794
806
 
795
807
  #### HandleWalletVerificationChallengeOptions\<Setup\>
796
808
 
797
- Defined in: [sdk/portal/src/utils/wallet-verification-challenge.ts:73](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wallet-verification-challenge.ts#L73)
809
+ Defined in: [sdk/portal/src/utils/wallet-verification-challenge.ts:64](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wallet-verification-challenge.ts#L64)
798
810
 
799
811
  Options for handling a wallet verification challenge
800
812
 
801
813
  ##### Type Parameters
802
814
 
803
- | Type Parameter | Description |
804
- | ------ | ------ |
805
- | `Setup` *extends* `AbstractSetupSchema` | The GraphQL schema setup type |
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.2/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.2/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.2/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.2/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.2/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.2/sdk/portal/src/utils/wallet-verification-challenge.ts#L76) |
806
829
 
807
830
  ***
808
831
 
809
832
  #### Transaction
810
833
 
811
- Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:43](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L43)
834
+ Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:34](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L34)
812
835
 
813
836
  Represents the structure of a blockchain transaction with its receipt
814
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.2/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.2/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.2/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.2/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.2/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.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L37) |
848
+
815
849
  ***
816
850
 
817
851
  #### TransactionEvent
818
852
 
819
- Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:15](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L15)
853
+ Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:8](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L8)
820
854
 
821
855
  Represents an event emitted during a transaction execution
822
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.2/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.2/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.2/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.2/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.2/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.2/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.2/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.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L24) |
885
+
823
886
  ***
824
887
 
825
888
  #### WaitForTransactionReceiptOptions
826
889
 
827
- Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:68](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L68)
890
+ Defined in: [sdk/portal/src/utils/wait-for-transaction-receipt.ts:57](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L57)
828
891
 
829
892
  Options for waiting for a transaction receipt
830
893
 
@@ -832,11 +895,19 @@ Options for waiting for a transaction receipt
832
895
 
833
896
  - [`WebsocketClientOptions`](#websocketclientoptions)
834
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.2/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.2/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.2/sdk/portal/src/utils/wait-for-transaction-receipt.ts#L59) |
905
+
835
906
  ***
836
907
 
837
908
  #### WebsocketClientOptions
838
909
 
839
- Defined in: [sdk/portal/src/utils/websocket-client.ts:10](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/websocket-client.ts#L10)
910
+ Defined in: [sdk/portal/src/utils/websocket-client.ts:6](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/utils/websocket-client.ts#L6)
840
911
 
841
912
  Options for the GraphQL WebSocket client
842
913
 
@@ -844,13 +915,20 @@ Options for the GraphQL WebSocket client
844
915
 
845
916
  - [`WaitForTransactionReceiptOptions`](#waitfortransactionreceiptoptions)
846
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.2/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.2/sdk/portal/src/utils/websocket-client.ts#L10) |
924
+
847
925
  ### Type Aliases
848
926
 
849
927
  #### ClientOptions
850
928
 
851
929
  > **ClientOptions** = `z.infer`\<*typeof* [`ClientOptionsSchema`](#clientoptionsschema)\>
852
930
 
853
- Defined in: [sdk/portal/src/portal.ts:24](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L24)
931
+ Defined in: [sdk/portal/src/portal.ts:25](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L25)
854
932
 
855
933
  Type representing the validated client options.
856
934
 
@@ -860,7 +938,7 @@ Type representing the validated client options.
860
938
 
861
939
  > **RequestConfig** = `ConstructorParameters`\<*typeof* `GraphQLClient`\>\[`1`\]
862
940
 
863
- Defined in: [sdk/portal/src/portal.ts:10](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L10)
941
+ Defined in: [sdk/portal/src/portal.ts:11](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L11)
864
942
 
865
943
  Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.
866
944
 
@@ -868,9 +946,9 @@ Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.
868
946
 
869
947
  #### ClientOptionsSchema
870
948
 
871
- > `const` **ClientOptionsSchema**: `ZodObject`\<\{ `accessToken`: `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`\>
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`\>
872
950
 
873
- Defined in: [sdk/portal/src/portal.ts:15](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L15)
951
+ Defined in: [sdk/portal/src/portal.ts:16](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/portal/src/portal.ts#L16)
874
952
 
875
953
  Schema for validating Portal client configuration options.
876
954
 
@@ -0,0 +1,252 @@
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";
6
+
7
+ //#region src/utils/websocket-client.d.ts
8
+ /**
9
+ * Options for the GraphQL WebSocket client
10
+ */
11
+ /**
12
+ * Options for the GraphQL WebSocket client
13
+ */
14
+ interface WebsocketClientOptions {
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;
23
+ }
24
+ /**
25
+ * Creates a GraphQL WebSocket client for the Portal API
26
+ *
27
+ * @param {WebsocketClientOptions} options - The options for the client
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
+ * });
36
+ */
37
+ declare function getWebsocketClient({
38
+ portalGraphqlEndpoint,
39
+ accessToken
40
+ }: WebsocketClientOptions): graphql_ws0.Client;
41
+
42
+ //#endregion
43
+ //#region src/utils/wait-for-transaction-receipt.d.ts
44
+ /**
45
+ * Represents an event emitted during a transaction execution
46
+ */
47
+ interface TransactionEvent {
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;
67
+ }
68
+ /**
69
+ * Represents the structure of a blockchain transaction with its receipt
70
+ */
71
+ interface Transaction {
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;
85
+ }
86
+ /**
87
+ * Options for waiting for a transaction receipt
88
+ */
89
+ interface WaitForTransactionReceiptOptions extends WebsocketClientOptions {
90
+ /** Optional timeout in milliseconds before the operation fails */
91
+ timeout?: number;
92
+ }
93
+ /**
94
+ * Waits for a blockchain transaction receipt by subscribing to transaction updates via GraphQL.
95
+ * This function polls until the transaction is confirmed or the timeout is reached.
96
+ *
97
+ * @param transactionHash - The hash of the transaction to wait for
98
+ * @param options - Configuration options for the waiting process
99
+ * @returns The transaction details including receipt information when the transaction is confirmed
100
+ * @throws Error if the transaction receipt cannot be retrieved within the specified timeout
101
+ *
102
+ * @example
103
+ * import { waitForTransactionReceipt } from "@settlemint/sdk-portal";
104
+ *
105
+ * const transaction = await waitForTransactionReceipt("0x123...", {
106
+ * portalGraphqlEndpoint: "https://example.settlemint.com/graphql",
107
+ * accessToken: "your-access-token",
108
+ * timeout: 30000 // 30 seconds timeout
109
+ * });
110
+ */
111
+ declare function waitForTransactionReceipt(transactionHash: string, options: WaitForTransactionReceiptOptions): Promise<Transaction>;
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
177
+ /**
178
+ * Configuration options for the GraphQL client, excluding 'url' and 'exchanges'.
179
+ */
180
+ type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];
181
+ /**
182
+ * Schema for validating Portal client configuration options.
183
+ */
184
+ declare const ClientOptionsSchema: z.ZodObject<{
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
+ }>>;
195
+ }, z.core.$strip>;
196
+ /**
197
+ * Type representing the validated client options.
198
+ */
199
+ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
200
+ /**
201
+ * Creates a Portal GraphQL client with the provided configuration.
202
+ *
203
+ * @param options - Configuration options for the Portal client
204
+ * @param clientOptions - Additional GraphQL client configuration options
205
+ * @returns An object containing the configured GraphQL client and graphql helper function
206
+ * @throws If the provided options fail validation
207
+ *
208
+ * @example
209
+ * import { createPortalClient } from "@settlemint/sdk-portal";
210
+ * import { loadEnv } from "@settlemint/sdk-utils/environment";
211
+ * import { createLogger, requestLogger } from "@settlemint/sdk-utils/logging";
212
+ * import type { introspection } from "@schemas/portal-env";
213
+ *
214
+ * const env = await loadEnv(false, false);
215
+ * const logger = createLogger();
216
+ *
217
+ * const { client: portalClient, graphql: portalGraphql } = createPortalClient<{
218
+ * introspection: introspection;
219
+ * disableMasking: true;
220
+ * scalars: {
221
+ * // Change unknown to the type you are using to store metadata
222
+ * JSON: unknown;
223
+ * };
224
+ * }>(
225
+ * {
226
+ * instance: env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
227
+ * accessToken: env.SETTLEMINT_ACCESS_TOKEN!,
228
+ * },
229
+ * {
230
+ * fetch: requestLogger(logger, "portal", fetch) as typeof fetch,
231
+ * },
232
+ * );
233
+ *
234
+ * // Making GraphQL queries
235
+ * const query = portalGraphql(`
236
+ * query GetPendingTransactions {
237
+ * getPendingTransactions {
238
+ * count
239
+ * }
240
+ * }
241
+ * `);
242
+ *
243
+ * const result = await portalClient.request(query);
244
+ */
245
+ declare function createPortalClient<const Setup extends AbstractSetupSchema>(options: ClientOptions, clientOptions?: RequestConfig): {
246
+ client: GraphQLClient;
247
+ graphql: initGraphQLTada<Setup>;
248
+ };
249
+
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