@frak-labs/core-sdk 0.0.4 → 0.0.6

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.
@@ -1,4 +1,4 @@
1
- import { a as FrakClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, f as ModalRpcStepsResultType, O as OpenSsoParamsType, G as GetProductInformationReturnType, i as SiweAuthenticationParams, d as ModalRpcMetadata, j as SiweAuthenticateReturnType, l as SendTransactionModalStepType, m as SendTransactionReturnType, q as FinalModalStepType, r as FinalActionType, L as LoginModalStepType, o as OpenInteractionSessionModalStepType, b as FrakContext } from '../context-DjVVznrf.js';
1
+ import { a as FrakClient, W as WalletStatusReturnType, M as ModalStepTypes, j as DisplayModalParamsType, l as ModalRpcStepsResultType, D as DisplayEmbededWalletParamsType, O as OpenSsoParamsType, G as GetProductInformationReturnType, q as SiweAuthenticationParams, h as ModalRpcMetadata, r as SiweAuthenticateReturnType, t as SendTransactionModalStepType, u as SendTransactionReturnType, n as LoginModalStepType, w as OpenInteractionSessionModalStepType, x as FinalModalStepType, y as FinalActionType, b as FrakContext } from '../context-rDsQbSgB.js';
2
2
  import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-CTQ5-kqe.js';
3
3
  import { Hex } from 'viem';
4
4
  import 'viem/chains';
