@frak-labs/nexus-sdk 0.0.9 → 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.
- package/dist/chunk-5CFD5FM2.js +86 -0
- package/dist/chunk-7MVQQ2X6.js +381 -0
- package/dist/chunk-ETV4XYOV.cjs +7 -0
- package/dist/chunk-GUDT2W6I.js +70 -0
- package/dist/chunk-IQQTTKJL.cjs +70 -0
- package/dist/chunk-PKBMQBKP.js +7 -0
- package/dist/chunk-S5FVCA2E.cjs +86 -0
- package/dist/chunk-V3S6RBRJ.cjs +381 -0
- package/dist/client-C7u9zGwC.d.cts +332 -0
- package/dist/client-gE3fYzkD.d.ts +332 -0
- package/dist/core/actions/index.cjs +3 -3
- package/dist/core/actions/index.d.cts +21 -28
- package/dist/core/actions/index.d.ts +21 -28
- package/dist/core/actions/index.js +12 -12
- package/dist/core/index.cjs +3 -8
- package/dist/core/index.d.cts +8 -35
- package/dist/core/index.d.ts +8 -35
- package/dist/core/index.js +9 -14
- package/dist/core/interactions/index.cjs +13 -0
- package/dist/core/interactions/index.d.cts +53 -0
- package/dist/core/interactions/index.d.ts +53 -0
- package/dist/core/interactions/index.js +13 -0
- package/dist/error-C4Zm5nQe.d.cts +27 -0
- package/dist/error-C4Zm5nQe.d.ts +27 -0
- package/dist/interaction-D3-M3nBh.d.cts +22 -0
- package/dist/interaction-D3-M3nBh.d.ts +22 -0
- package/dist/react/index.cjs +279 -166
- package/dist/react/index.d.cts +80 -37
- package/dist/react/index.d.ts +80 -37
- package/dist/react/index.js +291 -178
- package/dist/sendTransaction-BZW627cT.d.cts +30 -0
- package/dist/sendTransaction-DpJTfGJc.d.ts +30 -0
- package/package.json +16 -7
- package/dist/chunk-AYZHGMEV.cjs +0 -171
- package/dist/chunk-PDR3CF3P.js +0 -86
- package/dist/chunk-SZUN32YC.js +0 -171
- package/dist/chunk-VK7GPKK4.js +0 -169
- package/dist/chunk-X4JNNWJ4.cjs +0 -86
- package/dist/chunk-ZOLP2FJZ.cjs +0 -169
- package/dist/client-BwzXSgqQ.d.cts +0 -278
- package/dist/client-BwzXSgqQ.d.ts +0 -278
- package/dist/watchUnlockStatus-DXClCYH9.d.cts +0 -43
- package/dist/watchUnlockStatus-WJxoDliF.d.ts +0 -43
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { Address, Hex, RpcSchema } from 'viem';
|
|
2
|
+
import { Prettify } from 'viem/chains';
|
|
3
|
+
import { SiweMessage } from 'viem/siwe';
|
|
4
|
+
import { P as PreparedInteraction, a as SendInteractionReturnType } from './interaction-D3-M3nBh.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for the Nexus Wallet SDK
|
|
8
|
+
*/
|
|
9
|
+
type NexusWalletSdkConfig = Readonly<{
|
|
10
|
+
walletUrl: string;
|
|
11
|
+
metadata: {
|
|
12
|
+
name: string;
|
|
13
|
+
css?: string;
|
|
14
|
+
};
|
|
15
|
+
domain: string;
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* SSO Metadata
|
|
20
|
+
*/
|
|
21
|
+
type SsoMetadata = {
|
|
22
|
+
logoUrl: string;
|
|
23
|
+
homepageLink: string;
|
|
24
|
+
links?: {
|
|
25
|
+
confidentialityLink?: string;
|
|
26
|
+
helpLink?: string;
|
|
27
|
+
cguLink?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Params to start a SSO
|
|
32
|
+
*/
|
|
33
|
+
type OpenSsoParamsType = {
|
|
34
|
+
redirectUrl?: string;
|
|
35
|
+
directExit?: boolean;
|
|
36
|
+
metadata: SsoMetadata;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Represent a generic modal step type
|
|
41
|
+
*/
|
|
42
|
+
type GenericModalStepType<TKey, TParams, TReturns> = {
|
|
43
|
+
key: TKey;
|
|
44
|
+
params: TParams extends never ? ModalStepMetadata : ModalStepMetadata & TParams;
|
|
45
|
+
returns: TReturns;
|
|
46
|
+
};
|
|
47
|
+
type ModalStepMetadata = {
|
|
48
|
+
metadata?: {
|
|
49
|
+
title?: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
primaryActionText?: string;
|
|
52
|
+
secondaryActionText?: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type LoginWithSso = {
|
|
57
|
+
allowSso: true;
|
|
58
|
+
ssoMetadata: SsoMetadata;
|
|
59
|
+
};
|
|
60
|
+
type LoginWithoutSso = {
|
|
61
|
+
allowSso?: false;
|
|
62
|
+
ssoMetadata?: never;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Generic type of modal we will display to the end user
|
|
66
|
+
*/
|
|
67
|
+
type LoginModalStepType = GenericModalStepType<"login", {
|
|
68
|
+
articleUrl?: string;
|
|
69
|
+
} & (LoginWithSso | LoginWithoutSso), {
|
|
70
|
+
wallet: Address;
|
|
71
|
+
}>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Parameters of the send transaction rpc request
|
|
75
|
+
*/
|
|
76
|
+
type SiweAuthenticationParams = Omit<SiweMessage, "address" | "chainId">;
|
|
77
|
+
/**
|
|
78
|
+
* Return type of the send transaction rpc request
|
|
79
|
+
*/
|
|
80
|
+
type SiweAuthenticateReturnType = Readonly<{
|
|
81
|
+
signature: Hex;
|
|
82
|
+
message: string;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Generic type of modal we will display to the end user
|
|
86
|
+
*/
|
|
87
|
+
type SiweAuthenticateModalStepType = GenericModalStepType<"siweAuthenticate", {
|
|
88
|
+
siwe: SiweAuthenticationParams;
|
|
89
|
+
}, SiweAuthenticateReturnType>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Generic format representing a tx to be sent
|
|
93
|
+
* todo: exploit the EIP-5792 here? https://eips.ethereum.org/EIPS/eip-5792
|
|
94
|
+
*/
|
|
95
|
+
type SendTransactionTxType = Readonly<{
|
|
96
|
+
to: Address;
|
|
97
|
+
data?: Hex;
|
|
98
|
+
value?: Hex;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Return type of the send transaction rpc request
|
|
102
|
+
*/
|
|
103
|
+
type SendTransactionReturnType = Readonly<{
|
|
104
|
+
hash: Hex;
|
|
105
|
+
}>;
|
|
106
|
+
type SendTransactionModalStepType = GenericModalStepType<"sendTransaction", {
|
|
107
|
+
tx: SendTransactionTxType | SendTransactionTxType[];
|
|
108
|
+
}, SendTransactionReturnType>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Return type of the send transaction rpc request
|
|
112
|
+
*/
|
|
113
|
+
type OpenInteractionSessionReturnType = Readonly<{
|
|
114
|
+
startTimestamp: number;
|
|
115
|
+
endTimestamp: number;
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Generic type of modal we will display to the end user
|
|
119
|
+
*/
|
|
120
|
+
type OpenInteractionSessionModalStepType = GenericModalStepType<"openSession", object, OpenInteractionSessionReturnType>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Generic type of modal we will display to the end user
|
|
124
|
+
*/
|
|
125
|
+
type SuccessModalStepType = GenericModalStepType<"success", {
|
|
126
|
+
sharing?: {
|
|
127
|
+
popupTitle?: string;
|
|
128
|
+
text?: string;
|
|
129
|
+
link?: string;
|
|
130
|
+
};
|
|
131
|
+
}, object>;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Generic type of steps we will display in the modal to the end user
|
|
135
|
+
*/
|
|
136
|
+
type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | OpenInteractionSessionModalStepType | SuccessModalStepType;
|
|
137
|
+
/**
|
|
138
|
+
* Type for the result of a modal request
|
|
139
|
+
*/
|
|
140
|
+
type ModalRpcStepsResultType<T extends ModalStepTypes[] = ModalStepTypes[]> = {
|
|
141
|
+
[K in T[number]["key"]]: Extract<T[number], {
|
|
142
|
+
key: K;
|
|
143
|
+
}>["returns"];
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Type for the RPC input of a modal
|
|
147
|
+
*/
|
|
148
|
+
type ModalRpcStepsInput<T extends ModalStepTypes[] = ModalStepTypes[]> = {
|
|
149
|
+
[K in T[number]["key"]]?: Extract<T[number], {
|
|
150
|
+
key: K;
|
|
151
|
+
}>["params"];
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* RPC metadata for the modal
|
|
155
|
+
*/
|
|
156
|
+
type ModalRpcMetadata = Readonly<{
|
|
157
|
+
header?: {
|
|
158
|
+
title?: string;
|
|
159
|
+
icon?: string;
|
|
160
|
+
};
|
|
161
|
+
context?: string;
|
|
162
|
+
}>;
|
|
163
|
+
/**
|
|
164
|
+
* Generic params used to display modals
|
|
165
|
+
*/
|
|
166
|
+
type DisplayModalParamsType<T extends ModalStepTypes[]> = {
|
|
167
|
+
steps: ModalRpcStepsInput<T>;
|
|
168
|
+
metadata?: ModalRpcMetadata;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
type WalletStatusReturnType = Readonly<WalletConnected | WalletNotConnected>;
|
|
172
|
+
type WalletConnected = {
|
|
173
|
+
key: "connected";
|
|
174
|
+
wallet: Address;
|
|
175
|
+
interactionSession?: {
|
|
176
|
+
startTimestamp: number;
|
|
177
|
+
endTimestamp: number;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
type WalletNotConnected = {
|
|
181
|
+
key: "not-connected";
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* RPC interface that's used for the iframe communication
|
|
186
|
+
*/
|
|
187
|
+
type IFrameRpcSchema = [
|
|
188
|
+
/**
|
|
189
|
+
* Method used to listen to the wallet status
|
|
190
|
+
*/
|
|
191
|
+
{
|
|
192
|
+
Method: "frak_listenToWalletStatus";
|
|
193
|
+
Parameters?: undefined;
|
|
194
|
+
ReturnType: WalletStatusReturnType;
|
|
195
|
+
},
|
|
196
|
+
/**
|
|
197
|
+
* Method to transmit a user interaction
|
|
198
|
+
*/
|
|
199
|
+
{
|
|
200
|
+
Method: "frak_displayModal";
|
|
201
|
+
Parameters: [
|
|
202
|
+
requests: ModalRpcStepsInput,
|
|
203
|
+
name: string,
|
|
204
|
+
metadata?: ModalRpcMetadata
|
|
205
|
+
];
|
|
206
|
+
ReturnType: ModalRpcStepsResultType;
|
|
207
|
+
},
|
|
208
|
+
/**
|
|
209
|
+
* Method to transmit a user interaction
|
|
210
|
+
*/
|
|
211
|
+
{
|
|
212
|
+
Method: "frak_sendInteraction";
|
|
213
|
+
Parameters: [
|
|
214
|
+
contentId: Hex,
|
|
215
|
+
interaction: PreparedInteraction,
|
|
216
|
+
signature?: Hex
|
|
217
|
+
];
|
|
218
|
+
ReturnType: SendInteractionReturnType;
|
|
219
|
+
},
|
|
220
|
+
/**
|
|
221
|
+
* Method to start a SSO
|
|
222
|
+
*/
|
|
223
|
+
{
|
|
224
|
+
Method: "frak_sso";
|
|
225
|
+
Parameters: [
|
|
226
|
+
params: OpenSsoParamsType,
|
|
227
|
+
name: string,
|
|
228
|
+
customCss?: string
|
|
229
|
+
];
|
|
230
|
+
ReturnType: undefined;
|
|
231
|
+
}
|
|
232
|
+
];
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Type that extract the possible parameters from a RPC Schema
|
|
236
|
+
*/
|
|
237
|
+
type ExtractedParametersFromRpc<TRpcSchema extends RpcSchema> = {
|
|
238
|
+
[K in keyof TRpcSchema]: Prettify<{
|
|
239
|
+
method: TRpcSchema[K] extends TRpcSchema[number] ? TRpcSchema[K]["Method"] : string;
|
|
240
|
+
} & (TRpcSchema[K] extends TRpcSchema[number] ? TRpcSchema[K]["Parameters"] extends undefined ? {
|
|
241
|
+
params?: never;
|
|
242
|
+
} : {
|
|
243
|
+
params: TRpcSchema[K]["Parameters"];
|
|
244
|
+
} : never)>;
|
|
245
|
+
}[number];
|
|
246
|
+
/**
|
|
247
|
+
* Type that extract the possible return type from a RPC Schema
|
|
248
|
+
*/
|
|
249
|
+
type ExtractedReturnTypeFromRpc<TRpcSchema extends RpcSchema, TParameters extends ExtractedParametersFromRpc<TRpcSchema> = ExtractedParametersFromRpc<TRpcSchema>> = ExtractedMethodFromRpc<TRpcSchema, TParameters["method"]>["ReturnType"];
|
|
250
|
+
/**
|
|
251
|
+
* Type that extract the possible return type from a RPC Schema
|
|
252
|
+
*/
|
|
253
|
+
type ExtractedMethodFromRpc<TRpcSchema extends RpcSchema, TMethod extends ExtractedParametersFromRpc<TRpcSchema>["method"] = ExtractedParametersFromRpc<TRpcSchema>["method"]> = Extract<TRpcSchema[number], {
|
|
254
|
+
Method: TMethod;
|
|
255
|
+
}>;
|
|
256
|
+
/**
|
|
257
|
+
* Raw response that we will receive after an rpc request
|
|
258
|
+
*/
|
|
259
|
+
type RpcResponse<TRpcSchema extends RpcSchema, TMethod extends TRpcSchema[number]["Method"] = TRpcSchema[number]["Method"]> = {
|
|
260
|
+
result: Extract<TRpcSchema[number], {
|
|
261
|
+
Method: TMethod;
|
|
262
|
+
}>["ReturnType"];
|
|
263
|
+
error?: never;
|
|
264
|
+
} | {
|
|
265
|
+
result?: never;
|
|
266
|
+
error: {
|
|
267
|
+
code: number;
|
|
268
|
+
message: string;
|
|
269
|
+
data?: unknown;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Type used for a one shot request function
|
|
274
|
+
*/
|
|
275
|
+
type RequestFn<TRpcSchema extends RpcSchema> = <TParameters extends ExtractedParametersFromRpc<TRpcSchema> = ExtractedParametersFromRpc<TRpcSchema>, _ReturnType = ExtractedReturnTypeFromRpc<TRpcSchema, TParameters>>(args: TParameters) => Promise<_ReturnType>;
|
|
276
|
+
/**
|
|
277
|
+
* Type used for a one shot request function
|
|
278
|
+
*/
|
|
279
|
+
type ListenerRequestFn<TRpcSchema extends RpcSchema> = <TParameters extends ExtractedParametersFromRpc<TRpcSchema> = ExtractedParametersFromRpc<TRpcSchema>>(args: TParameters, callback: (result: ExtractedReturnTypeFromRpc<TRpcSchema, TParameters>) => void) => Promise<void>;
|
|
280
|
+
/**
|
|
281
|
+
* IFrame transport interface
|
|
282
|
+
*/
|
|
283
|
+
type IFrameTransport = {
|
|
284
|
+
/**
|
|
285
|
+
* Wait for the connection to be established
|
|
286
|
+
*/
|
|
287
|
+
waitForConnection: Promise<boolean>;
|
|
288
|
+
/**
|
|
289
|
+
* Function used to perform a single request via the iframe transport
|
|
290
|
+
*/
|
|
291
|
+
request: RequestFn<IFrameRpcSchema>;
|
|
292
|
+
/**
|
|
293
|
+
* Function used to listen to a request response via the iframe transport
|
|
294
|
+
*/
|
|
295
|
+
listenerRequest: ListenerRequestFn<IFrameRpcSchema>;
|
|
296
|
+
/**
|
|
297
|
+
* Function used to destroy the iframe transport
|
|
298
|
+
*/
|
|
299
|
+
destroy: () => Promise<void>;
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Represent an iframe event
|
|
303
|
+
*/
|
|
304
|
+
type IFrameEvent = IFrameRpcEvent | IFrameLifecycleEvent;
|
|
305
|
+
/**
|
|
306
|
+
* Represent an iframe rpc event
|
|
307
|
+
*/
|
|
308
|
+
type IFrameRpcEvent = {
|
|
309
|
+
id: string;
|
|
310
|
+
topic: ExtractedParametersFromRpc<IFrameRpcSchema>["method"];
|
|
311
|
+
data: {
|
|
312
|
+
compressed: string;
|
|
313
|
+
compressedHash: string;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
type IFrameLifecycleEvent = {
|
|
317
|
+
lifecycle: "connected" | "show" | "hide";
|
|
318
|
+
data: never;
|
|
319
|
+
} | LifecycleEventCSS;
|
|
320
|
+
type LifecycleEventCSS = {
|
|
321
|
+
lifecycle: "modal-css";
|
|
322
|
+
data: string;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Representing a Nexus client
|
|
327
|
+
*/
|
|
328
|
+
type NexusClient = {
|
|
329
|
+
config: NexusWalletSdkConfig;
|
|
330
|
+
} & IFrameTransport;
|
|
331
|
+
|
|
332
|
+
export type { DisplayModalParamsType as D, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, LoginModalStepType as L, ModalRpcMetadata as M, NexusClient as N, OpenSsoParamsType as O, RpcResponse as R, SiweAuthenticationParams as S, WalletStatusReturnType as W, SiweAuthenticateReturnType as a, SendTransactionModalStepType as b, SendTransactionReturnType as c, ModalStepTypes as d, ModalRpcStepsResultType as e, NexusWalletSdkConfig as f, SuccessModalStepType as g, SsoMetadata as h, ModalRpcStepsInput as i, ModalStepMetadata as j, SiweAuthenticateModalStepType as k, SendTransactionTxType as l, OpenInteractionSessionReturnType as m, OpenInteractionSessionModalStepType as n, IFrameTransport as o, IFrameRpcEvent as p, IFrameEvent as q, ExtractedReturnTypeFromRpc as r };
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../../chunk-
|
|
8
|
+
var _chunkS5FVCA2Ecjs = require('../../chunk-S5FVCA2E.cjs');
|
|
9
|
+
require('../../chunk-ETV4XYOV.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -14,4 +14,4 @@ require('../../chunk-ZOLP2FJZ.cjs');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.
|
|
17
|
+
exports.displayModal = _chunkS5FVCA2Ecjs.displayModal; exports.openSso = _chunkS5FVCA2Ecjs.openSso; exports.sendInteraction = _chunkS5FVCA2Ecjs.sendInteraction; exports.sendTransaction = _chunkS5FVCA2Ecjs.sendTransaction; exports.siweAuthenticate = _chunkS5FVCA2Ecjs.siweAuthenticate; exports.watchWalletStatus = _chunkS5FVCA2Ecjs.watchWalletStatus;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-C7u9zGwC.cjs';
|
|
2
|
+
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-D3-M3nBh.cjs';
|
|
3
|
+
export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-BZW627cT.cjs';
|
|
4
|
+
import 'viem';
|
|
4
5
|
import 'viem/chains';
|
|
6
|
+
import 'viem/siwe';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Function used to watch the current nexus wallet status
|
|
@@ -10,37 +12,28 @@ import 'viem/chains';
|
|
|
10
12
|
*/
|
|
11
13
|
declare function watchWalletStatus(client: NexusClient, callback: (status: WalletStatusReturnType) => void): Promise<void>;
|
|
12
14
|
|
|
13
|
-
type GetStartUnlockUrlParams = StartArticleUnlockParams;
|
|
14
15
|
/**
|
|
15
|
-
* Function used to
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Function used to decode the response from the start unlock request (return typed passed as query param)
|
|
16
|
+
* Function used to send an interaction
|
|
17
|
+
* @param client
|
|
18
|
+
* @param contentId
|
|
19
|
+
* @param request
|
|
20
|
+
* @param validation
|
|
22
21
|
*/
|
|
23
|
-
declare function
|
|
24
|
-
result: string;
|
|
25
|
-
hash: string;
|
|
26
|
-
}): Promise<Readonly<StartArticleUnlockReturnType & {
|
|
27
|
-
validationHash: string;
|
|
28
|
-
}>>;
|
|
22
|
+
declare function sendInteraction(client: NexusClient, { contentId, interaction, validation }: SendInteractionParamsType): Promise<SendInteractionReturnType>;
|
|
29
23
|
|
|
30
24
|
/**
|
|
31
|
-
*
|
|
25
|
+
* Function used to display a modal
|
|
26
|
+
* @param client
|
|
27
|
+
* @param contentId
|
|
32
28
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
walletAddress: Address;
|
|
36
|
-
};
|
|
29
|
+
declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(client: NexusClient, { steps, metadata }: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
|
|
30
|
+
|
|
37
31
|
/**
|
|
38
|
-
* Function used to
|
|
32
|
+
* Function used to open the SSO
|
|
33
|
+
* todo: We are using the iframe here, since we need to send potentially load of datas, and it couldn't fit inside the query params of an url
|
|
39
34
|
* @param client
|
|
40
|
-
* @param
|
|
41
|
-
* @param walletAddress
|
|
42
|
-
* @param callback
|
|
35
|
+
* @param args
|
|
43
36
|
*/
|
|
44
|
-
declare function
|
|
37
|
+
declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<void>;
|
|
45
38
|
|
|
46
|
-
export {
|
|
39
|
+
export { displayModal, openSso, sendInteraction, watchWalletStatus };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-gE3fYzkD.js';
|
|
2
|
+
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-D3-M3nBh.js';
|
|
3
|
+
export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-DpJTfGJc.js';
|
|
4
|
+
import 'viem';
|
|
4
5
|
import 'viem/chains';
|
|
6
|
+
import 'viem/siwe';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Function used to watch the current nexus wallet status
|
|
@@ -10,37 +12,28 @@ import 'viem/chains';
|
|
|
10
12
|
*/
|
|
11
13
|
declare function watchWalletStatus(client: NexusClient, callback: (status: WalletStatusReturnType) => void): Promise<void>;
|
|
12
14
|
|
|
13
|
-
type GetStartUnlockUrlParams = StartArticleUnlockParams;
|
|
14
15
|
/**
|
|
15
|
-
* Function used to
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Function used to decode the response from the start unlock request (return typed passed as query param)
|
|
16
|
+
* Function used to send an interaction
|
|
17
|
+
* @param client
|
|
18
|
+
* @param contentId
|
|
19
|
+
* @param request
|
|
20
|
+
* @param validation
|
|
22
21
|
*/
|
|
23
|
-
declare function
|
|
24
|
-
result: string;
|
|
25
|
-
hash: string;
|
|
26
|
-
}): Promise<Readonly<StartArticleUnlockReturnType & {
|
|
27
|
-
validationHash: string;
|
|
28
|
-
}>>;
|
|
22
|
+
declare function sendInteraction(client: NexusClient, { contentId, interaction, validation }: SendInteractionParamsType): Promise<SendInteractionReturnType>;
|
|
29
23
|
|
|
30
24
|
/**
|
|
31
|
-
*
|
|
25
|
+
* Function used to display a modal
|
|
26
|
+
* @param client
|
|
27
|
+
* @param contentId
|
|
32
28
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
walletAddress: Address;
|
|
36
|
-
};
|
|
29
|
+
declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(client: NexusClient, { steps, metadata }: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
|
|
30
|
+
|
|
37
31
|
/**
|
|
38
|
-
* Function used to
|
|
32
|
+
* Function used to open the SSO
|
|
33
|
+
* todo: We are using the iframe here, since we need to send potentially load of datas, and it couldn't fit inside the query params of an url
|
|
39
34
|
* @param client
|
|
40
|
-
* @param
|
|
41
|
-
* @param walletAddress
|
|
42
|
-
* @param callback
|
|
35
|
+
* @param args
|
|
43
36
|
*/
|
|
44
|
-
declare function
|
|
37
|
+
declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<void>;
|
|
45
38
|
|
|
46
|
-
export {
|
|
39
|
+
export { displayModal, openSso, sendInteraction, watchWalletStatus };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
displayModal,
|
|
3
|
+
openSso,
|
|
4
|
+
sendInteraction,
|
|
5
|
+
sendTransaction,
|
|
6
|
+
siweAuthenticate,
|
|
7
7
|
watchWalletStatus
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-5CFD5FM2.js";
|
|
9
|
+
import "../../chunk-PKBMQBKP.js";
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
displayModal,
|
|
12
|
+
openSso,
|
|
13
|
+
sendInteraction,
|
|
14
|
+
sendTransaction,
|
|
15
|
+
siweAuthenticate,
|
|
16
16
|
watchWalletStatus
|
|
17
17
|
};
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var _chunkAYZHGMEVcjs = require('../chunk-AYZHGMEV.cjs');
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
|
|
8
|
+
var _chunkV3S6RBRJcjs = require('../chunk-V3S6RBRJ.cjs');
|
|
9
|
+
require('../chunk-ETV4XYOV.cjs');
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
var _chunkZOLP2FJZcjs = require('../chunk-ZOLP2FJZ.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
exports.createIFrameNexusClient = _chunkAYZHGMEVcjs.createIFrameNexusClient; exports.createIframe = _chunkZOLP2FJZcjs.createIframe; exports.decompressDataAndCheckHash = _chunkZOLP2FJZcjs.decompressDataAndCheckHash; exports.getIFrameResponseKeyProvider = _chunkZOLP2FJZcjs.getIFrameResponseKeyProvider; exports.getRedirectResponseResponseKeyProvider = _chunkZOLP2FJZcjs.getRedirectResponseResponseKeyProvider; exports.hashAndCompressData = _chunkZOLP2FJZcjs.hashAndCompressData; exports.iFrameRequestKeyProvider = _chunkZOLP2FJZcjs.iFrameRequestKeyProvider; exports.redirectRequestKeyProvider = _chunkZOLP2FJZcjs.redirectRequestKeyProvider;
|
|
17
|
+
exports.FrakRpcError = _chunkV3S6RBRJcjs.FrakRpcError; exports.RpcErrorCodes = _chunkV3S6RBRJcjs.RpcErrorCodes; exports.createIFrameNexusClient = _chunkV3S6RBRJcjs.createIFrameNexusClient; exports.createIframe = _chunkV3S6RBRJcjs.createIframe; exports.decompressDataAndCheckHash = _chunkV3S6RBRJcjs.decompressDataAndCheckHash; exports.hashAndCompressData = _chunkV3S6RBRJcjs.hashAndCompressData;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-C7u9zGwC.cjs';
|
|
2
|
+
export { D as DisplayModalParamsType, E as ExtractedParametersFromRpc, r as ExtractedReturnTypeFromRpc, q as IFrameEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, M as ModalRpcMetadata, i as ModalRpcStepsInput, e as ModalRpcStepsResultType, j as ModalStepMetadata, d as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, b as SendTransactionModalStepType, c as SendTransactionReturnType, l as SendTransactionTxType, k as SiweAuthenticateModalStepType, a as SiweAuthenticateReturnType, S as SiweAuthenticationParams, h as SsoMetadata, g as SuccessModalStepType, W as WalletStatusReturnType } from '../client-C7u9zGwC.cjs';
|
|
3
|
+
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-D3-M3nBh.cjs';
|
|
4
|
+
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-C4Zm5nQe.cjs';
|
|
3
5
|
import 'viem';
|
|
4
6
|
import 'viem/chains';
|
|
7
|
+
import 'viem/siwe';
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* Create a new iframe Nexus client
|
|
@@ -41,43 +44,13 @@ type KeyProvider<DataType> = (value: DataType) => string[];
|
|
|
41
44
|
/**
|
|
42
45
|
* Compress the given params, and add hash protection to (rapidly) prevent interception modification
|
|
43
46
|
* @param data The params to encode
|
|
44
|
-
* @param keyProvider The method used to access the keys
|
|
45
47
|
*/
|
|
46
|
-
declare function hashAndCompressData<T>(data: T
|
|
48
|
+
declare function hashAndCompressData<T>(data: T): Promise<CompressedData>;
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
51
|
* Decompress the given string
|
|
50
52
|
* @param compressedData The params to encode
|
|
51
|
-
* @param keyAccessor The key accessor used to query the keys used for the validation hash
|
|
52
53
|
*/
|
|
53
|
-
declare function decompressDataAndCheckHash<T>(compressedData: CompressedData
|
|
54
|
+
declare function decompressDataAndCheckHash<T>(compressedData: CompressedData): Promise<HashProtectedData<T>>;
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
* Get the right request key provider for the given args
|
|
57
|
-
* @param args
|
|
58
|
-
*/
|
|
59
|
-
declare const iFrameRequestKeyProvider: KeyProvider<ExtractedParametersFromRpc<IFrameRpcSchema>>;
|
|
60
|
-
type RpcResponseKeyProvider<TParameters extends Pick<ExtractedParametersFromRpc<IFrameRpcSchema>, "method">> = KeyProvider<ExtractedReturnTypeFromRpc<IFrameRpcSchema, Extract<ExtractedParametersFromRpc<IFrameRpcSchema>, {
|
|
61
|
-
method: TParameters["method"];
|
|
62
|
-
}>>>;
|
|
63
|
-
/**
|
|
64
|
-
* Get the right response key provider for the given param
|
|
65
|
-
* @param param
|
|
66
|
-
*/
|
|
67
|
-
declare function getIFrameResponseKeyProvider<TParameters extends Pick<ExtractedParametersFromRpc<IFrameRpcSchema>, "method">>(param: TParameters): RpcResponseKeyProvider<TParameters>;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Get the right request key provider for the given args
|
|
71
|
-
* @param args
|
|
72
|
-
*/
|
|
73
|
-
declare const redirectRequestKeyProvider: KeyProvider<ExtractedParametersFromRpc<RedirectRpcSchema>>;
|
|
74
|
-
type RedirectRpcResponseKeyProvider<TMethod extends ExtractedParametersFromRpc<RedirectRpcSchema>["method"]> = KeyProvider<Extract<RedirectRpcSchema[number], {
|
|
75
|
-
Method: TMethod;
|
|
76
|
-
}>["ReturnType"]>;
|
|
77
|
-
/**
|
|
78
|
-
* Get the right response key provider for the given redirect method
|
|
79
|
-
* @param method
|
|
80
|
-
*/
|
|
81
|
-
declare function getRedirectResponseResponseKeyProvider<TMethod extends ExtractedParametersFromRpc<RedirectRpcSchema>["method"]>(method: TMethod): RedirectRpcResponseKeyProvider<TMethod>;
|
|
82
|
-
|
|
83
|
-
export { type CompressedData, ExtractedParametersFromRpc, ExtractedReturnTypeFromRpc, type HashProtectedData, IFrameRpcSchema, type KeyProvider, NexusClient, NexusWalletSdkConfig, RedirectRpcSchema, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, getIFrameResponseKeyProvider, getRedirectResponseResponseKeyProvider, hashAndCompressData, iFrameRequestKeyProvider, redirectRequestKeyProvider };
|
|
56
|
+
export { type CompressedData, type HashProtectedData, type KeyProvider, NexusClient, NexusWalletSdkConfig, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, hashAndCompressData };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-gE3fYzkD.js';
|
|
2
|
+
export { D as DisplayModalParamsType, E as ExtractedParametersFromRpc, r as ExtractedReturnTypeFromRpc, q as IFrameEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, M as ModalRpcMetadata, i as ModalRpcStepsInput, e as ModalRpcStepsResultType, j as ModalStepMetadata, d as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, b as SendTransactionModalStepType, c as SendTransactionReturnType, l as SendTransactionTxType, k as SiweAuthenticateModalStepType, a as SiweAuthenticateReturnType, S as SiweAuthenticationParams, h as SsoMetadata, g as SuccessModalStepType, W as WalletStatusReturnType } from '../client-gE3fYzkD.js';
|
|
3
|
+
export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-D3-M3nBh.js';
|
|
4
|
+
export { F as FrakRpcError, R as RpcErrorCodes } from '../error-C4Zm5nQe.js';
|
|
3
5
|
import 'viem';
|
|
4
6
|
import 'viem/chains';
|
|
7
|
+
import 'viem/siwe';
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* Create a new iframe Nexus client
|
|
@@ -41,43 +44,13 @@ type KeyProvider<DataType> = (value: DataType) => string[];
|
|
|
41
44
|
/**
|
|
42
45
|
* Compress the given params, and add hash protection to (rapidly) prevent interception modification
|
|
43
46
|
* @param data The params to encode
|
|
44
|
-
* @param keyProvider The method used to access the keys
|
|
45
47
|
*/
|
|
46
|
-
declare function hashAndCompressData<T>(data: T
|
|
48
|
+
declare function hashAndCompressData<T>(data: T): Promise<CompressedData>;
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
51
|
* Decompress the given string
|
|
50
52
|
* @param compressedData The params to encode
|
|
51
|
-
* @param keyAccessor The key accessor used to query the keys used for the validation hash
|
|
52
53
|
*/
|
|
53
|
-
declare function decompressDataAndCheckHash<T>(compressedData: CompressedData
|
|
54
|
+
declare function decompressDataAndCheckHash<T>(compressedData: CompressedData): Promise<HashProtectedData<T>>;
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
* Get the right request key provider for the given args
|
|
57
|
-
* @param args
|
|
58
|
-
*/
|
|
59
|
-
declare const iFrameRequestKeyProvider: KeyProvider<ExtractedParametersFromRpc<IFrameRpcSchema>>;
|
|
60
|
-
type RpcResponseKeyProvider<TParameters extends Pick<ExtractedParametersFromRpc<IFrameRpcSchema>, "method">> = KeyProvider<ExtractedReturnTypeFromRpc<IFrameRpcSchema, Extract<ExtractedParametersFromRpc<IFrameRpcSchema>, {
|
|
61
|
-
method: TParameters["method"];
|
|
62
|
-
}>>>;
|
|
63
|
-
/**
|
|
64
|
-
* Get the right response key provider for the given param
|
|
65
|
-
* @param param
|
|
66
|
-
*/
|
|
67
|
-
declare function getIFrameResponseKeyProvider<TParameters extends Pick<ExtractedParametersFromRpc<IFrameRpcSchema>, "method">>(param: TParameters): RpcResponseKeyProvider<TParameters>;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Get the right request key provider for the given args
|
|
71
|
-
* @param args
|
|
72
|
-
*/
|
|
73
|
-
declare const redirectRequestKeyProvider: KeyProvider<ExtractedParametersFromRpc<RedirectRpcSchema>>;
|
|
74
|
-
type RedirectRpcResponseKeyProvider<TMethod extends ExtractedParametersFromRpc<RedirectRpcSchema>["method"]> = KeyProvider<Extract<RedirectRpcSchema[number], {
|
|
75
|
-
Method: TMethod;
|
|
76
|
-
}>["ReturnType"]>;
|
|
77
|
-
/**
|
|
78
|
-
* Get the right response key provider for the given redirect method
|
|
79
|
-
* @param method
|
|
80
|
-
*/
|
|
81
|
-
declare function getRedirectResponseResponseKeyProvider<TMethod extends ExtractedParametersFromRpc<RedirectRpcSchema>["method"]>(method: TMethod): RedirectRpcResponseKeyProvider<TMethod>;
|
|
82
|
-
|
|
83
|
-
export { type CompressedData, ExtractedParametersFromRpc, ExtractedReturnTypeFromRpc, type HashProtectedData, IFrameRpcSchema, type KeyProvider, NexusClient, NexusWalletSdkConfig, RedirectRpcSchema, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, getIFrameResponseKeyProvider, getRedirectResponseResponseKeyProvider, hashAndCompressData, iFrameRequestKeyProvider, redirectRequestKeyProvider };
|
|
56
|
+
export { type CompressedData, type HashProtectedData, type KeyProvider, NexusClient, NexusWalletSdkConfig, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, hashAndCompressData };
|