@frak-labs/core-sdk 0.0.19 → 0.1.0-beta.278e9605

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 (116) hide show
  1. package/package.json +26 -17
  2. package/src/actions/displayEmbeddedWallet.test.ts +194 -0
  3. package/src/actions/displayEmbeddedWallet.ts +20 -0
  4. package/src/actions/displayModal.test.ts +387 -0
  5. package/src/actions/displayModal.ts +131 -0
  6. package/src/actions/getProductInformation.test.ts +133 -0
  7. package/src/actions/getProductInformation.ts +14 -0
  8. package/src/actions/index.ts +29 -0
  9. package/src/actions/openSso.test.ts +407 -0
  10. package/src/actions/openSso.ts +116 -0
  11. package/src/actions/prepareSso.test.ts +223 -0
  12. package/src/actions/prepareSso.ts +48 -0
  13. package/src/actions/referral/processReferral.ts +230 -0
  14. package/src/actions/referral/referralInteraction.ts +57 -0
  15. package/src/actions/sendInteraction.test.ts +219 -0
  16. package/src/actions/sendInteraction.ts +32 -0
  17. package/src/actions/trackPurchaseStatus.test.ts +287 -0
  18. package/src/actions/trackPurchaseStatus.ts +53 -0
  19. package/src/actions/watchWalletStatus.test.ts +372 -0
  20. package/src/actions/watchWalletStatus.ts +94 -0
  21. package/src/actions/wrapper/modalBuilder.ts +212 -0
  22. package/src/actions/wrapper/sendTransaction.ts +62 -0
  23. package/src/actions/wrapper/siweAuthenticate.ts +94 -0
  24. package/src/bundle.ts +3 -0
  25. package/src/clients/DebugInfo.ts +182 -0
  26. package/src/clients/createIFrameFrakClient.ts +287 -0
  27. package/src/clients/index.ts +3 -0
  28. package/src/clients/setupClient.ts +73 -0
  29. package/src/clients/transports/iframeLifecycleManager.ts +90 -0
  30. package/src/constants/interactionTypes.ts +44 -0
  31. package/src/constants/locales.ts +14 -0
  32. package/src/constants/productTypes.ts +33 -0
  33. package/src/index.ts +101 -0
  34. package/src/interactions/index.ts +5 -0
  35. package/src/interactions/pressEncoder.test.ts +215 -0
  36. package/src/interactions/pressEncoder.ts +53 -0
  37. package/src/interactions/purchaseEncoder.test.ts +291 -0
  38. package/src/interactions/purchaseEncoder.ts +99 -0
  39. package/src/interactions/referralEncoder.test.ts +170 -0
  40. package/src/interactions/referralEncoder.ts +47 -0
  41. package/src/interactions/retailEncoder.test.ts +107 -0
  42. package/src/interactions/retailEncoder.ts +37 -0
  43. package/src/interactions/webshopEncoder.test.ts +56 -0
  44. package/src/interactions/webshopEncoder.ts +30 -0
  45. package/src/types/client.ts +14 -0
  46. package/src/types/compression.ts +22 -0
  47. package/src/types/config.ts +111 -0
  48. package/src/types/context.ts +13 -0
  49. package/src/types/index.ts +71 -0
  50. package/src/types/lifecycle/client.ts +46 -0
  51. package/src/types/lifecycle/iframe.ts +35 -0
  52. package/src/types/lifecycle/index.ts +2 -0
  53. package/src/types/rpc/displayModal.ts +84 -0
  54. package/src/types/rpc/embedded/index.ts +68 -0
  55. package/src/types/rpc/embedded/loggedIn.ts +55 -0
  56. package/src/types/rpc/embedded/loggedOut.ts +28 -0
  57. package/src/types/rpc/interaction.ts +43 -0
  58. package/src/types/rpc/modal/final.ts +46 -0
  59. package/src/types/rpc/modal/generic.ts +46 -0
  60. package/src/types/rpc/modal/index.ts +20 -0
  61. package/src/types/rpc/modal/login.ts +32 -0
  62. package/src/types/rpc/modal/openSession.ts +25 -0
  63. package/src/types/rpc/modal/siweAuthenticate.ts +37 -0
  64. package/src/types/rpc/modal/transaction.ts +33 -0
  65. package/src/types/rpc/productInformation.ts +59 -0
  66. package/src/types/rpc/sso.ts +80 -0
  67. package/src/types/rpc/walletStatus.ts +35 -0
  68. package/src/types/rpc.ts +158 -0
  69. package/src/types/transport.ts +34 -0
  70. package/src/utils/FrakContext.test.ts +338 -0
  71. package/src/utils/FrakContext.ts +158 -0
  72. package/src/utils/compression/b64.test.ts +181 -0
  73. package/src/utils/compression/b64.ts +29 -0
  74. package/src/utils/compression/compress.test.ts +123 -0
  75. package/src/utils/compression/compress.ts +11 -0
  76. package/src/utils/compression/decompress.test.ts +145 -0
  77. package/src/utils/compression/decompress.ts +11 -0
  78. package/src/utils/compression/index.ts +3 -0
  79. package/src/utils/computeProductId.test.ts +80 -0
  80. package/src/utils/computeProductId.ts +11 -0
  81. package/src/utils/constants.test.ts +23 -0
  82. package/src/utils/constants.ts +4 -0
  83. package/src/utils/formatAmount.test.ts +113 -0
  84. package/src/utils/formatAmount.ts +18 -0
  85. package/src/utils/getCurrencyAmountKey.test.ts +44 -0
  86. package/src/utils/getCurrencyAmountKey.ts +15 -0
  87. package/src/utils/getSupportedCurrency.test.ts +51 -0
  88. package/src/utils/getSupportedCurrency.ts +14 -0
  89. package/src/utils/getSupportedLocale.test.ts +64 -0
  90. package/src/utils/getSupportedLocale.ts +16 -0
  91. package/src/utils/iframeHelper.test.ts +450 -0
  92. package/src/utils/iframeHelper.ts +143 -0
  93. package/src/utils/index.ts +21 -0
  94. package/src/utils/sso.test.ts +361 -0
  95. package/src/utils/sso.ts +119 -0
  96. package/src/utils/ssoUrlListener.ts +60 -0
  97. package/src/utils/trackEvent.test.ts +162 -0
  98. package/src/utils/trackEvent.ts +26 -0
  99. package/cdn/bundle.js +0 -19
  100. package/cdn/bundle.js.LICENSE.txt +0 -10
  101. package/dist/actions.cjs +0 -1
  102. package/dist/actions.d.cts +0 -1400
  103. package/dist/actions.d.ts +0 -1400
  104. package/dist/actions.js +0 -1
  105. package/dist/bundle.cjs +0 -13
  106. package/dist/bundle.d.cts +0 -2022
  107. package/dist/bundle.d.ts +0 -2022
  108. package/dist/bundle.js +0 -13
  109. package/dist/index.cjs +0 -13
  110. package/dist/index.d.cts +0 -1373
  111. package/dist/index.d.ts +0 -1373
  112. package/dist/index.js +0 -13
  113. package/dist/interactions.cjs +0 -1
  114. package/dist/interactions.d.cts +0 -182
  115. package/dist/interactions.d.ts +0 -182
  116. package/dist/interactions.js +0 -1
