@talken/talkenkit 2.5.2 → 2.5.4

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 (71) hide show
  1. package/dist/{AbcCredentialManager-5W3B7GI4.js → AbcCredentialManager-JV4ZBMKF.js} +1 -1
  2. package/dist/TalkenApiSingleton-TECFDCT4.js +9 -0
  3. package/dist/{abcWallet-HRNBHY5Q.js → abcWallet-QJ5BKEXW.js} +3 -2
  4. package/dist/{chunk-PN6K4CMZ.js → chunk-DNEDHHS4.js} +23 -1
  5. package/dist/chunk-R6ZE7JAZ.js +15 -0
  6. package/dist/{chunk-VCQZZ6SN.js → chunk-YORGXWYS.js} +218 -80
  7. package/dist/components/ConnectOptions/AbcWaasAuth/AbcWaasAuthFlow.d.ts +6 -32
  8. package/dist/components/ConnectOptions/AbcWaasAuth/AbcWaasAuthSections.d.ts +0 -9
  9. package/dist/components/ConnectOptions/AbcWaasAuth/hooks/useAbcWaasAuth.d.ts +3 -12
  10. package/dist/components/ConnectOptions/AbcWaasAuth/types.d.ts +1 -8
  11. package/dist/components/ConnectOptions/PinAuth/PinAuthFlow.d.ts +6 -4
  12. package/dist/components/ProfileDetails/ProfileDetails.d.ts +5 -5
  13. package/dist/hooks/useMultiChainBalances.d.ts +9 -0
  14. package/dist/index.js +1420 -1466
  15. package/dist/klipWallet-TBZJ5GGT.js +7 -0
  16. package/dist/wallets/walletConnectors/abcWallet/AbcCredentialManager.js +2 -2
  17. package/dist/wallets/walletConnectors/abcWallet/AbcEvmAutoConnector.js +2 -2
  18. package/dist/wallets/walletConnectors/abcWallet/abcAccessKeyProvider.d.ts +4 -0
  19. package/dist/wallets/walletConnectors/abcWallet/abcAccessKeyProvider.js +3 -3
  20. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinConnector.js +3 -3
  21. package/dist/wallets/walletConnectors/abcWallet/abcBitcoinProvider.js +3 -3
  22. package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +7 -7
  23. package/dist/wallets/walletConnectors/abcWallet/abcProvider.js +4 -4
  24. package/dist/wallets/walletConnectors/abcWallet/abcSolanaProvider.js +7 -7
  25. package/dist/wallets/walletConnectors/abcWallet/abcSolanaWalletAdapter.js +44 -45
  26. package/dist/wallets/walletConnectors/abcWallet/abcTronProvider.js +3 -3
  27. package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +8 -8
  28. package/dist/wallets/walletConnectors/abcWallet/api/ConfigApi.js +2 -2
  29. package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.d.ts +44 -0
  30. package/dist/wallets/walletConnectors/abcWallet/api/TalkenApiClient.js +3 -3
  31. package/dist/wallets/walletConnectors/abcWallet/api/TokenApi.js +2 -2
  32. package/dist/wallets/walletConnectors/abcWallet/api/WalletscanApi.js +3 -3
  33. package/dist/wallets/walletConnectors/abcWallet/api/index.js +6 -6
  34. package/dist/wallets/walletConnectors/abcWallet/constants.d.ts +3 -0
  35. package/dist/wallets/walletConnectors/abcWallet/constants.js +5 -3
  36. package/dist/wallets/walletConnectors/abcWallet/index.js +31 -31
  37. package/dist/wallets/walletConnectors/abcWallet/sessionUtils.js +2 -2
  38. package/dist/wallets/walletConnectors/abcWallet/types.d.ts +4 -0
  39. package/dist/wallets/walletConnectors/abcWallet/utils.js +2 -2
  40. package/dist/wallets/walletConnectors/abcWallet/walletGeneration.js +3 -3
  41. package/dist/wallets/walletConnectors/{chunk-QKK3OPQA.js → chunk-36BJXEBA.js} +1 -1
  42. package/dist/wallets/walletConnectors/{chunk-FKI5AZVH.js → chunk-3K3KYVRN.js} +1 -1
  43. package/dist/wallets/walletConnectors/{chunk-URS2KVYK.js → chunk-5DK36WJ2.js} +1 -1
  44. package/dist/wallets/walletConnectors/{chunk-ASYCOXE6.js → chunk-5ERWBR7D.js} +132 -28
  45. package/dist/wallets/walletConnectors/{chunk-RX2VOIUB.js → chunk-6KRX73ED.js} +25 -3
  46. package/dist/wallets/walletConnectors/{chunk-H2AZTZMM.js → chunk-6L5G54IX.js} +1 -1
  47. package/dist/wallets/walletConnectors/{chunk-RGYZNNB6.js → chunk-C4ADBB6M.js} +1 -1
  48. package/dist/wallets/walletConnectors/{chunk-4JZPP3S7.js → chunk-E6ZG77AF.js} +27 -1
  49. package/dist/wallets/walletConnectors/{chunk-PF65YS3T.js → chunk-EBTKWCIS.js} +3 -2
  50. package/dist/wallets/walletConnectors/{chunk-25ZDAJ3L.js → chunk-EZS3GXZN.js} +1 -1
  51. package/dist/wallets/walletConnectors/{chunk-WKP53WWR.js → chunk-G6SV7RAS.js} +8 -7
  52. package/dist/wallets/walletConnectors/chunk-HKMJ67FD.js +37 -0
  53. package/dist/wallets/walletConnectors/{chunk-L6FCF3FH.js → chunk-L3HWFGTN.js} +2 -2
  54. package/dist/wallets/walletConnectors/{chunk-LIGH2LEU.js → chunk-PVPSVCVQ.js} +1 -1
  55. package/dist/wallets/walletConnectors/{chunk-2A5XTST5.js → chunk-SDRE2D5I.js} +29 -11
  56. package/dist/wallets/walletConnectors/{chunk-HWRZGGGN.js → chunk-VBNZ7HA3.js} +1 -1
  57. package/dist/wallets/walletConnectors/{chunk-YKFI6ZGM.js → chunk-VLHDGDFH.js} +1 -1
  58. package/dist/wallets/walletConnectors/{chunk-645DT4TS.js → chunk-ZLH3W5PQ.js} +2 -2
  59. package/dist/wallets/walletConnectors/index.d.ts +2 -1
  60. package/dist/wallets/walletConnectors/index.js +57 -53
  61. package/dist/wallets/walletConnectors/klipWallet/klipWallet.js +3 -63
  62. package/dist/wallets/walletConnectors/klipWallet-TBZJ5GGT.js +7 -0
  63. package/package.json +1 -1
  64. package/dist/wallets/walletConnectors/chunk-4PDTJS5L.js +0 -57
  65. package/dist/wallets/walletConnectors/chunk-BRXYKYKT.js +0 -360
  66. package/dist/wallets/walletConnectors/chunk-IPH3SIC3.js +0 -57
  67. package/dist/wallets/walletConnectors/chunk-JBOKTW2Q.js +0 -360
  68. package/dist/wallets/walletConnectors/chunk-MIX4TRKO.js +0 -194
  69. package/dist/wallets/walletConnectors/chunk-NP5PWUVU.js +0 -873
  70. package/dist/wallets/walletConnectors/chunk-TVZHPWFR.js +0 -843
  71. package/dist/wallets/walletConnectors/klipWallet-PPTYYB5G.js +0 -7
