@frak-labs/nexus-sdk 0.0.10 → 0.0.11

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.
Files changed (37) hide show
  1. package/dist/chunk-5CFD5FM2.js +86 -0
  2. package/dist/chunk-7MVQQ2X6.js +381 -0
  3. package/dist/{chunk-72IEHEQX.js → chunk-GUDT2W6I.js} +32 -10
  4. package/dist/{chunk-NIFJZD3M.cjs → chunk-IQQTTKJL.cjs} +30 -8
  5. package/dist/chunk-S5FVCA2E.cjs +86 -0
  6. package/dist/chunk-V3S6RBRJ.cjs +381 -0
  7. package/dist/{client-6_BJp7Ub.d.ts → client-C7u9zGwC.d.cts} +135 -142
  8. package/dist/{client--U_6SK0l.d.cts → client-gE3fYzkD.d.ts} +135 -142
  9. package/dist/core/actions/index.cjs +2 -7
  10. package/dist/core/actions/index.d.cts +16 -35
  11. package/dist/core/actions/index.d.ts +16 -35
  12. package/dist/core/actions/index.js +5 -10
  13. package/dist/core/index.cjs +2 -4
  14. package/dist/core/index.d.cts +3 -3
  15. package/dist/core/index.d.ts +3 -3
  16. package/dist/core/index.js +2 -4
  17. package/dist/core/interactions/index.cjs +6 -2
  18. package/dist/core/interactions/index.d.cts +20 -6
  19. package/dist/core/interactions/index.d.ts +20 -6
  20. package/dist/core/interactions/index.js +7 -3
  21. package/dist/{interaction-D_CzyqRE.d.cts → interaction-D3-M3nBh.d.cts} +2 -2
  22. package/dist/{interaction-D_CzyqRE.d.ts → interaction-D3-M3nBh.d.ts} +2 -2
  23. package/dist/react/index.cjs +146 -158
  24. package/dist/react/index.d.cts +44 -51
  25. package/dist/react/index.d.ts +44 -51
  26. package/dist/react/index.js +152 -164
  27. package/dist/sendTransaction-BZW627cT.d.cts +30 -0
  28. package/dist/sendTransaction-DpJTfGJc.d.ts +30 -0
  29. package/package.json +8 -5
  30. package/dist/chunk-3T2FNW6E.cjs +0 -100
  31. package/dist/chunk-BPFJZRJ6.cjs +0 -152
  32. package/dist/chunk-HOX3RRO6.js +0 -199
  33. package/dist/chunk-SGLR6RFA.cjs +0 -199
  34. package/dist/chunk-T54VMWHQ.js +0 -100
  35. package/dist/chunk-TPC5PMRC.js +0 -152
  36. package/dist/watchUnlockStatus-CxnibdQx.d.cts +0 -43
  37. package/dist/watchUnlockStatus-g8wIxpeM.d.ts +0 -43
@@ -1,13 +1,13 @@
1
1
  import * as react from 'react';
2
2
  import { PropsWithChildren, CSSProperties, ReactNode } from 'react';