@@ -105,11 +105,6 @@ declare function sendInteraction(client: FrakClient, { productId, interaction, v
105
105
  * ssoMetadata: {
106
106
  * logoUrl: "https://my-app.com/logo.png",
107
107
  * homepageLink: "https://my-app.com",
108
- * links: {
109
- * confidentialityLink: "https://my-app.com/confidentiality",
110
- * helpLink: "https://my-app.com/help",
111
- * cguLink: "https://my-app.com/cgu",
112
- * },
113
108
  * },
114
109
  * metadata: {
115
110
  * // Modal title on desktop
@@ -181,6 +176,13 @@ declare function sendInteraction(client: FrakClient, { productId, interaction, v
181
176
  */
182
177
  declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(client: FrakClient, { steps, metadata }: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
183
178
 
179
+ /**
180
+ * Function used to display the Frak embeded wallet popup
181
+ * @param client - The current Frak Client
182
+ * @param params - The parameter used to customise the embeded wallet
183
+ */
184
+ declare function displayEmbededWallet(client: FrakClient, params: DisplayEmbededWalletParamsType): Promise<void>;
185
+
184
186
  /**
185
187
  * Function used to open the SSO
186
188
  * @param client - The current Frak Client
@@ -195,11 +197,6 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
195
197
  * const metadata: SsoMetadata = {
196
198
  * logoUrl: "https://my-app.com/logo.png",
197
199
  * homepageLink: "https://my-app.com",
198
- * links: {
199
- * confidentialityLink: "https://my-app.com/confidentiality",
200
- * helpLink: "https://my-app.com/help",
201
- * cguLink: "https://my-app.com/cgu",
202
- * },
203
200
  * };
204
201
  * ```
205
202
  *
@@ -377,8 +374,9 @@ type ModalStepBuilder<Steps extends ModalStepTypes[] = ModalStepTypes[]> = {
377
374
  }>["options"], options?: Omit<FinalModalStepType["params"], "action">) => ModalStepBuilder<[...Steps, FinalModalStepType]>;
378
375
  /**
379
376
  * Display the modal
377
+ * @param metadataOverride - Function returning optional metadata to override the current modal metadata
380
378
  */
381
- display: () => Promise<ModalRpcStepsResultType<Steps>>;
379
+ display: (metadataOverride?: (current?: ModalRpcMetadata) => ModalRpcMetadata | undefined) => Promise<ModalRpcStepsResultType<Steps>>;
382
380
  };
383
381
  /**
384
382
  * Represent the output type of the modal builder
@@ -500,4 +498,4 @@ declare function referralInteraction(client: FrakClient, { productId, modalConfi
500
498
  options?: ProcessReferralOptions;
501
499
  }): Promise<("error" | "idle" | "processing" | "success" | "no-wallet" | "no-session" | "no-referrer" | "self-referral") | undefined>;
502
500
 
503
- export { type ModalBuilder, type ModalStepBuilder, type ProcessReferralOptions, type SendTransactionParams, type SiweAuthenticateModalParams, displayModal, getProductInformation, modalBuilder, openSso, processReferral, referralInteraction, sendInteraction, sendTransaction, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
501
+ export { type ModalBuilder, type ModalStepBuilder, type ProcessReferralOptions, type SendTransactionParams, type SiweAuthenticateModalParams, displayEmbededWallet, displayModal, getProductInformation, modalBuilder, openSso, processReferral, referralInteraction, sendInteraction, sendTransaction, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
@@ -1,13 +1,7 @@
1
- import {
2
- Deferred,
3
- FrakContextManager,
4
- FrakRpcError,
5
- RpcErrorCodes
6
- } from "../chunk-AFLVOY5H.js";
7
- import {
8
- ReferralInteractionEncoder
9
- } from "../chunk-RMOFMRZR.js";
10
- import "../chunk-GDH3M5ZC.js";
1
+ import { Deferred, FrakContextManager, FrakRpcError, RpcErrorCodes } from '../chunk-GTBCSNLF.js';
2
+ import { ReferralInteractionEncoder } from '../chunk-VE6URIIJ.js';
3
+ import { isAddressEqual, keccak256, toHex } from 'viem';
4
+ import { generateSiweNonce } from 'viem/siwe';
11
5
 
12
6
  // src/actions/watchWalletStatus.ts
13
7
  function watchWalletStatus(client, callback) {
@@ -46,9 +40,6 @@ function savePotentialToken(interactionToken) {
46
40
  window.sessionStorage.removeItem("frak.interaction-token");
47
41
  }
48
42
  }
49
-
50
- // src/utils/computeProductId.ts
51
- import { keccak256, toHex } from "viem";
52
43
  function computeProductId({ domain }) {
53
44
  const effectiveDomain = domain ?? window.location.host;
54
45
  return keccak256(toHex(effectiveDomain));
@@ -71,6 +62,14 @@ async function displayModal(client, { steps, metadata }) {
71
62
  });
72
63
  }
73
64
 
65
+ // src/actions/displayEmbededWallet.ts
66
+ async function displayEmbededWallet(client, params) {
67
+ await client.request({
68
+ method: "frak_displayEmbededWallet",
69
+ params: [params, client.config.metadata.name]
70
+ });
71
+ }
72
+
74
73
  // src/actions/openSso.ts
75
74
  async function openSso(client, args) {
76
75
  const { metadata } = client.config;
@@ -110,9 +109,6 @@ async function trackPurchaseStatus(args) {
110
109
  body: JSON.stringify(args)
111
110
  });
112
111
  }
113
-
114
- // src/actions/wrapper/siweAuthenticate.ts
115
- import { generateSiweNonce } from "viem/siwe";
116
112
  async function siweAuthenticate(client, { siwe, metadata }) {
117
113
  const effectiveDomain = client.config?.domain ?? window.location.host;
118
114
  const realStatement = siwe?.statement ?? `I confirm that I want to use my Frak wallet on: ${client.config.metadata.name}`;
@@ -203,7 +199,10 @@ function modalStepsBuilder(client, params) {
203
199
  }
204
200
  );
205
201
  }
206
- async function display() {
202
+ async function display(metadataOverride) {
203
+ if (metadataOverride) {
204
+ params.metadata = metadataOverride(params.metadata ?? {});
205
+ }
207
206
  return await displayModal(client, params);
208
207
  }
209
208
  return {
@@ -217,9 +216,6 @@ function modalStepsBuilder(client, params) {
217
216
  display
218
217
  };
219
218
  }
220
-
221
- // src/actions/referral/processReferral.ts
222
- import { isAddressEqual } from "viem";
223
219
  async function processReferral(client, {
224
220
  walletStatus,
225
221
  frakContext,
@@ -293,12 +289,12 @@ async function ensureWalletConnected(client, {
293
289
  }) {
294
290
  if (!walletStatus?.interactionSession) {
295
291
  if (!modalConfig) {
296
- return void 0;
292
+ return undefined;
297
293
  }
298
294
  const result = await displayModal(client, modalConfig);
299
- return result?.login?.wallet ?? void 0;
295
+ return result?.login?.wallet ?? undefined;
300
296
  }
301
- return walletStatus.wallet ?? void 0;
297
+ return walletStatus.wallet ?? undefined;
302
298
  }
303
299
  function mapErrorToState(error) {
304
300
  if (error instanceof FrakRpcError) {
@@ -337,16 +333,5 @@ async function referralInteraction(client, {
337
333
  }
338
334
  return;
339
335
  }
340
- export {
341
- displayModal,
342
- getProductInformation,
343
- modalBuilder,
344
- openSso,
345
- processReferral,
346
- referralInteraction,
347
- sendInteraction,
348
- sendTransaction,
349
- siweAuthenticate,
350
- trackPurchaseStatus,
351
- watchWalletStatus
352
- };
336
+
337
+ export { displayEmbededWallet, displayModal, getProductInformation, modalBuilder, openSso, processReferral, referralInteraction, sendInteraction, sendTransaction, siweAuthenticate, trackPurchaseStatus, watchWalletStatus };
@@ -1,10 +1,11 @@
1
+ 'use strict';
2
+
1
3
  var __create = Object.create;
2
4
  var __defProp = Object.defineProperty;
3
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
7
  var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
9
  var __commonJS = (cb, mod) => function __require() {
9
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
11
  };
@@ -24,7 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
26
  mod
26
27
  ));
27
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
28
28
 
29
29
  // src/constants/productTypes.ts
30
30
  var productTypes = {
@@ -74,11 +74,8 @@ var interactionTypes = {
74
74
  }
75
75
  };
76
76
 
77
- export {
78
- __commonJS,
79
- __toESM,
80
- __publicField,
81
- productTypes,
82
- productTypesMask,
83
- interactionTypes
84
- };
77
+ exports.__commonJS = __commonJS;
78
+ exports.__toESM = __toESM;
79
+ exports.interactionTypes = interactionTypes;
80
+ exports.productTypes = productTypes;
81
+ exports.productTypesMask = productTypesMask;
@@ -1,13 +1,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ 'use strict';
2
2
 
3
-
4
-
5
- var _chunkPO6YSB4Qcjs = require('./chunk-PO6YSB4Q.cjs');
3
+ var chunk665P7NO4_cjs = require('./chunk-665P7NO4.cjs');
4
+ var jsSha256 = require('js-sha256');
5
+ var viem = require('viem');
6
6
 
7
7
  // ../../node_modules/async-lz-string/libs/async-lz-string.js
8
- var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
8
+ var require_async_lz_string = chunk665P7NO4_cjs.__commonJS({
9
9
  "../../node_modules/async-lz-string/libs/async-lz-string.js"(exports, module) {
10
- "use strict";
11
10
  !function(t, e) {
12
11
  if ("object" == typeof exports && "object" == typeof module) module.exports = e();
13
12
  else if ("function" == typeof define && define.amd) define([], e);
@@ -16,7 +15,6 @@ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
16
15
  for (var r in n) ("object" == typeof exports ? exports : t)[r] = n[r];
17
16
  }
18
17
  }(exports, () => (() => {
19
- "use strict";
20
18
  var t = { 48: function(t2, e2, n) {
21
19
  var r = this && this.__awaiter || function(t3, e3, n2, r2) {
22
20
  return new (n2 || (n2 = Promise))(function(a2, o2) {
@@ -96,15 +94,15 @@ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
96
94
  n2 = a2 = 0;
97
95
  }
98
96
  if (5 & s4[0]) throw s4[1];
99
- return { value: s4[0] ? s4[1] : void 0, done: true };
97
+ return { value: s4[0] ? s4[1] : undefined, done: true };
100
98
  }([s3, u2]);
101
99
  };
102
100
  }
103
101
  };
104
- Object.defineProperty(e2, "__esModule", { value: true }), e2.decompressFromUTF16 = e2.compressToUTF16 = e2.decompressFromBase64 = e2.compressToBase64 = void 0;
102
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.decompressFromUTF16 = e2.compressToUTF16 = e2.decompressFromBase64 = e2.compressToBase64 = undefined;
105
103
  var o = n(304), i = n(134), s = new o.CompressorImpl(), u = new i.DecompressorImpl(), c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", l = {};
106
104
  e2.compressToBase64 = function(t3) {
107
- return r(this, void 0, void 0, function() {
105
+ return r(this, undefined, undefined, function() {
108
106
  var e3;
109
107
  return a(this, function(n2) {
110
108
  switch (n2.label) {
@@ -129,7 +127,7 @@ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
129
127
  });
130
128
  });
131
129
  }, e2.decompressFromBase64 = function(t3) {
132
- return r(this, void 0, void 0, function() {
130
+ return r(this, undefined, undefined, function() {
133
131
  return a(this, function(e3) {
134
132
  switch (e3.label) {
135
133
  case 0:
@@ -148,7 +146,7 @@ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
148
146
  });
149
147
  });
150
148
  }, e2.compressToUTF16 = function(t3) {
151
- return r(this, void 0, void 0, function() {
149
+ return r(this, undefined, undefined, function() {
152
150
  return a(this, function(e3) {
153
151
  switch (e3.label) {
154
152
  case 0:
@@ -161,7 +159,7 @@ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
161
159
  });
162
160
  });
163
161
  }, e2.decompressFromUTF16 = function(t3) {
164
- return r(this, void 0, void 0, function() {
162
+ return r(this, undefined, undefined, function() {
165
163
  return a(this, function(e3) {
166
164
  switch (e3.label) {
167
165
  case 0:
@@ -253,12 +251,12 @@ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
253
251
  n2 = a2 = 0;
254
252
  }
255
253
  if (5 & s4[0]) throw s4[1];
256
- return { value: s4[0] ? s4[1] : void 0, done: true };
254
+ return { value: s4[0] ? s4[1] : undefined, done: true };
257
255
  }([s3, u]);
258
256
  };
259
257
  }
260
258
  };
261
- Object.defineProperty(e2, "__esModule", { value: true }), e2.CompressorImpl = void 0;
259
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.CompressorImpl = undefined;
262
260
  var o = n(658), i = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], s = function() {
263
261
  function t3() {
264
262
  }
@@ -278,7 +276,7 @@ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
278
276
  }, t3.prototype.compress = function(e3, n2, i2) {
279
277
  var s2 = this;
280
278
  return new Promise(function(u) {
281
- return r(s2, void 0, void 0, function() {
279
+ return r(s2, undefined, undefined, function() {
282
280
  var r2, s3;
283
281
  return a(this, function(a2) {
284
282
  switch (a2.label) {
@@ -379,19 +377,19 @@ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
379
377
  n2 = a2 = 0;
380
378
  }
381
379
  if (5 & s3[0]) throw s3[1];
382
- return { value: s3[0] ? s3[1] : void 0, done: true };
380
+ return { value: s3[0] ? s3[1] : undefined, done: true };
383
381
  }([s2, u]);
384
382
  };
385
383
  }
386
384
  };
387
- Object.defineProperty(e2, "__esModule", { value: true }), e2.DecompressorImpl = void 0;
385
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.DecompressorImpl = undefined;
388
386
  var o = n(658), i = function() {
389
387
  function t3() {
390
388
  }
391
389
  return t3.prototype.decompress = function(t4, e3, n2) {
392
390
  var i2 = this;
393
391
  return new Promise(function(s) {
394
- return r(i2, void 0, void 0, function() {
392
+ return r(i2, undefined, undefined, function() {
395
393
  var r2, i3, u;
396
394
  return a(this, function(a2) {
397
395
  switch (a2.label) {
@@ -524,13 +522,13 @@ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
524
522
  n2 = a = 0;
525
523
  }
526
524
  if (5 & s3[0]) throw s3[1];
527
- return { value: s3[0] ? s3[1] : void 0, done: true };
525
+ return { value: s3[0] ? s3[1] : undefined, done: true };
528
526
  }([s2, u]);
529
527
  };
530
528
  }
531
529
  };
532
- Object.defineProperty(e2, "__esModule", { value: true }), e2.wait = void 0, e2.wait = function() {
533
- return n(this, void 0, void 0, function() {
530
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.wait = undefined, e2.wait = function() {
531
+ return n(this, undefined, undefined, function() {
534
532
  return r(this, function(t3) {
535
533
  return [2, new Promise(function(t4) {
536
534
  setTimeout(t4, 0);
@@ -541,7 +539,7 @@ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
541
539
  } }, e = {};
542
540
  return function n(r) {
543
541
  var a = e[r];
544
- if (void 0 !== a) return a.exports;
542
+ if (undefined !== a) return a.exports;
545
543
  var o = e[r] = { exports: {} };
546
544
  return t[r].call(o.exports, o, o.exports, n), o.exports;
547
545
  }(48);
@@ -586,16 +584,10 @@ var RpcErrorCodes = {
586
584
 
587
585
  // src/utils/Deferred.ts
588
586
  var Deferred = class {
587
+ _promise;
588
+ _resolve;
589
+ _reject;
589
590
  constructor() {
590
- _chunkPO6YSB4Qcjs.__publicField.call(void 0, this, "_promise");
591
- _chunkPO6YSB4Qcjs.__publicField.call(void 0, this, "_resolve");
592
- _chunkPO6YSB4Qcjs.__publicField.call(void 0, this, "_reject");
593
- _chunkPO6YSB4Qcjs.__publicField.call(void 0, this, "resolve", (value) => {
594
- _optionalChain([this, 'access', _2 => _2._resolve, 'optionalCall', _3 => _3(value)]);
595
- });
596
- _chunkPO6YSB4Qcjs.__publicField.call(void 0, this, "reject", (reason) => {
597
- _optionalChain([this, 'access', _4 => _4._reject, 'optionalCall', _5 => _5(reason)]);
598
- });
599
591
  this._promise = new Promise((resolve, reject) => {
600
592
  this._resolve = resolve;
601
593
  this._reject = reject;
@@ -604,19 +596,24 @@ var Deferred = class {
604
596
  get promise() {
605
597
  return this._promise;
606
598
  }
599
+ resolve = (value) => {
600
+ this._resolve?.(value);
601
+ };
602
+ reject = (reason) => {
603
+ this._reject?.(reason);
604
+ };
607
605
  };
608
606
 
609
607
  // src/utils/compression/compress.ts
610
- var import_async_lz_string = _chunkPO6YSB4Qcjs.__toESM.call(void 0, require_async_lz_string(), 1);
611
- var _jssha256 = require('js-sha256');
608
+ var import_async_lz_string = chunk665P7NO4_cjs.__toESM(require_async_lz_string(), 1);
612
609
  async function hashAndCompressData(data) {
613
- const validationHash = _jssha256.sha256.call(void 0, JSON.stringify(data));
610
+ const validationHash = jsSha256.sha256(JSON.stringify(data));
614
611
  const hashProtectedData = {
615
612
  ...data,
616
613
  validationHash
617
614
  };
618
615
  const compressed = await compressJson(hashProtectedData);
619
- const compressedHash = _jssha256.sha256.call(void 0, compressed);
616
+ const compressedHash = jsSha256.sha256(compressed);
620
617
  return {
621
618
  compressed,
622
619
  compressedHash
@@ -627,10 +624,9 @@ async function compressJson(data) {
627
624
  }
628
625
 
629
626
  // src/utils/compression/decompress.ts
630
- var import_async_lz_string2 = _chunkPO6YSB4Qcjs.__toESM.call(void 0, require_async_lz_string(), 1);
631
-
627
+ var import_async_lz_string2 = chunk665P7NO4_cjs.__toESM(require_async_lz_string(), 1);
632
628
  async function decompressDataAndCheckHash(compressedData) {
633
- if (!(_optionalChain([compressedData, 'optionalAccess', _6 => _6.compressed]) && _optionalChain([compressedData, 'optionalAccess', _7 => _7.compressedHash]))) {
629
+ if (!(compressedData?.compressed && compressedData?.compressedHash)) {
634
630
  throw new FrakRpcError(
635
631
  RpcErrorCodes.corruptedResponse,
636
632
  "Missing compressed data"
@@ -645,13 +641,13 @@ async function decompressDataAndCheckHash(compressedData) {
645
641
  "Invalid compressed data"
646
642
  );
647
643
  }
648
- if (!_optionalChain([parsedData, 'optionalAccess', _8 => _8.validationHash])) {
644
+ if (!parsedData?.validationHash) {
649
645
  throw new FrakRpcError(
650
646
  RpcErrorCodes.corruptedResponse,
651
647
  "Missing validation hash"
652
648
  );
653
649
  }
654
- const expectedCompressedHash = _jssha256.sha256.call(void 0, compressedData.compressed);
650
+ const expectedCompressedHash = jsSha256.sha256(compressedData.compressed);
655
651
  if (expectedCompressedHash !== compressedData.compressedHash) {
656
652
  throw new FrakRpcError(
657
653
  RpcErrorCodes.corruptedResponse,
@@ -659,7 +655,7 @@ async function decompressDataAndCheckHash(compressedData) {
659
655
  );
660
656
  }
661
657
  const { validationHash: _, ...rawResultData } = parsedData;
662
- const expectedValidationHash = _jssha256.sha256.call(void 0, JSON.stringify(rawResultData));
658
+ const expectedValidationHash = jsSha256.sha256(JSON.stringify(rawResultData));
663
659
  if (expectedValidationHash !== parsedData.validationHash) {
664
660
  throw new FrakRpcError(
665
661
  RpcErrorCodes.corruptedResponse,
@@ -688,7 +684,7 @@ var baseIframeProps = {
688
684
  height: "0",
689
685
  border: "0",
690
686
  position: "absolute",
691
- zIndex: 1e3,
687
+ zIndex: 2000001,
692
688
  top: "-1000px",
693
689
  left: "-1000px"
694
690
  }
@@ -709,8 +705,8 @@ function createIframe({
709
705
  changeIframeVisibility({ iframe, isVisible: false });
710
706
  document.body.appendChild(iframe);
711
707
  return new Promise((resolve) => {
712
- _optionalChain([iframe, 'optionalAccess', _9 => _9.addEventListener, 'call', _10 => _10("load", () => resolve(iframe))]);
713
- iframe.src = `${_nullishCoalesce(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _11 => _11.walletUrl]), () => ( walletBaseUrl)), () => ( "https://wallet.frak.id"))}/listener`;
708
+ iframe?.addEventListener("load", () => resolve(iframe));
709
+ iframe.src = `${config?.walletUrl ?? walletBaseUrl ?? "https://wallet.frak.id"}/listener`;
714
710
  });
715
711
  }
716
712
  function changeIframeVisibility({
@@ -733,9 +729,6 @@ function changeIframeVisibility({
733
729
  iframe.style.height = "100%";
734
730
  iframe.style.pointerEvents = "auto";
735
731
  }
736
-
737
- // src/utils/FrakContext.ts
738
- var _viem = require('viem');
739
732
  var contextKey = "fCtx";
740
733
  function base64url_encode(buffer) {
741
734
  return btoa(Array.from(buffer, (b) => String.fromCharCode(b)).join("")).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
@@ -750,24 +743,24 @@ function base64url_decode(value) {
750
743
  );
751
744
  }
752
745
  function compress(context) {
753
- if (!_optionalChain([context, 'optionalAccess', _12 => _12.r])) return;
746
+ if (!context?.r) return;
754
747
  try {
755
- const bytes = _viem.hexToBytes.call(void 0, context.r);
748
+ const bytes = viem.hexToBytes(context.r);
756
749
  return base64url_encode(bytes);
757
750
  } catch (e) {
758
751
  console.error("Error compressing Frak context", { e, context });
759
752
  }
760
- return void 0;
753
+ return undefined;
761
754
  }
762
755
  function decompress(context) {
763
756
  if (!context || context.length === 0) return;
764
757
  try {
765
758
  const bytes = base64url_decode(context);
766
- return { r: _viem.bytesToHex.call(void 0, bytes, { size: 20 }) };
759
+ return { r: viem.bytesToHex(bytes, { size: 20 }) };
767
760
  } catch (e) {
768
761
  console.error("Error decompressing Frak context", { e, context });
769
762
  }
770
- return void 0;
763
+ return undefined;
771
764
  }
772
765
  function parse({ url }) {
773
766
  if (!url) return null;
@@ -799,11 +792,11 @@ function replaceUrl({
799
792
  url: baseUrl,
800
793
  context
801
794
  }) {
802
- if (!_optionalChain([window, 'access', _13 => _13.location, 'optionalAccess', _14 => _14.href]) || typeof window === "undefined") {
795
+ if (!window.location?.href || typeof window === "undefined") {
803
796
  console.error("No window found, can't update context");
804
797
  return;
805
798
  }
806
- const url = _nullishCoalesce(baseUrl, () => ( window.location.href));
799
+ const url = baseUrl ?? window.location.href;
807
800
  let newUrl;
808
801
  if (context !== null) {
809
802
  newUrl = update({
@@ -825,18 +818,16 @@ var FrakContextManager = {
825
818
  replaceUrl
826
819
  };
827
820
 
828
-
829
-
830
-
831
-
832
-
833
-
834
-
835
-
836
-
837
-
838
-
839
-
840
-
841
-
842
- exports.FrakRpcError = FrakRpcError; exports.InternalError = InternalError; exports.ClientNotFound = ClientNotFound; exports.RpcErrorCodes = RpcErrorCodes; exports.Deferred = Deferred; exports.hashAndCompressData = hashAndCompressData; exports.compressJson = compressJson; exports.decompressDataAndCheckHash = decompressDataAndCheckHash; exports.decompressJson = decompressJson; exports.baseIframeProps = baseIframeProps; exports.createIframe = createIframe; exports.changeIframeVisibility = changeIframeVisibility; exports.FrakContextManager = FrakContextManager;
821
+ exports.ClientNotFound = ClientNotFound;
822
+ exports.Deferred = Deferred;
823
+ exports.FrakContextManager = FrakContextManager;
824
+ exports.FrakRpcError = FrakRpcError;
825
+ exports.InternalError = InternalError;
826
+ exports.RpcErrorCodes = RpcErrorCodes;
827
+ exports.baseIframeProps = baseIframeProps;
828
+ exports.changeIframeVisibility = changeIframeVisibility;
829
+ exports.compressJson = compressJson;
830
+ exports.createIframe = createIframe;
831
+ exports.decompressDataAndCheckHash = decompressDataAndCheckHash;
832
+ exports.decompressJson = decompressJson;
833
+ exports.hashAndCompressData = hashAndCompressData;