@@ -16,9 +16,9 @@ import {
16
16
  saveToStorage,
17
17
  validateEmail,
18
18
  validatePin
19
- } from "../chunk-PF65YS3T.js";
19
+ } from "../chunk-EBTKWCIS.js";
20
20
  import "../chunk-4P3SPC44.js";
21
- import "../chunk-RX2VOIUB.js";
21
+ import "../chunk-6KRX73ED.js";
22
22
  export {
23
23
  calculateExpiryTimestamp,
24
24
  clearAuthState,
@@ -3,11 +3,11 @@ import {
3
3
  generateMpcWallets,
4
4
  recoverMpcWallets,
5
5
  validateMpcWallets
6
- } from "../chunk-H2AZTZMM.js";
6
+ } from "../chunk-6L5G54IX.js";
7
7
  import "../chunk-O4AU63LK.js";
8
8
  import "../chunk-4P3SPC44.js";
9
- import "../chunk-QKK3OPQA.js";
10
- import "../chunk-RX2VOIUB.js";
9
+ import "../chunk-36BJXEBA.js";
10
+ import "../chunk-6KRX73ED.js";
11
11
  export {
12
12
  generateMpcWallets,
13
13
  recoverMpcWallets,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  STORAGE_PREFIX
4
- } from "./chunk-RX2VOIUB.js";
4
+ } from "./chunk-6KRX73ED.js";
5
5
 