package/dist/index.d.cts DELETED
@@ -1,1373 +0,0 @@
1
- import type { Address } from 'viem';
2
- import type { Hex } from 'viem';
3
- import type { OpenPanel } from '@openpanel/web';
4
- import type { Prettify } from 'viem/chains';
5
- import type { RpcSchema } from 'viem';
6
- import type { SiweMessage } from 'viem/siwe';
7
-
8
- /**
9
- * Decode a base64url encoded string
10
- * @param value The value to decode
11
- * @returns The decoded value
12
- */
13
- export declare function base64urlDecode(value: string): Uint8Array;
14
-
15
- /**
16
- * Encode a buffer to a base64url encoded string
17
- * @param buffer The buffer to encode
18
- * @returns The encoded string
19
- */
20
- export declare function base64urlEncode(buffer: Uint8Array): string;
21
-
22
- /**
23
- * Base props for the iframe
24
- * @ignore
25
- */
26
- export declare const baseIframeProps: {
27
- id: string;
28
- name: string;
29
- title: string;
30
- allow: string;
31
- style: {
32
- width: string;
33
- height: string;
34
- border: string;
35
- position: string;
36
- zIndex: number;
37
- top: string;
38
- left: string;
39
- colorScheme: string;
40
- };
41
- };
42
-
43
- /**
44
- * Event related to the iframe lifecycle
45
- * @ignore
46
- */
47
- export declare type ClientLifecycleEvent = CustomCssEvent | CustomI18nEvent | RestoreBackupEvent | HearbeatEvent | HandshakeResponse;
48
-
49
- /** @ignore */
50
- export declare class ClientNotFound extends FrakRpcError {
51
- constructor();
52
- }
53
-
54
- /**
55
- * Compress the current Frak context
56
- * @param context - The context to be compressed
57
- * @returns A compressed string containing the Frak context
58
- */
59
- declare function compress(context?: Partial<FrakContext>): string | undefined;
60
-
61
- /**
62
- * The received encoded data from a client
63
- * -> The encoded should contain a HashProtectedData once decoded
64
- * @ignore
65
- */
66
- export declare type CompressedData = Uint8Array;
67
-
68
- /**
69
- * Compress json data
70
- * @param data
71
- * @ignore
72
- */
73
- export declare function compressJson(data: unknown): Uint8Array;
74
-
75
- /**
76
- * Compress json data
77
- * @param data
78
- * @ignore
79
- */
80
- export declare function compressJsonToB64(data: unknown): string;
81
-
82
- /**
83
- * Create the Frak iframe
84
- * @param args
85
- * @param args.walletBaseUrl - Use `config.walletUrl` instead. Will be removed in future versions.
86
- * @param args.config - The configuration object containing iframe options, including the replacement for `walletBaseUrl`.
87
- */
88
- export declare function createIframe({ walletBaseUrl, config, }: {
89
- walletBaseUrl?: string;
90
- config?: FrakWalletSdkConfig;
91
- }): Promise<HTMLIFrameElement | undefined>;
92
-
93
- /**
94
- * Create a new iframe Frak client
95
- * @param args
96
- * @param args.config - The configuration to use for the Frak Wallet SDK
97
- * @param args.iframe - The iframe to use for the communication
98
- * @returns The created Frak Client
99
- *
100
- * @example
101
- * const frakConfig: FrakWalletSdkConfig = {
102
- * metadata: {
103
- * name: "My app title",
104
- * },
105
- * }
106
- * const iframe = await createIframe({ config: frakConfig });
107
- * const client = createIFrameFrakClient({ config: frakConfig, iframe });
108
- */
109
- export declare function createIFrameFrakClient({ config, iframe, }: {
110
- config: FrakWalletSdkConfig;
111
- iframe: HTMLIFrameElement;
112
- }): FrakClient;
113
-
114
- /**
115
- * All the currencies available
116
- * @category Config
117
- */
118
- export declare type Currency = "eur" | "usd" | "gbp";
119
-
120
- declare type CustomCssEvent = {
121
- clientLifecycle: "modal-css";
122
- data: {
123
- cssLink: string;
124
- };
125
- };
126
-
127
- declare type CustomI18nEvent = {
128
- clientLifecycle: "modal-i18n";
129
- data: {
130
- i18n: I18nConfig;
131
- };
132
- };
133
-
134
- /** @ignore */
135
- export declare class DebugInfoGatherer {
136
- private config?;
137
- private iframe?;
138
- private isSetupDone;
139
- private lastResponse;
140
- private lastRequest;
141
- constructor(config?: FrakWalletSdkConfig, iframe?: HTMLIFrameElement);
142
- setLastResponse(event: MessageEvent<IFrameEvent>): void;
143
- setLastRequest(event: IFrameEvent, target: string): void;
144
- updateSetupStatus(status: boolean): void;
145
- private base64Encode;
146
- /**
147
- * Extract information from the iframe status
148
- */
149
- private getIframeStatus;
150
- private getNavigatorInfo;
151
- private gatherDebugInfo;
152
- static empty(): DebugInfoGatherer;
153
- /**
154
- * Format Frak debug information
155
- */
156
- formatDebugInfo(error: Error | unknown | string): string;
157
- }
158
-
159
- /**
160
- * Decompress the given Frak context
161
- * @param context - The raw context to be decompressed into a `FrakContext`
162
- * @returns The decompressed Frak context, or undefined if it fails
163
- */
164
- declare function decompress(context?: string): FrakContext | undefined;
165
-
166
- /**
167
- * Decompress the given string
168
- * @param compressedData The params to encode
169
- * @ignore
170
- */
171
- export declare function decompressDataAndCheckHash<T>(compressedData: CompressedData): HashProtectedData<T>;
172
-
173
- /**
174
- * Decompress json data
175
- * @param data
176
- * @ignore
177
- */
178
- export declare function decompressJson<T>(data: Uint8Array): T | null;
179
-
180
- /**
181
- * Decompress json data
182
- * @param data
183
- * @ignore
184
- */
185
- export declare function decompressJsonFromB64<T>(data: string): T | null;
186
-
187
- /**
188
- * Simple deferred promise wrapper
189
- * @ignore
190
- */
191
- export declare class Deferred<T> {
192
- private readonly _promise;
193
- private _resolve;
194
- private _reject;
195
- constructor();
196
- get promise(): Promise<T>;
197
- resolve: (value: T | PromiseLike<T>) => void;
198
- reject: (reason?: unknown) => void;
199
- }
200
-
201
- /**
202
- * The params used to display the embedded wallet
203
- *
204
- * @group Embedded wallet
205
- */
206
- export declare type DisplayEmbeddedWalletParamsType = {
207
- /**
208
- * The embedded view to display once the user is logged in
209
- */
210
- loggedIn?: LoggedInEmbeddedView;
211
- /**
212
- * The embedded view to display once the user is logged out
213
- */
214
- loggedOut?: LoggedOutEmbeddedView;
215
- /**
216
- * Some metadata to customize the embedded view
217
- */
218
- metadata?: {
219
- /**
220
- * The logo to display on the embedded wallet
221
- * If undefined, will default to no logo displayed
222
- */
223
- logo?: string;
224
- /**
225
- * Link to the homepage of the calling website
226
- * If undefined, will default to the domain of the calling website
227
- */
228
- homepageLink?: string;
229
- /**
230
- * The target interaction behind this modal
231
- */
232
- targetInteraction?: FullInteractionTypesKey;
233
- /**
234
- * The position of the component
235
- */
236
- position?: "left" | "right";
237
- /**
238
- * Some i18n override for the displayed modal (i.e. update the displayed text only for this modal)
239
- */
240
- i18n?: I18nConfig;
241
- };
242
- };
243
-
244
- /**
245
- * The result of the display embedded wallet rpc request
246
- *
247
- * @group Embedded wallet
248
- */
249
- export declare type DisplayEmbeddedWalletResultType = {
250
- wallet: Address;
251
- };
252
-
253
- /**
254
- * Params used to display a modal
255
- * @typeParam T - The list of modal steps we expect to have in the modal
256
- * @group Modal Display
257
- */
258
- export declare type DisplayModalParamsType<T extends ModalStepTypes[]> = {
259
- steps: ModalRpcStepsInput<T>;
260
- metadata?: ModalRpcMetadata;
261
- };
262
-
263
- declare type DoBackupEvent = {
264
- iframeLifecycle: "do-backup";
265
- data: {
266
- backup?: string;
267
- };
268
- };
269
-
270
- /**
271
- * The action to display on the logged out embedded view when the user is referred
272
- *
273
- * @group Embedded wallet
274
- */
275
- export declare type EmbeddedViewActionReferred = {
276
- key: "referred";
277
- /**
278
- * No options for a referred action
279
- */
280
- options?: never;
281
- };
282
-
283
- /**
284
- * The different type of action we can have on the embedded view (once the user is logged in)
285
- *
286
- * @group Embedded wallet
287
- */
288
- export declare type EmbeddedViewActionSharing = {
289
- key: "sharing";
290
- /**
291
- * Some sharing options
292
- */
293
- options?: {
294
- /**
295
- * The title that will be displayed on the system popup once the system sharing window is open
296
- * @deprecated Use the top level `config.metadata.i18n` instead
297
- */
298
- popupTitle?: string;
299
- /**
300
- * The text that will be shared alongside the link.
301
- * Can contain the variable {LINK} to specify where the link is placed, otherwise it will be added at the end
302
- * @deprecated Use the top level `config.metadata.i18n` instead
303
- */
304
- text?: string;
305
- /**
306
- * The link to be shared (will be suffixed with the Frak sharing context)
307
- */
308
- link?: string;
309
- };
310
- };
311
-
312
- declare type EventProps = Record<string, unknown>;
313
-
314
- /**
315
- * Type that extract the possible return type from a RPC Schema
316
- * @ignore
317
- */
318
- declare type ExtractedMethodFromRpc<TRpcSchema extends RpcSchema, TMethod extends ExtractedParametersFromRpc<TRpcSchema>["method"] = ExtractedParametersFromRpc<TRpcSchema>["method"]> = Extract<TRpcSchema[number], {
319
- Method: TMethod;
320
- }>;
321
-
322
- /**
323
- * Type that extract the possible parameters from a RPC Schema
324
- * @ignore
325
- */
326
- export declare type ExtractedParametersFromRpc<TRpcSchema extends RpcSchema> = {
327
- [K in keyof TRpcSchema]: Prettify<{
328
- method: TRpcSchema[K] extends TRpcSchema[number] ? TRpcSchema[K]["Method"] : string;
329
- } & (TRpcSchema[K] extends TRpcSchema[number] ? TRpcSchema[K]["Parameters"] extends undefined ? {
330
- params?: never;
331
- } : {
332
- params: TRpcSchema[K]["Parameters"];
333
- } : never)>;
334
- }[number];
335
-
336
- /**
337
- * Type that extract the possible return type from a RPC Schema
338
- * @ignore
339
- */
340
- export declare type ExtractedReturnTypeFromRpc<TRpcSchema extends RpcSchema, TParameters extends ExtractedParametersFromRpc<TRpcSchema> = ExtractedParametersFromRpc<TRpcSchema>> = ExtractedMethodFromRpc<TRpcSchema, TParameters["method"]>["ReturnType"];
341
-
342
- /**
343
- * The different types of final actions we can display in the final step
344
- * @group Modal Display
345
- */
346
- export declare type FinalActionType = {
347
- key: "sharing";
348
- options?: {
349
- /**
350
- * @deprecated Use the top level `config.metadata.i18n` instead
351
- */
352
- popupTitle?: string;
353
- /**
354
- * @deprecated Use the top level `config.metadata.i18n` instead
355
- */
356
- text?: string;
357
- link?: string;
358
- };
359
- } | {
360
- key: "reward";
361
- options?: never;
362
- };
363
-
364
- /**
365
- * The final modal step type, could be used to display sharing options or a success reward screen.
366
- *
367
- * **Input**: What type final step to display?
368
- * **Output**: None
369
- *
370
- * @group Modal Display
371
- */
372
- export declare type FinalModalStepType = GenericModalStepType<"final", {
373
- dismissedMetadata?: ModalStepMetadata["metadata"];
374
- action: FinalActionType;
375
- autoSkip?: boolean;
376
- }, object>;
377
-
378
- export declare function formatAmount(amount: number, currency?: Currency): string;
379
-
380
- /**
381
- * Representing a Frak client, used to interact with the Frak Wallet
382
- */
383
- export declare type FrakClient = {
384
- config: FrakWalletSdkConfig;
385
- debugInfo: {
386
- formatDebugInfo: (error: Error | unknown | string) => string;
387
- };
388
- openPanel?: OpenPanel;
389
- } & IFrameTransport;
390
-
391
- /**
392
- * The current Frak Context
393
- *
394
- * For now, only contain a referrer address.
395
- *
396
- * @ignore
397
- */
398
- export declare type FrakContext = {
399
- r: Address;
400
- };
401
-
402
- /**
403
- * Export our frak context "class"
404
- */
405
- export declare const FrakContextManager: {
406
- compress: typeof compress;
407
- decompress: typeof decompress;
408
- parse: typeof parse;
409
- update: typeof update;
410
- remove: typeof remove;
411
- replaceUrl: typeof replaceUrl;
412
- };
413
-
414
- declare type FrakEvent = "share_button_clicked" | "wallet_button_clicked" | "share_modal_error" | "user_referred";
415
-
416
- /**
417
- * Generic Frak RPC error
418
- * @ignore
419
- */
420
- export declare class FrakRpcError<T = undefined> extends Error {
421
- code: number;
422
- data?: T | undefined;
423
- constructor(code: number, message: string, data?: T | undefined);
424
- }
425
-
426
- /**
427
- * Configuration for the Frak Wallet SDK
428
- * @category Config
429
- */
430
- export declare type FrakWalletSdkConfig = {
431
- /**
432
- * The Frak wallet url
433
- * @defaultValue "https://wallet.frak.id"
434
- */
435
- walletUrl?: string;
436
- /**
437
- * Some metadata about your implementation of the Frak SDK
438
- */
439
- metadata: {
440
- /**
441
- * Your application name (will be displayed in a few modals and in SSO)
442
- */
443
- name: string;
444
- /**
445
- * Language to display in the modal
446
- * If undefined, will default to the browser language
447
- */
448
- lang?: Language;
449
- /**
450
- * The currency to display in the modal
451
- * @defaultValue `"eur"`
452
- */
453
- currency?: Currency;
454
- /**
455
- * The logo URL that will be displayed in a few components
456
- */
457
- logoUrl?: string;
458
- /**
459
- * The homepage link that could be displayed in a few components
460
- */
461
- homepageLink?: string;
462
- };
463
- /**
464
- * Some customization for the modal
465
- */
466
- customizations?: {
467
- /**
468
- * Custom CSS styles to apply to the modals and components
469
- */
470
- css?: `${string}.css`;
471
- /**
472
- * Custom i18n configuration for the modal
473
- */
474
- i18n?: I18nConfig;
475
- };
476
- /**
477
- * The domain name of your application
478
- * @defaultValue window.location.host
479
- */
480
- domain?: string;
481
- };
482
-
483
- /**
484
- * The keys for each interaction types (e.g. `press.openArticle`) -> category_type.interaction_type
485
- * @inline
486
- */
487
- export declare type FullInteractionTypesKey = {
488
- [Category in keyof typeof interactionTypes]: `${Category & string}.${keyof (typeof interactionTypes)[Category] & string}`;
489
- }[keyof typeof interactionTypes];
490
-
491
- /**
492
- * Represent a generic modal step type
493
- * @ignore
494
- * @inline
495
- */
496
- declare type GenericModalStepType<TKey, TParams, TReturns> = {
497
- key: TKey;
498
- params: TParams extends never ? ModalStepMetadata : ModalStepMetadata & TParams;
499
- returns: TReturns;
500
- };
501
-
502
- /**
503
- * Get the currency amount key for a given currency
504
- * @param currency - The currency to use
505
- * @returns The currency amount key
506
- */
507
- export declare function getCurrencyAmountKey(currency?: Currency): keyof TokenAmountType;
508
-
509
- /**
510
- * Response of the `frak_getProductInformation` RPC method
511
- * @group RPC Schema
512
- */
513
- export declare type GetProductInformationReturnType = {
514
- /**
515
- * Current product id
516
- */
517
- id: Hex;
518
- /**
519
- * Some metadata
520
- */
521
- onChainMetadata: {
522
- /**
523
- * Name of the product on-chain
524
- */
525
- name: string;
526
- /**
527
- * Domain of the product on-chain
528
- */
529
- domain: string;
530
- /**
531
- * The supported product types
532
- */
533
- productTypes: ProductTypesKey[];
534
- };
535
- /**
536
- * The max potential reward for the referrer
537
- */
538
- maxReferrer?: TokenAmountType;
539
- /**
540
- * The max potential reward for the referee
541
- */
542
- maxReferee?: TokenAmountType;
543
- /**
544
- * List of all the potentials reward arround this product
545
- */
546
- rewards: {
547
- token: Address;
548
- campaign: Address;
549
- interactionTypeKey: FullInteractionTypesKey;
550
- referrer: TokenAmountType;
551
- referee: TokenAmountType;
552
- }[];
553
- };
554
-
555
- /**
556
- * Get the supported currency for a given currency
557
- * @param currency - The currency to use
558
- * @returns The supported currency
559
- */
560
- export declare function getSupportedCurrency(currency?: Currency): Currency;
561
-
562
- /**
563
- * Get the supported locale for a given currency
564
- * @param currency - The currency to use
565
- * @returns The supported locale
566
- */
567
- export declare function getSupportedLocale(currency?: Currency): (typeof locales)[LocalesKey];
568
-
569
- declare type HandshakeRequestEvent = {
570
- iframeLifecycle: "handshake";
571
- data: {
572
- token: string;
573
- };
574
- };
575
-
576
- declare type HandshakeResponse = {
577
- clientLifecycle: "handshake-response";
578
- data: {
579
- token: string;
580
- currentUrl: string;
581
- };
582
- };
583
-
584
- /**
585
- * Compress the given params, and add hash protection to (rapidly) prevent interception modification
586
- * @param data The params to encode
587
- * @ignore
588
- */
589
- export declare function hashAndCompressData<T>(data: T): CompressedData;
590
-
591
- /**
592
- * The encoded data to send to a client / received by a client
593
- * @ignore
594
- */
595
- export declare type HashProtectedData<DataType> = Readonly<DataType & {
596
- validationHash: string;
597
- }>;
598
-
599
- declare type HearbeatEvent = {
600
- clientLifecycle: "heartbeat";
601
- };
602
-
603
- /**
604
- * Custom i18n configuration for the modal
605
- * See [i18next json format](https://www.i18next.com/misc/json-format#i18next-json-v4)
606
- *
607
- * Available variables
608
- * - `{{ productName }}` : The name of your website (`metadata.name`)
609
- * - `{{ productOrigin }}` : The origin url of your website
610
- * - `{{ estimatedReward }}` : The estimated reward for the user (based on the specific `targetInteraction` you can specify, or the max referrer reward if no target interaction is specified)
611
- *
612
- * Context of the translation [see i18n context](https://www.i18next.com/translation-function/context)
613
- * - For modal display, the key of the final action (`sharing`, `reward`, or undefined)
614
- * - For embedded wallet display, the key of the logged in action (`sharing` or undefined)
615
- *
616
- * @example
617
- * ```ts
618
- * // Multi language config
619
- * const multiI18n = {
620
- * fr: {
621
- * "sdk.modal.title": "Titre de modal",
622
- * "sdk.modal.description": "Description de modal, avec {{ estimatedReward }} de gains possible",
623
- * },
624
- * en: "https://example.com/en.json"
625
- * }
626
- *
627
- * // Single language config
628
- * const singleI18n = {
629
- * "sdk.modal.title": "Modal title",
630
- * "sdk.modal.description": "Modal description, with {{ estimatedReward }} of gains possible",
631
- * }
632
- * ```
633
- *
634
- * @category Config
635
- */
636
- export declare type I18nConfig = Record<Language, LocalizedI18nConfig> | LocalizedI18nConfig;
637
-
638
- /**
639
- * Represent an iframe event
640
- */
641
- export declare type IFrameEvent = IFrameRpcEvent | IFrameLifecycleEvent | ClientLifecycleEvent;
642
-
643
- /**
644
- * Event related to the iframe lifecycle
645
- * @ignore
646
- */
647
- export declare type IFrameLifecycleEvent = {
648
- iframeLifecycle: "connected" | "show" | "hide";
649
- data?: never;
650
- } | DoBackupEvent | RemoveBackupEvent | HandshakeRequestEvent | RedirectRequestEvent;
651
-
652
- /**
653
- * Represent an iframe rpc event
654
- */
655
- export declare type IFrameRpcEvent = {
656
- id: string;
657
- topic: ExtractedParametersFromRpc<IFrameRpcSchema>["method"];
658
- data: CompressedData;
659
- };
660
-
661
- /**
662
- * RPC interface that's used for the iframe communication
663
- *
664
- * Define all the methods available within the iFrame RPC client
665
- *
666
- * @group RPC Schema
667
- *
668
- * @remarks
669
- * Here is the list of methods available:
670
- *
671
- * ### frak_listenToWalletStatus
672
- * - Params: None
673
- * - Returns: {@link WalletStatusReturnType}
674
- *
675
- * ### frak_displayModal
676
- * - Params: [{@link ModalRpcStepsInput}, name: string, metadata?: {@link ModalRpcMetadata}]
677
- * - Returns: {@link ModalRpcStepsResultType}
678
- *
679
- * ### frak_sendInteraction
680
- * - Params: [productId: Hex, interaction: {@link PreparedInteraction}, signature?: Hex]
681
- * - Returns: {@link SendInteractionReturnType}
682
- *
683
- * ### frak_sso
684
- * - Params [params: {@link OpenSsoParamsType}, name: string, customCss?: string]
685
- * - Returns: undefined
686
- *
687
- * ### frak_getProductInformation
688
- * - Params: None
689
- * - Returns: {@link GetProductInformationReturnType}
690
- *
691
- * ### frak_displayEmbeddedWallet
692
- * - Params: [{@link DisplayEmbeddedWalletParamsType}]
693
- * - Returns: {@link DisplayEmbeddedWalletResultType}
694
- */
695
- export declare type IFrameRpcSchema = [
696
- /**
697
- * Method used to listen to the wallet status
698
- */
699
- {
700
- Method: "frak_listenToWalletStatus";
701
- Parameters?: undefined;
702
- ReturnType: WalletStatusReturnType;
703
- },
704
- /**
705
- * Method to display a modal with the provided steps
706
- */
707
- {
708
- Method: "frak_displayModal";
709
- Parameters: [
710
- requests: ModalRpcStepsInput,
711
- metadata: ModalRpcMetadata | undefined,
712
- configMetadata: FrakWalletSdkConfig["metadata"]
713
- ];
714
- ReturnType: ModalRpcStepsResultType;
715
- },
716
- /**
717
- * Method to transmit a user interaction
718
- */
719
- {
720
- Method: "frak_sendInteraction";
721
- Parameters: [
722
- productId: Hex,
723
- interaction: PreparedInteraction,
724
- signature?: Hex
725
- ];
726
- ReturnType: SendInteractionReturnType;
727
- },
728
- /**
729
- * Method to start a SSO
730
- * todo: Should also support direct tracking via a consumeKey
731
- */
732
- {
733
- Method: "frak_sso";
734
- Parameters: [
735
- params: OpenSsoParamsType,
736
- name: string,
737
- customCss?: string
738
- ];
739
- ReturnType: undefined;
740
- },
741
- /**
742
- * Method to get current product information's
743
- * - Is product minted?
744
- * - Does it have running campaign?
745
- * - Estimated reward on actions
746
- */
747
- {
748
- Method: "frak_getProductInformation";
749
- Parameters?: undefined;
750
- ReturnType: GetProductInformationReturnType;
751
- },
752
- /**
753
- * Method to show the embedded wallet, with potential customization
754
- */
755
- {
756
- Method: "frak_displayEmbeddedWallet";
757
- Parameters: [
758
- request: DisplayEmbeddedWalletParamsType,
759
- metadata: FrakWalletSdkConfig["metadata"]
760
- ];
761
- ReturnType: DisplayEmbeddedWalletResultType;
762
- }
763
- ];
764
-
765
- /**
766
- * IFrame transport interface
767
- */
768
- export declare type IFrameTransport = {
769
- /**
770
- * Wait for the connection to be established
771
- */
772
- waitForConnection: Promise<boolean>;
773
- /**
774
- * Wait for the setup to be done
775
- */
776
- waitForSetup: Promise<void>;
777
- /**
778
- * Function used to perform a single request via the iframe transport
779
- */
780
- request: RequestFn<IFrameRpcSchema>;
781
- /**
782
- * Function used to listen to a request response via the iframe transport
783
- */
784
- listenerRequest: ListenerRequestFn<IFrameRpcSchema>;
785
- /**
786
- * Function used to destroy the iframe transport
787
- */
788
- destroy: () => Promise<void>;
789
- };
790
-
791
- /**
792
- * Each interactions types according to the product types
793
- */
794
- export declare const interactionTypes: {
795
- readonly press: {
796
- readonly openArticle: "0xc0a24ffb";
797
- readonly readArticle: "0xd5bd0fbe";
798
- };
799
- readonly dapp: {
800
- readonly proofVerifiableStorageUpdate: "0x2ab2aeef";
801
- readonly callableVerifiableStorageUpdate: "0xa07da986";
802
- };
803
- readonly webshop: {
804
- readonly open: "0xb311798f";
805
- };
806
- readonly referral: {
807
- readonly referred: "0x010cc3b9";
808
- readonly createLink: "0xb2c0f17c";
809
- };
810
- readonly purchase: {
811
- readonly started: "0xd87e90c3";
812
- readonly completed: "0x8403aeb4";
813
- readonly unsafeCompleted: "0x4d5b14e0";
814
- };
815
- readonly retail: {
816
- readonly customerMeeting: "0x74489004";
817
- };
818
- };
819
-
820
- /**
821
- * The final keys for each interaction types (e.g. `openArticle`) -> interaction type
822
- * @inline
823
- */
824
- export declare type InteractionTypesKey = {
825
- [K in keyof typeof interactionTypes]: keyof (typeof interactionTypes)[K];
826
- }[keyof typeof interactionTypes];
827
-
828
- /**
829
- * Represent a key provider used for the hashed and secure compression
830
- * @ignore
831
- */
832
- export declare type KeyProvider<DataType> = (value: DataType) => string[];
833
-
834
- /**
835
- * All the languages available
836
- * @category Config
837
- */
838
- export declare type Language = "fr" | "en";
839
-
840
- /**
841
- * Type used for a listening request
842
- * @inline
843
- */
844
- declare type ListenerRequestFn<TRpcSchema extends RpcSchema> = <TParameters extends ExtractedParametersFromRpc<TRpcSchema> = ExtractedParametersFromRpc<TRpcSchema>, _ReturnType = ExtractedReturnTypeFromRpc<TRpcSchema, TParameters>>(args: TParameters, callback: (result: _ReturnType) => void) => Promise<void>;
845
-
846
- /**
847
- * Map the currency to the locale
848
- */
849
- export declare const locales: {
850
- readonly eur: "fr-FR";
851
- readonly usd: "en-US";
852
- readonly gbp: "en-GB";
853
- };
854
-
855
- /**
856
- * The keys for each locales
857
- * @inline
858
- */
859
- export declare type LocalesKey = keyof typeof locales;
860
-
861
- /**
862
- * A localized i18n config
863
- * @category Config
864
- */
865
- export declare type LocalizedI18nConfig = `${string}.css` | {
866
- [key: string]: string;
867
- };
868
-
869
- /**
870
- * Some configuration options for the embedded view
871
- *
872
- * @group Embedded wallet
873
- */
874
- export declare type LoggedInEmbeddedView = {
875
- /**
876
- * The main action to display on the logged in embedded view
877
- */
878
- action?: EmbeddedViewActionSharing | EmbeddedViewActionReferred;
879
- };
880
-
881
- /**
882
- * The view when a user is logged out
883
- * @group Embedded wallet
884
- */
885
- export declare type LoggedOutEmbeddedView = {
886
- /**
887
- * Metadata option when displaying the embedded view
888
- */
889
- metadata?: {
890
- /**
891
- * The main CTA for the logged out view
892
- * - can include some variable, available ones are:
893
- * - {REWARD} -> The maximum reward a user can receive when interacting on your website
894
- * - can be formatted in markdown
895
- *
896
- * If not set, it will default to a internationalized message
897
- * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
898
- */
899
- text?: string;
900
- /**
901
- * The text that will be displayed on the login button
902
- *
903
- * If not set, it will default to a internationalized message
904
- * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
905
- */
906
- buttonText?: string;
907
- };
908
- };
909
-
910
- /**
911
- * The login step for a Modal
912
- *
913
- * **Input**: Do we allow SSO or not? Is yes then the SSO metadata
914
- * **Output**: The logged in wallet address
915
- *
916
- * @group Modal Display
917
- */
918
- export declare type LoginModalStepType = GenericModalStepType<"login", LoginWithSso | LoginWithoutSso, {
919
- wallet: Address;
920
- }>;
921
-
922
- /** @inline */
923
- declare type LoginWithoutSso = {
924
- allowSso?: false;
925
- ssoMetadata?: never;
926
- };
927
-
928
- /** @inline */
929
- declare type LoginWithSso = {
930
- allowSso: true;
931
- ssoMetadata?: SsoMetadata;
932
- };
933
-
934
- /**
935
- * RPC metadata for the modal, used on top level modal configuration
936
- * @group Modal Display
937
- * @group RPC Schema
938
- */
939
- export declare type ModalRpcMetadata = {
940
- header?: {
941
- title?: string;
942
- icon?: string;
943
- };
944
- targetInteraction?: FullInteractionTypesKey;
945
- /**
946
- * Some i18n override for the displayed modal (i.e. update the displayed text only for this modal)
947
- */
948
- i18n?: I18nConfig;
949
- } & ({
950
- isDismissible: true;
951
- /**
952
- * @deprecated Use `config.customizations.i18n` or `metadata.i18n` instead
953
- */
954
- dismissActionTxt?: string;
955
- } | {
956
- isDismissible?: false;
957
- dismissActionTxt?: never;
958
- });
959
-
960
- /**
961
- * Type for the RPC input of a modal
962
- * Just the `params` type of each `ModalStepTypes`
963
- * @typeParam T - The list of modal steps we expect to have in the modal
964
- * @group Modal Display
965
- * @group RPC Schema
966
- */
967
- export declare type ModalRpcStepsInput<T extends ModalStepTypes[] = ModalStepTypes[]> = {
968
- [K in T[number]["key"]]?: Extract<T[number], {
969
- key: K;
970
- }>["params"];
971
- };
972
-
973
- /**
974
- * Type for the result of a modal request
975
- * Just the `returns` type of each `ModalStepTypes`
976
- * @typeParam T - The list of modal steps we expect to have in the modal
977
- * @group Modal Display
978
- * @group RPC Schema
979
- */
980
- export declare type ModalRpcStepsResultType<T extends ModalStepTypes[] = ModalStepTypes[]> = {
981
- [K in T[number]["key"]]: Extract<T[number], {
982
- key: K;
983
- }>["returns"];
984
- };
985
-
986
- /**
987
- * Metadata that can be used to customize a modal step
988
- * @group Modal Display
989
- * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
990
- */
991
- export declare type ModalStepMetadata = {
992
- metadata?: {
993
- /**
994
- * Custom title for the step
995
- * If none provided, it will use an internationalized text
996
- * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
997
- */
998
- title?: string;
999
- /**
1000
- * Custom description for the step
1001
- * If none provided, it will use an internationalized text
1002
- * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
1003
- */
1004
- description?: string;
1005
- /**
1006
- * Custom text for the primary action of the step
1007
- * If none provided, it will use an internationalized text
1008
- * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
1009
- */
1010
- primaryActionText?: string;
1011
- /**
1012
- * Custom text for the secondary action of the step
1013
- * If none provided, it will use an internationalized text
1014
- * @deprecated Use the top level `config.customizations.i18n`, or `metadata.i18n` instead
1015
- */
1016
- secondaryActionText?: string;
1017
- };
1018
- };
1019
-
1020
- /**
1021
- * Generic type of steps we will display in the modal to the end user
1022
- * @group Modal Display
1023
- */
1024
- export declare type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | OpenInteractionSessionModalStepType | FinalModalStepType;
1025
-
1026
- /**
1027
- * The open interaction session step for a Modal
1028
- *
1029
- * **Input**: None
1030
- * **Output**: The interactions session period (start and end timestamp)
1031
- *
1032
- * @group Modal Display
1033
- */
1034
- export declare type OpenInteractionSessionModalStepType = GenericModalStepType<"openSession", object, OpenInteractionSessionReturnType>;
1035
-
1036
- /**
1037
- * Return type of the open session modal step
1038
- * @inline
1039
- * @ignore
1040
- */
1041
- export declare type OpenInteractionSessionReturnType = {
1042
- startTimestamp: number;
1043
- endTimestamp: number;
1044
- };
1045
-
1046
- /**
1047
- * Params to start a SSO
1048
- * @group RPC Schema
1049
- */
1050
- export declare type OpenSsoParamsType = {
1051
- /**
1052
- * Redirect URL after the SSO (optional)
1053
- */
1054
- redirectUrl?: string;
1055
- /**
1056
- * If the SSO should directly exit after completion
1057
- * @defaultValue true
1058
- */
1059
- directExit?: boolean;
1060
- /**
1061
- * Language of the SSO page (optional)
1062
- * It will default to the current user language (or "en" if unsupported language)
1063
- */
1064
- lang?: "en" | "fr";
1065
- /**
1066
- * Custom SSO metadata
1067
- */
1068
- metadata: SsoMetadata;
1069
- };
1070
-
1071
- /**
1072
- * Parse the current URL into a Frak Context
1073
- * @param args
1074
- * @param args.url - The url to parse
1075
- * @returns The parsed Frak context
1076
- */
1077
- declare function parse({ url }: {
1078
- url: string;
1079
- }): FrakContext | null | undefined;
1080
-
1081
- /**
1082
- * Represent a prepared user interaction, ready to be sent on-chain via the wallet
1083
- */
1084
- export declare type PreparedInteraction = {
1085
- handlerTypeDenominator: Hex;
1086
- interactionData: Hex;
1087
- };
1088
-
1089
- /**
1090
- * List of the product types per denominator
1091
- */
1092
- export declare const productTypes: {
1093
- dapp: number;
1094
- press: number;
1095
- webshop: number;
1096
- retail: number;
1097
- referral: number;
1098
- purchase: number;
1099
- };
1100
-
1101
- /**
1102
- * The keys for each product types
1103
- * @inline
1104
- */
1105
- export declare type ProductTypesKey = keyof typeof productTypes;
1106
-
1107
- /**
1108
- * Bitmask for each product types
1109
- */
1110
- export declare const productTypesMask: Record<ProductTypesKey, bigint>;
1111
-
1112
- declare type RedirectRequestEvent = {
1113
- iframeLifecycle: "redirect";
1114
- data: {
1115
- /**
1116
- * The base url to redirect to (contain a query param `u`, the client need to suffix the current url to the base url)
1117
- */
1118
- baseRedirectUrl: string;
1119
- };
1120
- };
1121
-
1122
- /**
1123
- * Remove Frak context from current url
1124
- * @param url - The url to update
1125
- * @returns The new url without the Frak context
1126
- */
1127
- declare function remove(url: string): string;
1128
-
1129
- declare type RemoveBackupEvent = {
1130
- iframeLifecycle: "remove-backup";
1131
- };
1132
-
1133
- /**
1134
- * Replace the current url with the given Frak context
1135
- * @param args
1136
- * @param args.url - The url to update
1137
- * @param args.context - The context to update
1138
- */
1139
- declare function replaceUrl({ url: baseUrl, context, }: {
1140
- url?: string;
1141
- context: Partial<FrakContext> | null;
1142
- }): void;
1143
-
1144
- /**
1145
- * Type used for a one shot request function
1146
- * @inline
1147
- */
1148
- declare type RequestFn<TRpcSchema extends RpcSchema> = <TParameters extends ExtractedParametersFromRpc<TRpcSchema> = ExtractedParametersFromRpc<TRpcSchema>, _ReturnType = ExtractedReturnTypeFromRpc<TRpcSchema, TParameters>>(args: TParameters) => Promise<_ReturnType>;
1149
-
1150
- declare type RestoreBackupEvent = {
1151
- clientLifecycle: "restore-backup";
1152
- data: {
1153
- backup: string;
1154
- };
1155
- };
1156
-
1157
- /**
1158
- * The different Frak RPC error codes
1159
- */
1160
- export declare const RpcErrorCodes: {
1161
- readonly parseError: -32700;
1162
- readonly invalidRequest: -32600;
1163
- readonly methodNotFound: -32601;
1164
- readonly invalidParams: -32602;
1165
- readonly internalError: -32603;
1166
- readonly serverError: -32000;
1167
- readonly clientNotConnected: -32001;
1168
- readonly configError: -32002;
1169
- readonly corruptedResponse: -32003;
1170
- readonly clientAborted: -32004;
1171
- readonly walletNotConnected: -32005;
1172
- readonly serverErrorForInteractionDelegation: -32006;
1173
- };
1174
-
1175
- /**
1176
- * Raw response that we will receive after an rpc request
1177
- * @ignore
1178
- */
1179
- export declare type RpcResponse<TRpcSchema extends RpcSchema, TMethod extends TRpcSchema[number]["Method"] = TRpcSchema[number]["Method"]> = {
1180
- result: Extract<TRpcSchema[number], {
1181
- Method: TMethod;
1182
- }>["ReturnType"];
1183
- error?: never;
1184
- } | {
1185
- result?: never;
1186
- error: {
1187
- code: number;
1188
- message: string;
1189
- data?: unknown;
1190
- };
1191
- };
1192
-
1193
- /**
1194
- * Parameters that will be used to send an interaction to the blockchain
1195
- * @inline
1196
- */
1197
- export declare type SendInteractionParamsType = {
1198
- /**
1199
- * The product id where this interaction has been made
1200
- * @defaultValue keccak256(toHex(window.location.host))
1201
- */
1202
- productId?: Hex;
1203
- /**
1204
- * The prepared interaction, built from an Interaction Encoder
1205
- */
1206
- interaction: PreparedInteraction;
1207
- /**
1208
- * A pre-computed interaction signature
1209
- * If none provided, the delegated interaction validator of your product will sign it (you can manage it in the business dashboard)
1210
- *
1211
- * @defaultValue undefined
1212
- */
1213
- validation?: Hex;
1214
- };
1215
-
1216
- /**
1217
- * Return type of the send interaction rpc request
1218
- * @group RPC Schema
1219
- */
1220
- export declare type SendInteractionReturnType = {
1221
- /**
1222
- * The id of the interaction in the interaction pool
1223
- */
1224
- delegationId: string;
1225
- };
1226
-
1227
- /**
1228
- * The send transaction step for a Modal
1229
- *
1230
- * **Input**: Either a single tx or an array of tx to be sent
1231
- * **Output**: The hash of the tx(s) hash (in case of multiple tx, still returns a single hash because it's bundled on the wallet level)
1232
- *
1233
- * @group Modal Display
1234
- */
1235
- export declare type SendTransactionModalStepType = GenericModalStepType<"sendTransaction", {
1236
- tx: SendTransactionTxType | SendTransactionTxType[];
1237
- }, SendTransactionReturnType>;
1238
-
1239
- /**
1240
- * Return type of the send transaction rpc request
1241
- * @inline
1242
- */
1243
- export declare type SendTransactionReturnType = {
1244
- hash: Hex;
1245
- };
1246
-
1247
- /**
1248
- * Generic format representing a tx to be sent
1249
- */
1250
- export declare type SendTransactionTxType = {
1251
- to: Address;
1252
- data?: Hex;
1253
- value?: Hex;
1254
- };
1255
-
1256
- /**
1257
- * Directly setup the Frak client with an iframe
1258
- * Return when the FrakClient is ready (setup and communication estbalished with the wallet)
1259
- *
1260
- * @param config - The configuration to use for the Frak Wallet SDK
1261
- * @returns a Promise with the Frak Client
1262
- *
1263
- * @example
1264
- * const frakConfig: FrakWalletSdkConfig = {
1265
- * metadata: {
1266
- * name: "My app title",
1267
- * },
1268
- * }
1269
- * const client = await setupClient({ config: frakConfig });
1270
- */
1271
- export declare function setupClient({ config, }: {
1272
- config: FrakWalletSdkConfig;
1273
- }): Promise<FrakClient | undefined>;
1274
-
1275
- /**
1276
- * The SIWE authentication step for a Modal
1277
- *
1278
- * **Input**: SIWE message parameters
1279
- * **Output**: SIWE result (message signed and wallet signature)
1280
- *
1281
- * @group Modal Display
1282
- */
1283
- export declare type SiweAuthenticateModalStepType = GenericModalStepType<"siweAuthenticate", {
1284
- siwe: SiweAuthenticationParams;
1285
- }, SiweAuthenticateReturnType>;
1286
-
1287
- /**
1288
- * Return type of the Siwe transaction rpc request
1289
- * @inline
1290
- */
1291
- export declare type SiweAuthenticateReturnType = {
1292
- signature: Hex;
1293
- message: string;
1294
- };
1295
-
1296
- /**
1297
- * Parameters used send a SIWE rpc request
1298
- */
1299
- export declare type SiweAuthenticationParams = Omit<SiweMessage, "address" | "chainId" | "expirationTime" | "issuedAt" | "notBefore"> & {
1300
- expirationTimeTimestamp?: number;
1301
- notBeforeTimestamp?: number;
1302
- };
1303
-
1304
- /**
1305
- * SSO Metadata
1306
- */
1307
- export declare type SsoMetadata = {
1308
- /**
1309
- * URL to your client, if provided will be displayed in the SSO header
1310
- */
1311
- logoUrl?: string;
1312
- /**
1313
- * Link to your homepage, if referenced your app name will contain a link on the sso page
1314
- */
1315
- homepageLink?: string;
1316
- };
1317
-
1318
- /**
1319
- * The type for the amount of tokens
1320
- */
1321
- export declare type TokenAmountType = {
1322
- amount: number;
1323
- eurAmount: number;
1324
- usdAmount: number;
1325
- gbpAmount: number;
1326
- };
1327
-
1328
- export declare function trackEvent(client: FrakClient | undefined, event: FrakEvent, props?: EventProps): void;
1329
-
1330
- /**
1331
- * Populate the current url with the given Frak context
1332
- * @param args
1333
- * @param args.url - The url to update
1334
- * @param args.context - The context to update
1335
- * @returns The new url with the Frak context
1336
- */
1337
- declare function update({ url, context, }: {
1338
- url?: string;
1339
- context: Partial<FrakContext>;
1340
- }): string | null;
1341
-
1342
- /**
1343
- * @ignore
1344
- * @inline
1345
- */
1346
- declare type WalletConnected = {
1347
- key: "connected";
1348
- wallet: Address;
1349
- interactionToken?: string;
1350
- interactionSession?: {
1351
- startTimestamp: number;
1352
- endTimestamp: number;
1353
- };
1354
- };
1355
-
1356
- /**
1357
- * @ignore
1358
- * @inline
1359
- */
1360
- declare type WalletNotConnected = {
1361
- key: "not-connected";
1362
- wallet?: never;
1363
- interactionToken?: never;
1364
- interactionSession?: never;
1365
- };
1366
-
1367
- /**
1368
- * RPC Response for the method `frak_listenToWalletStatus`
1369
- * @group RPC Schema
1370
- */
1371
- export declare type WalletStatusReturnType = WalletConnected | WalletNotConnected;
1372
-
1373
- export { }