3
- import { a as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, A as ArticleUnlockStatusReturnType, e as SendTransactionTxType, d as SendTransactionReturnType, c as SendTransactionActionParamsType, h as SiweAuthenticationParams, f as SiweAuthenticateReturnType, g as SiweAuthenticateActionParamsType } from '../client--U_6SK0l.cjs';
3
+ import { f as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, c as SendTransactionReturnType, a as SiweAuthenticateReturnType, D as DisplayModalParamsType, d as ModalStepTypes, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../client-C7u9zGwC.cjs';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { UseMutationOptions } from '@tanstack/react-query';
6
6
  import * as viem from 'viem';
7
7
  import { Hex } from 'viem';
8
- import { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams } from '../watchUnlockStatus-CxnibdQx.cjs';
9
8
  import { F as FrakRpcError } from '../error-C4Zm5nQe.cjs';
10
- import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-D_CzyqRE.cjs';
9
+ import { b as SendTransactionParams, S as SiweAuthenticateModalParams } from '../sendTransaction-BZW627cT.cjs';
10
+ import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-D3-M3nBh.cjs';
11
11
  import 'viem/chains';
12
12
  import 'viem/siwe';
13
13
 
@@ -18,6 +18,7 @@ declare const NexusConfigContext: react.Context<Readonly<{
18
18
  walletUrl: string;
19
19
  metadata: {
20
20
  name: string;
21
+ css?: string;
21
22
  };
22
23
  domain: string;
23
24
  }> | undefined>;
@@ -38,6 +39,7 @@ declare function NexusConfigProvider(parameters: PropsWithChildren<NexusConfigPr
38
39
  walletUrl: string;
39
40
  metadata: {
40
41
  name: string;
42
+ css?: string;
41
43
  };
42
44
  domain: string;
43
45
  }> | undefined>>;
@@ -72,6 +74,7 @@ declare function useNexusConfig(): Readonly<{
72
74
  walletUrl: string;
73
75
  metadata: {
74
76
  name: string;
77
+ css?: string;
75
78
  };
76
79
  domain: string;
77
80
  }>;
@@ -81,53 +84,25 @@ declare function useNexusConfig(): Readonly<{
81
84
  */
82
85
  declare function useNexusClient(): NexusClient | undefined;
83
86
 
84
- /**
85
- * Hook used to get the unlock options for an article
86
- */
87
- declare function useArticleUnlockOptions({ articleId, contentId, }: GetUnlockOptionsParams): _tanstack_react_query.UseQueryResult<Readonly<{
88
- frkBalanceAsHex?: viem.Hex;
89
- prices: {
90
- index: number;
91
- unlockDurationInSec: number;
92
- frkAmount: viem.Hex;
93
- isUserAccessible: boolean | null;
94
- }[];
95
- }> | undefined, Error>;
96
-
97
- type WalletStatusQueryReturnType = WalletStatusReturnType | {
98
- key: "waiting-response";
99
- };
100
87
  /**
101
88
  * Hooks used to listen to the current wallet status
102
89
  */
103
- declare function useWalletStatus(): _tanstack_react_query.UseQueryResult<WalletStatusQueryReturnType, Error>;
104
-
105
- type ArticleUnlockStatusQueryReturnType = ArticleUnlockStatusReturnType | {
106
- status: "waiting-response";
107
- key: "waiting-response";
108
- };
109
- /**
110
- * Hooks used to listen to the current article unlock status
111
- */
112
- declare function useArticleUnlockStatus({ articleId, contentId, }: WatchUnlockStatusParams): _tanstack_react_query.UseQueryResult<ArticleUnlockStatusQueryReturnType | null, Error>;
90
+ declare function useWalletStatus(): _tanstack_react_query.UseQueryResult<WalletStatusReturnType, Error>;
113
91
 
114
- type MutationOptions$2 = Omit<UseMutationOptions<SendTransactionReturnType, FrakRpcError, SendTransactionActionParamsType>, "mutationFn" | "mutationKey">;
92
+ type MutationOptions$4 = Omit<UseMutationOptions<SendTransactionReturnType, FrakRpcError, SendTransactionParams>, "mutationFn" | "mutationKey">;
115
93
  interface UseSendTransactionParams {
116
- mutations?: MutationOptions$2;
94
+ mutations?: MutationOptions$4;
117
95
  }
118
96
  /**
119
97
  * Trigger a dashboard action to the wallet
120
98
  */
121
99
  declare function useSendTransactionAction({ mutations, }?: UseSendTransactionParams): _tanstack_react_query.UseMutationResult<Readonly<{
122
100
  hash: viem.Hex;
123
- }>, FrakRpcError<undefined>, Readonly<{
124
- tx: SendTransactionTxType | SendTransactionTxType[];
125
- context?: string;
126
- }>, unknown>;
101
+ }>, FrakRpcError<undefined>, SendTransactionParams, unknown>;
127
102
 
128
- type MutationOptions$1 = Omit<UseMutationOptions<SiweAuthenticateReturnType, FrakRpcError, SiweAuthenticateActionParamsType>, "mutationFn" | "mutationKey">;
103
+ type MutationOptions$3 = Omit<UseMutationOptions<SiweAuthenticateReturnType, FrakRpcError, SiweAuthenticateModalParams>, "mutationFn" | "mutationKey">;
129
104
  interface UseSiweAuthenticateParams {
130
- mutations?: MutationOptions$1;
105
+ mutations?: MutationOptions$3;
131
106
  }
132
107
  /**
133
108
  * Trigger a dashboard action to the wallet
@@ -135,29 +110,47 @@ interface UseSiweAuthenticateParams {
135
110
  declare function useSiweAuthenticate({ mutations, }?: UseSiweAuthenticateParams): _tanstack_react_query.UseMutationResult<Readonly<{
136
111
  signature: viem.Hex;
137
112
  message: string;
138
- }>, FrakRpcError<undefined>, Readonly<{
139
- siwe?: Partial<SiweAuthenticationParams>;
140
- context?: string;
141
- }>, unknown>;
113
+ }>, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
142
114
 
115
+ type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-session" | "error" | "no-referrer" | "self-referral";
143
116
  /**
144
- * Helper hook to automatically submit a press referral interaction when detected
117
+ * Helper hook to automatically submit a referral interaction when detected
145
118
  * -> And automatically set the referral context in the url
146
119
  * @param contentId
120
+ * @param modalConfig
147
121
  */
148
- declare function usePressReferralInteraction({ contentId }: {
149
- contentId: Hex;
150
- }): "error" | "loading" | "no-referral" | "referred" | "no-wallet" | "no-session";
122
+ declare function useReferralInteraction({ contentId, modalConfig, }?: {
123
+ contentId?: Hex;
124
+ modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
125
+ }): ReferralState;
151
126
 
152
- type MutationOptions = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
153
- interface UseSendInteractionParams {
154
- mutations?: MutationOptions;
127
+ type MutationOptions$2 = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
128
+ interface UseSendInteractionParams$1 {
129
+ mutations?: MutationOptions$2;
155
130
  }
156
131
  /**
157
132
  * Send a user interaction
158
133
  */
159
- declare function useSendInteraction({ mutations, }?: UseSendInteractionParams): _tanstack_react_query.UseMutationResult<Readonly<{
160
- hash: viem.Hex;
134
+ declare function useSendInteraction({ mutations, }?: UseSendInteractionParams$1): _tanstack_react_query.UseMutationResult<Readonly<{
135
+ delegationId: string;
161
136
  }>, FrakRpcError<undefined>, SendInteractionParamsType, unknown>;
162
137
 
163
- export { type ArticleUnlockStatusQueryReturnType, NexusConfigContext, NexusConfigProvider, type NexusConfigProviderProps, NexusIFrameClientContext, type NexusIFrameClientProps, NexusIFrameClientProvider, type WalletStatusQueryReturnType, useArticleUnlockOptions, useArticleUnlockStatus, useNexusClient, useNexusConfig, usePressReferralInteraction, useSendInteraction, useSendTransactionAction, useSiweAuthenticate, useWalletStatus };
138
+ type MutationOptions$1<T extends ModalStepTypes[]> = Omit<UseMutationOptions<ModalRpcStepsResultType<T>, FrakRpcError, DisplayModalParamsType<T>>, "mutationFn" | "mutationKey">;
139
+ interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
140
+ mutations?: MutationOptions$1<T>;
141
+ }
142
+ /**
143
+ * Send a user interaction
144
+ */
145
+ declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>({ mutations, }?: UseDisplayModalParams<T>): _tanstack_react_query.UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T>, unknown>;
146
+
147
+ type MutationOptions = Omit<UseMutationOptions<void, FrakRpcError, OpenSsoParamsType>, "mutationFn" | "mutationKey">;
148
+ interface UseSendInteractionParams {
149
+ mutations?: MutationOptions;
150
+ }
151
+ /**
152
+ * Open the SSO
153
+ */
154
+ declare function useOpenSso({ mutations }?: UseSendInteractionParams): _tanstack_react_query.UseMutationResult<void, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
155
+
156
+ export { NexusConfigContext, NexusConfigProvider, type NexusConfigProviderProps, NexusIFrameClientContext, type NexusIFrameClientProps, NexusIFrameClientProvider, useDisplayModal, useNexusClient, useNexusConfig, useOpenSso, useReferralInteraction, useSendInteraction, useSendTransactionAction, useSiweAuthenticate, useWalletStatus };
@@ -1,13 +1,13 @@
1
1
  import * as react from 'react';
2
2
  import { PropsWithChildren, CSSProperties, ReactNode } from 'react';
3
- import { a as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, A as ArticleUnlockStatusReturnType, e as SendTransactionTxType, d as SendTransactionReturnType, c as SendTransactionActionParamsType, h as SiweAuthenticationParams, f as SiweAuthenticateReturnType, g as SiweAuthenticateActionParamsType } from '../client-6_BJp7Ub.js';
3
+ import { f as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, c as SendTransactionReturnType, a as SiweAuthenticateReturnType, D as DisplayModalParamsType, d as ModalStepTypes, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../client-gE3fYzkD.js';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { UseMutationOptions } from '@tanstack/react-query';
6
6
  import * as viem from 'viem';
7
7
  import { Hex } from 'viem';
8
- import { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams } from '../watchUnlockStatus-g8wIxpeM.js';
9
8
  import { F as FrakRpcError } from '../error-C4Zm5nQe.js';
10
- import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-D_CzyqRE.js';
9
+ import { b as SendTransactionParams, S as SiweAuthenticateModalParams } from '../sendTransaction-DpJTfGJc.js';
10
+ import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-D3-M3nBh.js';
11
11
  import 'viem/chains';
12
12
  import 'viem/siwe';
13
13
 
@@ -18,6 +18,7 @@ declare const NexusConfigContext: react.Context<Readonly<{
18
18
  walletUrl: string;
19
19
  metadata: {
20
20
  name: string;
21
+ css?: string;
21
22
  };
22
23
  domain: string;
23
24
  }> | undefined>;
@@ -38,6 +39,7 @@ declare function NexusConfigProvider(parameters: PropsWithChildren<NexusConfigPr
38
39
  walletUrl: string;
39
40
  metadata: {
40
41
  name: string;
42
+ css?: string;
41
43
  };
42
44
  domain: string;
43
45
  }> | undefined>>;
@@ -72,6 +74,7 @@ declare function useNexusConfig(): Readonly<{
72
74
  walletUrl: string;
73
75
  metadata: {
74
76
  name: string;
77
+ css?: string;
75
78
  };
76
79
  domain: string;
77
80
  }>;
@@ -81,53 +84,25 @@ declare function useNexusConfig(): Readonly<{
81
84
  */
82
85
  declare function useNexusClient(): NexusClient | undefined;
83
86
 
84
- /**
85
- * Hook used to get the unlock options for an article
86
- */
87
- declare function useArticleUnlockOptions({ articleId, contentId, }: GetUnlockOptionsParams): _tanstack_react_query.UseQueryResult<Readonly<{
88
- frkBalanceAsHex?: viem.Hex;
89
- prices: {
90
- index: number;
91
- unlockDurationInSec: number;
92
- frkAmount: viem.Hex;
93
- isUserAccessible: boolean | null;
94
- }[];
95
- }> | undefined, Error>;
96
-
97
- type WalletStatusQueryReturnType = WalletStatusReturnType | {
98
- key: "waiting-response";
99
- };
100
87
  /**
101
88
  * Hooks used to listen to the current wallet status
102
89
  */
103
- declare function useWalletStatus(): _tanstack_react_query.UseQueryResult<WalletStatusQueryReturnType, Error>;
104
-
105
- type ArticleUnlockStatusQueryReturnType = ArticleUnlockStatusReturnType | {
106
- status: "waiting-response";
107
- key: "waiting-response";
108
- };
109
- /**
110
- * Hooks used to listen to the current article unlock status
111
- */
112
- declare function useArticleUnlockStatus({ articleId, contentId, }: WatchUnlockStatusParams): _tanstack_react_query.UseQueryResult<ArticleUnlockStatusQueryReturnType | null, Error>;
90
+ declare function useWalletStatus(): _tanstack_react_query.UseQueryResult<WalletStatusReturnType, Error>;
113
91
 
114
- type MutationOptions$2 = Omit<UseMutationOptions<SendTransactionReturnType, FrakRpcError, SendTransactionActionParamsType>, "mutationFn" | "mutationKey">;
92
+ type MutationOptions$4 = Omit<UseMutationOptions<SendTransactionReturnType, FrakRpcError, SendTransactionParams>, "mutationFn" | "mutationKey">;
115
93
  interface UseSendTransactionParams {
116
- mutations?: MutationOptions$2;
94
+ mutations?: MutationOptions$4;
117
95
  }
118
96
  /**
119
97
  * Trigger a dashboard action to the wallet
120
98
  */
121
99
  declare function useSendTransactionAction({ mutations, }?: UseSendTransactionParams): _tanstack_react_query.UseMutationResult<Readonly<{
122
100
  hash: viem.Hex;
123
- }>, FrakRpcError<undefined>, Readonly<{
124
- tx: SendTransactionTxType | SendTransactionTxType[];
125
- context?: string;
126
- }>, unknown>;
101
+ }>, FrakRpcError<undefined>, SendTransactionParams, unknown>;
127
102
 
128
- type MutationOptions$1 = Omit<UseMutationOptions<SiweAuthenticateReturnType, FrakRpcError, SiweAuthenticateActionParamsType>, "mutationFn" | "mutationKey">;
103
+ type MutationOptions$3 = Omit<UseMutationOptions<SiweAuthenticateReturnType, FrakRpcError, SiweAuthenticateModalParams>, "mutationFn" | "mutationKey">;
129
104
  interface UseSiweAuthenticateParams {
130
- mutations?: MutationOptions$1;
105
+ mutations?: MutationOptions$3;
131
106
  }
132
107
  /**
133
108
  * Trigger a dashboard action to the wallet
@@ -135,29 +110,47 @@ interface UseSiweAuthenticateParams {
135
110
  declare function useSiweAuthenticate({ mutations, }?: UseSiweAuthenticateParams): _tanstack_react_query.UseMutationResult<Readonly<{
136
111
  signature: viem.Hex;
137
112
  message: string;
138
- }>, FrakRpcError<undefined>, Readonly<{
139
- siwe?: Partial<SiweAuthenticationParams>;
140
- context?: string;
141
- }>, unknown>;
113
+ }>, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
142
114
 
115
+ type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-session" | "error" | "no-referrer" | "self-referral";
143
116
  /**
144
- * Helper hook to automatically submit a press referral interaction when detected
117
+ * Helper hook to automatically submit a referral interaction when detected
145
118
  * -> And automatically set the referral context in the url
146
119
  * @param contentId
120
+ * @param modalConfig
147
121
  */
148
- declare function usePressReferralInteraction({ contentId }: {
149
- contentId: Hex;
150
- }): "error" | "loading" | "no-referral" | "referred" | "no-wallet" | "no-session";
122
+ declare function useReferralInteraction({ contentId, modalConfig, }?: {
123
+ contentId?: Hex;
124
+ modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
125
+ }): ReferralState;
151
126
 
152
- type MutationOptions = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
153
- interface UseSendInteractionParams {
154
- mutations?: MutationOptions;
127
+ type MutationOptions$2 = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
128
+ interface UseSendInteractionParams$1 {
129
+ mutations?: MutationOptions$2;
155
130
  }
156
131
  /**
157
132
  * Send a user interaction
158
133
  */
159
- declare function useSendInteraction({ mutations, }?: UseSendInteractionParams): _tanstack_react_query.UseMutationResult<Readonly<{
160
- hash: viem.Hex;
134
+ declare function useSendInteraction({ mutations, }?: UseSendInteractionParams$1): _tanstack_react_query.UseMutationResult<Readonly<{
135
+ delegationId: string;
161
136
  }>, FrakRpcError<undefined>, SendInteractionParamsType, unknown>;
162
137
 
163
- export { type ArticleUnlockStatusQueryReturnType, NexusConfigContext, NexusConfigProvider, type NexusConfigProviderProps, NexusIFrameClientContext, type NexusIFrameClientProps, NexusIFrameClientProvider, type WalletStatusQueryReturnType, useArticleUnlockOptions, useArticleUnlockStatus, useNexusClient, useNexusConfig, usePressReferralInteraction, useSendInteraction, useSendTransactionAction, useSiweAuthenticate, useWalletStatus };
138
+ type MutationOptions$1<T extends ModalStepTypes[]> = Omit<UseMutationOptions<ModalRpcStepsResultType<T>, FrakRpcError, DisplayModalParamsType<T>>, "mutationFn" | "mutationKey">;
139
+ interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
140
+ mutations?: MutationOptions$1<T>;
141
+ }
142
+ /**
143
+ * Send a user interaction
144
+ */
145
+ declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>({ mutations, }?: UseDisplayModalParams<T>): _tanstack_react_query.UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T>, unknown>;
146
+
147
+ type MutationOptions = Omit<UseMutationOptions<void, FrakRpcError, OpenSsoParamsType>, "mutationFn" | "mutationKey">;
148
+ interface UseSendInteractionParams {
149
+ mutations?: MutationOptions;
150
+ }
151
+ /**
152
+ * Open the SSO
153
+ */
154
+ declare function useOpenSso({ mutations }?: UseSendInteractionParams): _tanstack_react_query.UseMutationResult<void, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
155
+
156
+ export { NexusConfigContext, NexusConfigProvider, type NexusConfigProviderProps, NexusIFrameClientContext, type NexusIFrameClientProps, NexusIFrameClientProvider, useDisplayModal, useNexusClient, useNexusConfig, useOpenSso, useReferralInteraction, useSendInteraction, useSendTransactionAction, useSiweAuthenticate, useWalletStatus };