6
6
  // src/wallets/walletConnectors/abcWallet/AbcCredentialManager.ts
7
7
  var EMAIL_STORAGE_KEY = `${STORAGE_PREFIX}saved_email`;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  TALKEN_API_ENDPOINTS
4
- } from "./chunk-RX2VOIUB.js";
4
+ } from "./chunk-6KRX73ED.js";
5
5
 
6
6
  // src/wallets/walletConnectors/abcWallet/api/TokenApi.ts
7
7
  import { getTalkenApiClient } from "@talken/talkenkit";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  getCredentialManager
4
- } from "./chunk-QKK3OPQA.js";
4
+ } from "./chunk-36BJXEBA.js";
5
5
 
6
6
  // src/wallets/walletConnectors/abcWallet/abcTronProvider.ts
7
7
  import {
@@ -1,15 +1,16 @@
1
1
  "use client";
2
- import {
3
- getCredentialManager
4
- } from "./chunk-QKK3OPQA.js";
5
2
  import {
6
3
  TalkenApiError
7
4
  } from "./chunk-4P3SPC44.js";
5
+ import {
6
+ getCredentialManager
7
+ } from "./chunk-36BJXEBA.js";
8
8
  import {
9
9
  DEFAULT_TALKEN_API_CONFIG,
10
10
  TALKEN_API_ENDPOINTS,
11
- TOKEN_EXPIRY
12
- } from "./chunk-RX2VOIUB.js";
11
+ TOKEN_EXPIRY,
12
+ loadTgAccessKey
13
+ } from "./chunk-6KRX73ED.js";
13
14
 
14
15
  // src/wallets/walletConnectors/abcWallet/api/TalkenApiClient.ts
15
16
  var STORAGE_KEY_PREFIX = "talken_api_";
@@ -188,6 +189,34 @@ var TalkenAuthModule = class {
188
189
  this.client.handleAuthResponse(res);
189
190
  return res;
190
191
  }
192
+ /**
193
+ * Server-side unified onboarding: email + OTP → access key + wallets.
194
+ * POST /wallet/auth { action: 'ensure-user', email, otpCode, accessKeyName }
195
+ */
196
+ async ensureUser(email, otpCode, accessKeyName = "talkenkit") {
197
+ const raw = await this.client.post(
198
+ TALKEN_API_ENDPOINTS.AUTH,
199
+ { action: "ensure-user", email, otpCode, accessKeyName },
200
+ { skipAuth: true }
201
+ );
202
+ return raw.data || raw;
203
+ }
204
+ /**
205
+ * Create an Access Key for delegated authentication
206
+ * POST /agent/access-keys { name, pin, refreshToken, email, ttlSeconds }
207
+ */
208
+ async createAccessKey(params) {
209
+ const raw = await this.client.post(
210
+ TALKEN_API_ENDPOINTS.ACCESS_KEYS,
211
+ params
212
+ );
213
+ const d = raw.data || raw;
214
+ return {
215
+ accessKey: d.accessKey,
216
+ keyId: d.keyId,
217
+ expiresAt: d.expiresAt
218
+ };
219
+ }
191
220
  /**
192
221
  * Logout (clear local session only — no server endpoint)
193
222
  */
@@ -631,11 +660,12 @@ var TalkenWalletscanModule = class {
631
660
  );
632
661
  }
633
662
  };
634
- var TalkenApiClient = class {
663
+ var TalkenApiClient = class _TalkenApiClient {
635
664
  constructor(config) {
636
665
  this.accessToken = null;
637
666
  this.refreshToken_ = null;
638
667
  this.expiresAt = null;
668
+ this.accessKeyRaw = null;
639
669
  this.isRefreshing = false;
640
670
  this.refreshPromise = null;
641
671
  this.config = {
@@ -656,6 +686,10 @@ var TalkenApiClient = class {
656
686
  }
657
687
  // ── Session Management ──────────────────────────────────────────────
658
688
  restoreSession() {
689
+ this.accessKeyRaw = loadToken("access_key_raw");
690
+ if (this.accessKeyRaw) {
691
+ return;
692
+ }
659
693
  this.accessToken = loadToken("access_token");
660
694
  this.refreshToken_ = loadToken("refresh_token");
661
695
  const expiresAtStr = loadToken("expires_at");
@@ -675,14 +709,74 @@ var TalkenApiClient = class {
675
709
  this.accessToken = null;
676
710
  this.refreshToken_ = null;
677
711
  this.expiresAt = null;
712
+ this.accessKeyRaw = null;
678
713
  removeToken("access_token");
679
714
  removeToken("refresh_token");
680
715
  removeToken("expires_at");
716
+ removeToken("access_key_raw");
717
+ }
718
+ static {
719
+ /** All known access key prefixes (any environment). */
720
+ this.KNOWN_AK_PREFIXES = [
721
+ "talken_live_",
722
+ "talken_stg_",
723
+ "talken_dev_",
724
+ "talken_local_"
725
+ ];
726
+ }
727
+ /** Validate access key format: talken_<env>_<publicId>.<secret> */
728
+ static isValidAccessKeyFormat(key) {
729
+ const trimmed = key.trim();
730
+ for (const prefix of _TalkenApiClient.KNOWN_AK_PREFIXES) {
731
+ if (trimmed.startsWith(prefix)) {
732
+ const payload = trimmed.slice(prefix.length);
733
+ const dot = payload.indexOf(".");
734
+ if (dot < 1)
735
+ return false;
736
+ return payload.slice(0, dot).length > 0 && payload.slice(dot + 1).length > 0;
737
+ }
738
+ }
739
+ return false;
740
+ }
741
+ /**
742
+ * Set Access Key and switch to Access Key mode.
743
+ * Accepts any known env prefix (talken_live_, talken_stg_, talken_dev_, talken_local_).
744
+ */
745
+ setAccessKey(key) {
746
+ const trimmed = key.trim();
747
+ if (!_TalkenApiClient.isValidAccessKeyFormat(trimmed)) {
748
+ throw new Error(
749
+ "Invalid access key format. Expected: talken_<env>_<publicId>.<secret>"
750
+ );
751
+ }
752
+ this.accessKeyRaw = trimmed;
753
+ saveToken("access_key_raw", trimmed);
754
+ this.accessToken = null;
755
+ this.refreshToken_ = null;
756
+ this.expiresAt = null;
757
+ removeToken("access_token");
758
+ removeToken("refresh_token");
759
+ removeToken("expires_at");
760
+ }
761
+ /**
762
+ * Clear Access Key
763
+ */
764
+ clearAccessKey() {
765
+ this.accessKeyRaw = null;
766
+ removeToken("access_key_raw");
767
+ }
768
+ /**
769
+ * Check if running in Access Key mode
770
+ */
771
+ isAccessKeyMode() {
772
+ return !!this.accessKeyRaw;
681
773
  }
682
774
  /**
683
775
  * Check if user is authenticated (has valid access token)
684
776
  */
685
777
  isAuthenticated() {
778
+ if (this.accessKeyRaw)
779
+ return true;
686
780
  return !!this.accessToken && !this.isTokenExpired();
687
781
  }
688
782
  /**
@@ -738,7 +832,7 @@ var TalkenApiClient = class {
738
832
  */
739
833
  async request(endpoint, options) {
740
834
  const { method, body, skipAuth = false } = options;
741
- if (!skipAuth && this.isTokenExpired() && this.refreshToken_) {
835
+ if (!skipAuth && !this.accessKeyRaw && this.isTokenExpired() && this.refreshToken_) {
742
836
  await this.ensureTokenRefreshed();
743
837
  }
744
838
  const url = `${this.config.baseUrl}${endpoint}`;
@@ -746,20 +840,16 @@ var TalkenApiClient = class {
746
840
  "Content-Type": "application/json",
747
841
  Accept: "application/json"
748
842
  };
749
- if (!skipAuth && this.accessToken) {
750
- headers.Authorization = `Bearer ${this.accessToken}`;
751
- } else if (!skipAuth) {
752
- const ak = loadToken("access_key_raw");
753
- const tgAk = !ak && typeof window !== "undefined" ? (() => {
754
- try {
755
- return localStorage.getItem("talken_ak");
756
- } catch {
757
- return null;
843
+ if (!skipAuth) {
844
+ if (this.accessKeyRaw) {
845
+ headers["X-Access-Key"] = this.accessKeyRaw;
846
+ } else if (this.accessToken) {
847
+ headers.Authorization = `Bearer ${this.accessToken}`;
848
+ } else {
849
+ const tgAk = loadTgAccessKey();
850
+ if (tgAk) {
851
+ headers["X-Access-Key"] = tgAk;
758
852
  }
759
- })() : null;
760
- const effectiveAk = ak || tgAk;
761
- if (effectiveAk) {
762
- headers["X-Access-Key"] = effectiveAk;
763
853
  }
764
854
  }
765
855
  if (this.config.debug) {
@@ -795,18 +885,32 @@ var TalkenApiClient = class {
795
885
  } else {
796
886
  data = { success: true };
797
887
  }
798
- if (response.status === 401 && !skipAuth && this.refreshToken_) {
799
- try {
800
- await this.forceTokenRefresh();
801
- return this.request(endpoint, { ...options, skipAuth: true });
802
- } catch {
803
- this.clearSession();
888
+ if (response.status === 401 && !skipAuth) {
889
+ if (this.accessKeyRaw) {
890
+ if (typeof window !== "undefined") {
891
+ window.dispatchEvent(
892
+ new CustomEvent("talkenkit:access_key_expired")
893
+ );
894
+ }
804
895
  throw new TalkenApiError(
805
- "TOKEN_EXPIRED",
806
- "Session expired. Please login again.",
896
+ "ACCESS_KEY_EXPIRED",
897
+ "Access key expired. Please login again.",
807
898
  401
808
899
  );
809
900
  }
901
+ if (this.refreshToken_) {
902
+ try {
903
+ await this.forceTokenRefresh();
904
+ return this.request(endpoint, { ...options, skipAuth: true });
905
+ } catch {
906
+ this.clearSession();
907
+ throw new TalkenApiError(
908
+ "TOKEN_EXPIRED",
909
+ "Session expired. Please login again.",
910
+ 401
911
+ );
912
+ }
913
+ }
810
914
  }
811
915
  if (!response.ok) {
812
916
  const errCode = data.error?.code || "UNKNOWN_ERROR";
@@ -179,8 +179,29 @@ var TALKEN_API_ENDPOINTS = {
179
179
  // ── Config / Runtime ───────────────────────────────────────────────
180
180
  CONFIG_TX_STATUS: "/config/tx-status",
181
181
  // ── Tokens ─────────────────────────────────────────────────────────
182
- TOKENS_BALANCES: "/tokens/balances"
183
- };
182
+ TOKENS_BALANCES: "/tokens/balances",
183
+ // ── Agent Access Key ──────────────────────────────────────────────
184
+ ACCESS_KEYS: "/agent/access-keys"
185
+ };
186
+ var AK_ENV_SUFFIX = {
187
+ production: "live",
188
+ staging: "stg",
189
+ development: "dev",
190
+ localhost: "local"
191
+ };
192
+ function getAkStorageKey() {
193
+ const env = typeof process !== "undefined" && process.env?.NEXT_PUBLIC_ENVIRONMENT || typeof process !== "undefined" && process.env?.NEXT_PUBLIC_PHASE || "development";
194
+ return `talken_ak_${AK_ENV_SUFFIX[env] || "dev"}`;
195
+ }
196
+ function loadTgAccessKey() {
197
+ if (typeof localStorage === "undefined")
198
+ return null;
199
+ try {
200
+ return localStorage.getItem(getAkStorageKey()) || null;
201
+ } catch {
202
+ return null;
203
+ }
204
+ }
184
205
 
185
206
  export {
186
207
  DEFAULT_ABC_CONFIG,
@@ -204,5 +225,6 @@ export {
204
225
  DEBUG_MODE,
205
226
  ABC_FEATURES,
206
227
  DEFAULT_TALKEN_API_CONFIG,
207
- TALKEN_API_ENDPOINTS
228
+ TALKEN_API_ENDPOINTS,
229
+ loadTgAccessKey
208
230
  };
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-4P3SPC44.js";
11
11
  import {
12
12
  getCredentialManager
13
- } from "./chunk-QKK3OPQA.js";
13
+ } from "./chunk-36BJXEBA.js";
14
14
 
15
15
  // src/wallets/walletConnectors/abcWallet/walletGeneration.ts
16
16
  import { getTalkenApiClient } from "@talken/talkenkit";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  getCredentialManager
4
- } from "./chunk-QKK3OPQA.js";
4
+ } from "./chunk-36BJXEBA.js";
5
5
 
6
6
  // src/wallets/walletConnectors/abcWallet/abcBitcoinProvider.ts
7
7
  import { getTalkenApiClient } from "@talken/talkenkit";
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  hexToNumber,
8
8
  numberToHex
9
- } from "./chunk-PF65YS3T.js";
9
+ } from "./chunk-EBTKWCIS.js";
10
10
 
11
11
  // src/wallets/walletConnectors/abcWallet/abcAccessKeyProvider.ts
12
12
  var EventEmitter = class {
@@ -73,6 +73,20 @@ var AbcAccessKeyProvider = class extends EventEmitter {
73
73
  this.accessKey = accessKey;
74
74
  this.apiBaseUrl = apiBaseUrl || (typeof window !== "undefined" ? window.__TALKEN_API_URL__ || "" : "");
75
75
  }
76
+ setRequestInterceptor(interceptor) {
77
+ this.requestInterceptor = interceptor;
78
+ }
79
+ async callInterceptor(method, params) {
80
+ if (!this.requestInterceptor)
81
+ return void 0;
82
+ const request = {
83
+ method,
84
+ params,
85
+ chainId: this.chainId,
86
+ address: this.wallet?.address || ""
87
+ };
88
+ return this.requestInterceptor(request);
89
+ }
76
90
  // ── Wallet management ─────────────────────────────────────
77
91
  setWallet(wallet) {
78
92
  this.wallet = wallet;
@@ -165,6 +179,16 @@ var AbcAccessKeyProvider = class extends EventEmitter {
165
179
  "Contract deployment (missing `to`) is not supported in access-key mode"
166
180
  );
167
181
  }
182
+ const resolved = await this.callInterceptor(
183
+ "eth_sendTransaction",
184
+ params
185
+ );
186
+ if (resolved) {
187
+ if (resolved.data)
188
+ tx.data = resolved.data;
189
+ if (resolved.gasLimit)
190
+ tx.gas = resolved.gasLimit;
191
+ }
168
192
  const chainKey = getChainKey(this.chainId);
169
193
  const hexValue = tx.value || "0x0";
170
194
  const amountWei = BigInt(hexValue).toString();
@@ -202,6 +226,7 @@ var AbcAccessKeyProvider = class extends EventEmitter {
202
226
  `Address mismatch: requested ${address}, connected ${wallet.address}`
203
227
  );
204
228
  }
229
+ await this.callInterceptor("personal_sign", p);
205
230
  const network = getNetworkName(this.chainId);
206
231
  const result = await this.apiPost("/wallet/sign/evm/personal", {
207
232
  network,
@@ -230,6 +255,7 @@ var AbcAccessKeyProvider = class extends EventEmitter {
230
255
  `Address mismatch: requested ${address}, connected ${wallet.address}`
231
256
  );
232
257
  }
258
+ await this.callInterceptor("eth_signTypedData_v4", p);
233
259
  const network = getNetworkName(this.chainId);
234
260
  const result = await this.apiPost("/wallet/sign/evm/typed", {
235
261
  network,
@@ -6,7 +6,7 @@ import {
6
6
  PIN_CONFIG,
7
7
  STORAGE_PREFIX,
8
8
  TOKEN_EXPIRY
9
- } from "./chunk-RX2VOIUB.js";
9
+ } from "./chunk-6KRX73ED.js";
10
10
 
11
11
  // src/wallets/walletConnectors/abcWallet/utils.ts
12
12
  async function hashPin(pin) {
@@ -161,7 +161,8 @@ function hydrateAuthStateFromIndividualStorage(state) {
161
161
  function loadAuthState() {
162
162
  const state = loadFromStorage("auth_state" /* AUTH_STATE */);
163
163
  if (state) {
164
- if (state.accessToken && isTokenExpired(state.expiresAt)) {
164
+ const isExpired = state.accessKeyMode ? state.accessKeyExpiresAt && Date.now() >= new Date(state.accessKeyExpiresAt).getTime() : state.accessToken && isTokenExpired(state.expiresAt);
165
+ if (isExpired) {
165
166
  clearStorage();
166
167
  return null;
167
168
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  TALKEN_API_ENDPOINTS
4
- } from "./chunk-RX2VOIUB.js";
4
+ } from "./chunk-6KRX73ED.js";
5
5
 
6
6
  // src/wallets/walletConnectors/abcWallet/api/ConfigApi.ts
7
7
  import { getTalkenApiClient } from "@talken/talkenkit";
@@ -1,16 +1,17 @@
1
1
  "use client";
2
2
  import {
3
3
  abcConnector
4
- } from "./chunk-2A5XTST5.js";
4
+ } from "./chunk-SDRE2D5I.js";
5
+ import {
6
+ createTalkenApiClient
7
+ } from "./chunk-5ERWBR7D.js";
5
8
  import {
6
9
  resolveTalkenApiUrl
7
10
  } from "./chunk-GFWUFYT2.js";
8
11
  import {
9
- createTalkenApiClient
10
- } from "./chunk-NP5PWUVU.js";
11
- import {
12
- ABC_WALLET_METADATA
13
- } from "./chunk-RX2VOIUB.js";
12
+ ABC_WALLET_METADATA,
13
+ loadTgAccessKey
14
+ } from "./chunk-6KRX73ED.js";
14
15
 
15
16
  // src/wallets/walletConnectors/abcWallet/abcWallet.ts
16
17
  import { setTalkenApiClient } from "@talken/talkenkit";
@@ -21,7 +22,7 @@ var abcWallet = (specificOptions) => ({ projectId }) => {
21
22
  debug: specificOptions?.environment === "development"
22
23
  });
23
24
  setTalkenApiClient(talkenApi);
24
- const accessKey = specificOptions?.accessKey || (typeof localStorage !== "undefined" ? localStorage.getItem("talken_ak") : null) || null;
25
+ const accessKey = specificOptions?.accessKey || loadTgAccessKey() || null;
25
26
  const config = {
26
27
  talkenApiUrl,
27
28
  apiKey: specificOptions?.apiKey,
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import {
3
+ getWalletConnectConnector
4
+ } from "./chunk-PODFK4OS.js";
5
+
6
+ // src/wallets/walletConnectors/klipWallet/klipWallet.ts
7
+ var klipWallet = ({
8
+ projectId,
9
+ walletConnectParameters
10
+ }) => {
11
+ return {
12
+ id: "klip",
13
+ name: "Klip Wallet",
14
+ iconUrl: async () => (await import("./klipWallet-TBZJ5GGT.js")).default,
15
+ iconBackground: "#3B6FF5",
16
+ downloadUrls: {
17
+ ios: "https://apps.apple.com/kr/app/klip/id1627665524",
18
+ android: "https://play.google.com/store/apps/details?id=com.klipwallet.app",
19
+ mobile: "https://klipwallet.com",
20
+ qrCode: "https://klipwallet.com"
21
+ },
22
+ mobile: {
23
+ getUri: (uri) => `klip://walletconnect?uri=${encodeURIComponent(uri)}`
24
+ },
25
+ qrCode: {
26
+ getUri: (uri) => uri
27
+ },
28
+ createConnector: getWalletConnectConnector({
29
+ projectId,
30
+ walletConnectParameters
31
+ })
32
+ };
33
+ };
34
+
35
+ export {
36
+ klipWallet
37
+ };
@@ -7,13 +7,13 @@ import {
7
7
  import {
8
8
  hexToNumber,
9
9
  numberToHex
10
- } from "./chunk-PF65YS3T.js";
10
+ } from "./chunk-EBTKWCIS.js";
11
11
  import {
12
12
  TalkenApiError
13
13
  } from "./chunk-4P3SPC44.js";
14
14
  import {
15
15
  getCredentialManager
16
- } from "./chunk-QKK3OPQA.js";
16
+ } from "./chunk-36BJXEBA.js";
17
17
 
18
18
  // src/wallets/walletConnectors/abcWallet/abcProvider.ts
19
19
  import {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  STORAGE_PREFIX
4
- } from "./chunk-RX2VOIUB.js";
4
+ } from "./chunk-6KRX73ED.js";
5
5
 
6
6
  // src/wallets/walletConnectors/abcWallet/sessionUtils.ts
7
7
  import { getTalkenApiClient } from "@talken/talkenkit";
@@ -1,4 +1,7 @@
1
1
  "use client";
2
+ import {
3
+ createTalkenApiClient
4
+ } from "./chunk-5ERWBR7D.js";
2
5
  import {
3
6
  setTalkenApiClient
4
7
  } from "./chunk-R6ZE7JAZ.js";
@@ -7,7 +10,7 @@ import {
7
10
  } from "./chunk-GFWUFYT2.js";
8
11
  import {
9
12
  AbcAccessKeyProvider
10
- } from "./chunk-4JZPP3S7.js";
13
+ } from "./chunk-E6ZG77AF.js";
11
14
  import {
12
15
  setGlobalDefaultBitcoinNetwork,
13
16
  setGlobalDefaultChainId,
@@ -15,20 +18,20 @@ import {
15
18
  } from "./chunk-O4AU63LK.js";
16
19
  import {
17
20
  createAbcEvmProvider
18
- } from "./chunk-L6FCF3FH.js";
21
+ } from "./chunk-L3HWFGTN.js";
19
22
  import {
20
23
  clearAuthState,
21
24
  clearStorage,
22
25
  loadAuthState,
23
26
  loadFromStorage,
24
27
  saveAuthState
25
- } from "./chunk-PF65YS3T.js";
26
- import {
27
- createTalkenApiClient
28
- } from "./chunk-NP5PWUVU.js";
28
+ } from "./chunk-EBTKWCIS.js";
29
29
  import {
30
30
  getCredentialManager
31
- } from "./chunk-QKK3OPQA.js";
31
+ } from "./chunk-36BJXEBA.js";
32
+ import {
33
+ loadTgAccessKey
34
+ } from "./chunk-6KRX73ED.js";
32
35
 
33
36
  // src/wallets/walletConnectors/abcWallet/abcConnector.ts
34
37
  import { getTalkenApiClient } from "@talken/talkenkit";
@@ -52,9 +55,17 @@ function abcConnector(options) {
52
55
  defaultChainId: config.defaultChainId
53
56
  });
54
57
  setTalkenApiClient(talkenApi);
55
- const isAccessKeyMode = !!config.accessKey;
58
+ const storedAccessKey = typeof window !== "undefined" ? (() => {
59
+ try {
60
+ return localStorage.getItem("talken_api_access_key_raw");
61
+ } catch {
62
+ return null;
63
+ }
64
+ })() : null;
65
+ const effectiveAccessKey = config.accessKey || storedAccessKey;
66
+ const isAccessKeyMode = !!effectiveAccessKey;
56
67
  const provider = isAccessKeyMode ? new AbcAccessKeyProvider(
57
- config.accessKey,
68
+ effectiveAccessKey,
58
69
  resolveTalkenApiUrl(config.talkenApiUrl)
59
70
  ) : createAbcEvmProvider(talkenApi);
60
71
  let accountsChangedHandler;
@@ -82,7 +93,7 @@ function abcConnector(options) {
82
93
  method: "POST",
83
94
  headers: {
84
95
  "Content-Type": "application/json",
85
- "X-Access-Key": config.accessKey
96
+ "X-Access-Key": effectiveAccessKey
86
97
  },
87
98
  body: JSON.stringify({ action: "info" })
88
99
  });
@@ -213,6 +224,10 @@ function abcConnector(options) {
213
224
  }
214
225
  provider.clearWallet();
215
226
  talkenApi.auth.logout();
227
+ try {
228
+ localStorage.removeItem("talken_api_access_key_raw");
229
+ } catch {
230
+ }
216
231
  clearAuthState();
217
232
  getCredentialManager().clear();
218
233
  },
@@ -249,7 +264,7 @@ function abcConnector(options) {
249
264
  if (isAccessKeyMode) {
250
265
  if (provider.isConnected())
251
266
  return true;
252
- const hasKey = !!config.accessKey || typeof localStorage !== "undefined" && !!localStorage.getItem("talken_ak");
267
+ const hasKey = !!effectiveAccessKey || typeof localStorage !== "undefined" && (!!localStorage.getItem("talken_api_access_key_raw") || !!loadTgAccessKey());
253
268
  const authState2 = loadAuthState();
254
269
  return hasKey && !!authState2?.wallet?.address;
255
270
  }
@@ -263,6 +278,9 @@ function abcConnector(options) {
263
278
  if (talkenApi.isAuthenticated()) {
264
279
  return true;
265
280
  }
281
+ if (talkenApi.isAccessKeyMode()) {
282
+ return true;
283
+ }
266
284
  const refreshToken = loadFromStorage(
267
285
  "refresh_token" /* REFRESH_TOKEN */
268
286
  );
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  TokenApi
4
- } from "./chunk-FKI5AZVH.js";
4
+ } from "./chunk-3K3KYVRN.js";
5
5
 
6
6
  // src/wallets/walletConnectors/abcWallet/api/WalletscanApi.ts
7
7
  import { getTalkenApiClient, networkNameToChainKey } from "@talken/talkenkit";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  loadAuthState,
4
4
  saveAuthState
5
- } from "./chunk-PF65YS3T.js";
5
+ } from "./chunk-EBTKWCIS.js";
6
6
 
7
7
  // src/wallets/walletConnectors/abcWallet/abcBitcoinConnector.ts
8
8
  import { getTalkenApiClient } from "@talken/talkenkit";