@talken/talkenkit 2.3.5 → 2.3.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.
package/dist/index.js CHANGED
@@ -12,12 +12,12 @@ import {
12
12
  import {
13
13
  darkTheme
14
14
  } from "./chunk-RZWDCITT.js";
15
- import {
16
- midnightTheme
17
- } from "./chunk-7ZP3ENJ2.js";
18
15
  import {
19
16
  lightTheme
20
17
  } from "./chunk-72HZGUJA.js";
18
+ import {
19
+ midnightTheme
20
+ } from "./chunk-7ZP3ENJ2.js";
21
21
  import "./chunk-DQLAW7KN.js";
22
22
  import {
23
23
  en_US_default
@@ -2114,7 +2114,7 @@ function setRainbowKitVersion({ version }) {
2114
2114
  }
2115
2115
  function useFingerprint() {
2116
2116
  const fingerprint = useCallback3(() => {
2117
- setRainbowKitVersion({ version: "2.3.5" });
2117
+ setRainbowKitVersion({ version: "2.3.6" });
2118
2118
  }, []);
2119
2119
  useEffect10(() => {
2120
2120
  fingerprint();
@@ -5508,16 +5508,20 @@ var AbcWaasClient = class {
5508
5508
  console.log("[AbcWaasClient] Raw wallet API response:", {
5509
5509
  hasUid: !!raw.uid,
5510
5510
  hasSid: !!raw.sid,
5511
+ hasKeyId: !!raw.key_id,
5511
5512
  hasWid: !!raw.wid,
5512
5513
  hasPvencstr: !!raw.pvencstr,
5513
5514
  hasEncryptDevicePassword: !!raw.encryptDevicePassword,
5515
+ hasEncryptedShare: !!raw.encrypted_share,
5514
5516
  hasPubkey: !!raw.pubkey,
5515
5517
  allKeys: Object.keys(raw)
5516
5518
  });
5517
5519
  return {
5518
- address: raw.address || "",
5519
- keyId: raw.keyId || raw.key_id || raw.sid,
5520
- encryptedShare: raw.encryptedShare || raw.encrypted_share || "",
5520
+ address: raw.sid || "",
5521
+ // FIX: sid is the EVM address
5522
+ keyId: raw.key_id || raw.keyId || raw.sid,
5523
+ encryptedShare: raw.encrypted_share || raw.key_id || "",
5524
+ // Use key_id as fallback
5521
5525
  uid: raw.uid,
5522
5526
  sid: raw.sid,
5523
5527
  wid: raw.wid,
@@ -5626,7 +5630,6 @@ var AbcWaasClient = class {
5626
5630
  };
5627
5631
  const network = networkMap[params.chainId] || "ethereum";
5628
5632
  const tx = params.transaction;
5629
- const isKaiaNetwork = params.chainId === 1001 || params.chainId === 8217;
5630
5633
  if (!tx.maxFeePerGas || !tx.maxPriorityFeePerGas || !tx.gasLimit || !tx.gas) {
5631
5634
  try {
5632
5635
  if (!tx.maxFeePerGas || !tx.maxPriorityFeePerGas) {
@@ -5678,66 +5681,11 @@ var AbcWaasClient = class {
5678
5681
  body: estimateBody.toString()
5679
5682
  });
5680
5683
  const estimateData = await estimateResponse.json();
5681
- console.log("\u26FD Gas estimate response:", {
5682
- status: estimateResponse.status,
5683
- ok: estimateResponse.ok,
5684
- response: estimateData
5685
- });
5686
5684
  if (estimateResponse.ok && estimateData.result) {
5687
- const estimatedGas = estimateData.result;
5688
- const estimatedGasNumber = Number.parseInt(estimatedGas, 16);
5689
- if (isKaiaNetwork) {
5690
- const hasContractData = tx.data && tx.data !== "0x" && tx.data.length > 2;
5691
- const minGas = hasContractData ? 1e5 : 21e3;
5692
- if (estimatedGasNumber < minGas) {
5693
- console.warn(
5694
- "\u26A0\uFE0F [Kaia] Gas estimate too low, enforcing minimum:",
5695
- {
5696
- chainId: params.chainId,
5697
- estimated: estimatedGas,
5698
- estimatedDecimal: estimatedGasNumber,
5699
- minimum: minGas,
5700
- isContractCall: hasContractData
5701
- }
5702
- );
5703
- tx.gasLimit = `0x${minGas.toString(16)}`;
5704
- } else {
5705
- const bufferedGas = Math.floor(estimatedGasNumber * 1.2);
5706
- tx.gasLimit = `0x${bufferedGas.toString(16)}`;
5707
- console.log("\u2705 [Kaia] Gas limit with 20% buffer:", {
5708
- estimated: estimatedGas,
5709
- buffered: tx.gasLimit
5710
- });
5711
- }
5712
- } else {
5713
- tx.gasLimit = estimatedGas;
5714
- console.log("\u2705 Gas limit from estimate:", estimatedGas);
5715
- }
5685
+ tx.gasLimit = estimateData.result;
5716
5686
  } else {
5717
- const hasContractData = tx.data && tx.data !== "0x" && tx.data.length > 2;
5718
- if (hasContractData) {
5719
- tx.gasLimit = isKaiaNetwork ? "0x186a0" : "0x249f0";
5720
- console.warn(
5721
- "\u26A0\uFE0F Gas estimate failed, using contract call fallback:",
5722
- {
5723
- chainId: params.chainId,
5724
- network,
5725
- fallbackGasLimit: tx.gasLimit,
5726
- isKaia: isKaiaNetwork,
5727
- error: estimateData.errorMessage || estimateData.msg
5728
- }
5729
- );
5730
- } else {
5731
- tx.gasLimit = "0x5208";
5732
- console.warn(
5733
- "\u26A0\uFE0F Gas estimate failed, using native transfer fallback:",
5734
- {
5735
- chainId: params.chainId,
5736
- network,
5737
- fallbackGasLimit: tx.gasLimit
5738
- }
5739
- );
5740
- }
5687
+ const fallbackGasLimit = "0x2dc6c0";
5688
+ tx.gasLimit = fallbackGasLimit;
5741
5689
  }
5742
5690
  }
5743
5691
  } catch (error3) {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AbcWaasClient,
4
4
  createAbcWaasClient
5
- } from "../chunk-3DPCIDW6.js";
5
+ } from "../chunk-P2E4LSYH.js";
6
6
  import "../chunk-G2LI5MVX.js";
7
7
  import "../chunk-W23N7VC4.js";
8
8
  import "../chunk-VETRBBA2.js";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  abcConnector
4
- } from "../chunk-X4CDP7L7.js";
5
- import "../chunk-3DPCIDW6.js";
4
+ } from "../chunk-BHMMHU7Y.js";
5
+ import "../chunk-P2E4LSYH.js";
6
6
  import "../chunk-G2LI5MVX.js";
7
7
  import "../chunk-73B7HWCT.js";
8
8
  import "../chunk-W23N7VC4.js";
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  abcSolanaWallet
4
- } from "../chunk-KOT7JYJR.js";
4
+ } from "../chunk-OEB7MRS5.js";
5
5
  import "../chunk-AEQOPQL6.js";
6
6
  import "../chunk-MY5YIDOB.js";
7
- import "../chunk-3DPCIDW6.js";
7
+ import "../chunk-P2E4LSYH.js";
8
8
  import "../chunk-G2LI5MVX.js";
9
9
  import "../chunk-W23N7VC4.js";
10
10
  import "../chunk-VETRBBA2.js";
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  abcWallet
4
- } from "../chunk-CSWWNAYR.js";
5
- import "../chunk-X4CDP7L7.js";
6
- import "../chunk-3DPCIDW6.js";
4
+ } from "../chunk-RSZS2RMC.js";
5
+ import "../chunk-BHMMHU7Y.js";
6
+ import "../chunk-P2E4LSYH.js";
7
7
  import "../chunk-G2LI5MVX.js";
8
8
  import "../chunk-73B7HWCT.js";
9
9
  import "../chunk-W23N7VC4.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AbcWaasApiClient,
4
4
  createAbcWaasApiClient
5
- } from "../../chunk-BC2UIAF7.js";
5
+ } from "../../chunk-LTBQU2GW.js";
6
6
  import {
7
7
  WalletApi
8
8
  } from "../../chunk-JBRW4UTW.js";
@@ -15,12 +15,12 @@ import {
15
15
  import {
16
16
  SigningApi
17
17
  } from "../../chunk-4UGXLYKP.js";
18
- import {
19
- SolanaApi
20
- } from "../../chunk-DMRM7XAS.js";
21
18
  import {
22
19
  TransactionApi
23
20
  } from "../../chunk-KD2OAMDA.js";
21
+ import {
22
+ SolanaApi
23
+ } from "../../chunk-DMRM7XAS.js";
24
24
  import {
25
25
  BaseApiClient
26
26
  } from "../../chunk-IOLHAU7H.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AbcWaasApiClient,
4
4
  createAbcWaasApiClient
5
- } from "../chunk-BC2UIAF7.js";
5
+ } from "../chunk-LTBQU2GW.js";
6
6
  import "../chunk-JBRW4UTW.js";
7
7
  import {
8
8
  generateMpcWallets,
@@ -14,12 +14,12 @@ import {
14
14
  BitcoinApi
15
15
  } from "../chunk-BXCOGV3N.js";
16
16
  import "../chunk-4UGXLYKP.js";
17
- import "../chunk-DMRM7XAS.js";
18
17
  import "../chunk-KD2OAMDA.js";
18
+ import "../chunk-DMRM7XAS.js";
19
19
  import "../chunk-IOLHAU7H.js";
20
20
  import {
21
21
  abcSolanaWallet
22
- } from "../chunk-KOT7JYJR.js";
22
+ } from "../chunk-OEB7MRS5.js";
23
23
  import {
24
24
  AbcBitcoinConnector,
25
25
  createAbcBitcoinConnector
@@ -43,14 +43,14 @@ import {
43
43
  } from "../chunk-MY5YIDOB.js";
44
44
  import {
45
45
  abcWallet
46
- } from "../chunk-CSWWNAYR.js";
46
+ } from "../chunk-RSZS2RMC.js";
47
47
  import {
48
48
  abcConnector
49
- } from "../chunk-X4CDP7L7.js";
49
+ } from "../chunk-BHMMHU7Y.js";
50
50
  import {
51
51
  AbcWaasClient,
52
52
  createAbcWaasClient
53
- } from "../chunk-3DPCIDW6.js";
53
+ } from "../chunk-P2E4LSYH.js";
54
54
  import {
55
55
  secure_default
56
56
  } from "../chunk-G2LI5MVX.js";
@@ -0,0 +1,228 @@
1
+ "use client";
2
+ import {
3
+ createAbcWaasClient
4
+ } from "./chunk-YZBFKVTX.js";
5
+ import {
6
+ createAbcEvmProvider
7
+ } from "./chunk-73B7HWCT.js";
8
+ import {
9
+ clearAuthState,
10
+ clearEncryptedTokens,
11
+ loadAuthState,
12
+ saveAuthState
13
+ } from "./chunk-W23N7VC4.js";
14
+
15
+ // src/wallets/walletConnectors/abcWallet/abcConnector.ts
16
+ import { createConnector } from "wagmi";
17
+ function abcConnector(options) {
18
+ const { config } = options;
19
+ return createConnector((wagmiConfig) => {
20
+ const client = createAbcWaasClient(config);
21
+ const provider = createAbcEvmProvider(client);
22
+ let accountsChangedHandler;
23
+ let chainChangedHandler;
24
+ let disconnectHandler;
25
+ return {
26
+ id: "abc",
27
+ name: "ABC Wallet",
28
+ type: "abc",
29
+ /**
30
+ * Connect wallet
31
+ */
32
+ async connect() {
33
+ try {
34
+ const authState = loadAuthState();
35
+ console.log("\u{1F527} ABC Connector connect() called:", {
36
+ hasAuthState: !!authState,
37
+ isAuthenticated: authState?.isAuthenticated,
38
+ hasWallet: !!authState?.wallet,
39
+ walletAddress: authState?.wallet?.address
40
+ });
41
+ if (!authState || !authState.isAuthenticated || !authState.wallet) {
42
+ throw new Error("ABC_LOGIN_REQUIRED");
43
+ }
44
+ provider.setWallet(authState.wallet);
45
+ console.log("\u2705 Provider wallet set:", {
46
+ address: authState.wallet.address,
47
+ hasPIN: !!authState.pin
48
+ });
49
+ const accounts = await provider.request({
50
+ method: "eth_requestAccounts"
51
+ });
52
+ const currentChainId = await provider.request({
53
+ method: "eth_chainId"
54
+ });
55
+ if (accountsChangedHandler) {
56
+ provider.removeListener("accountsChanged", accountsChangedHandler);
57
+ }
58
+ accountsChangedHandler = (accounts2) => {
59
+ wagmiConfig.emitter.emit("change", {
60
+ accounts: accounts2
61
+ });
62
+ };
63
+ provider.on("accountsChanged", accountsChangedHandler);
64
+ if (chainChangedHandler) {
65
+ provider.removeListener("chainChanged", chainChangedHandler);
66
+ }
67
+ chainChangedHandler = (chainId) => {
68
+ wagmiConfig.emitter.emit("change", {
69
+ chainId: Number(chainId)
70
+ });
71
+ };
72
+ provider.on("chainChanged", chainChangedHandler);
73
+ if (disconnectHandler) {
74
+ provider.removeListener("disconnect", disconnectHandler);
75
+ }
76
+ disconnectHandler = () => {
77
+ wagmiConfig.emitter.emit("disconnect");
78
+ this.onDisconnect();
79
+ };
80
+ provider.on("disconnect", disconnectHandler);
81
+ return {
82
+ accounts,
83
+ chainId: Number(currentChainId)
84
+ };
85
+ } catch (error) {
86
+ if (error.message === "ABC_LOGIN_REQUIRED") {
87
+ throw error;
88
+ }
89
+ throw error;
90
+ }
91
+ },
92
+ /**
93
+ * Disconnect wallet
94
+ */
95
+ async disconnect() {
96
+ if (accountsChangedHandler) {
97
+ provider.removeListener("accountsChanged", accountsChangedHandler);
98
+ accountsChangedHandler = void 0;
99
+ }
100
+ if (chainChangedHandler) {
101
+ provider.removeListener("chainChanged", chainChangedHandler);
102
+ chainChangedHandler = void 0;
103
+ }
104
+ if (disconnectHandler) {
105
+ provider.removeListener("disconnect", disconnectHandler);
106
+ disconnectHandler = void 0;
107
+ }
108
+ provider.clearWallet();
109
+ await client.logout();
110
+ let savedPinHash = null;
111
+ let savedEmail = null;
112
+ if (typeof window !== "undefined") {
113
+ savedPinHash = localStorage.getItem("talkenkit_abc_pin_hash");
114
+ savedEmail = localStorage.getItem("talkenkit_abc_saved_email");
115
+ }
116
+ clearAuthState();
117
+ clearEncryptedTokens();
118
+ if (typeof window !== "undefined") {
119
+ localStorage.removeItem("talkenkit_abc_enc_salt");
120
+ localStorage.removeItem("talkenkit_abc_enc_tokens");
121
+ if (savedPinHash) {
122
+ localStorage.setItem("talkenkit_abc_pin_hash", savedPinHash);
123
+ }
124
+ if (savedEmail) {
125
+ localStorage.setItem("talkenkit_abc_saved_email", savedEmail);
126
+ }
127
+ }
128
+ console.log("\u2705 ABC Wallet disconnected (PIN preserved)");
129
+ },
130
+ /**
131
+ * Get accounts
132
+ */
133
+ async getAccounts() {
134
+ const accounts = await provider.request({
135
+ method: "eth_accounts"
136
+ });
137
+ return accounts.map((account) => account);
138
+ },
139
+ /**
140
+ * Get chain ID
141
+ */
142
+ async getChainId() {
143
+ const chainId = await provider.request({
144
+ method: "eth_chainId"
145
+ });
146
+ return Number(chainId);
147
+ },
148
+ /**
149
+ * Get provider
150
+ */
151
+ async getProvider() {
152
+ return provider;
153
+ },
154
+ /**
155
+ * Check if authorized (has valid session)
156
+ */
157
+ async isAuthorized() {
158
+ try {
159
+ const authState = loadAuthState();
160
+ if (!authState || !authState.isAuthenticated) {
161
+ return false;
162
+ }
163
+ return client.isAuthenticated();
164
+ } catch {
165
+ return false;
166
+ }
167
+ },
168
+ /**
169
+ * Switch chain
170
+ */
171
+ async switchChain({ chainId }) {
172
+ await provider.request({
173
+ method: "wallet_switchEthereumChain",
174
+ params: [{ chainId: `0x${chainId.toString(16)}` }]
175
+ });
176
+ const newChainId = await this.getChainId();
177
+ const authState = loadAuthState();
178
+ if (authState?.wallet) {
179
+ authState.wallet.chainId = newChainId;
180
+ saveAuthState(authState);
181
+ }
182
+ return wagmiConfig.chains.find((x) => x.id === chainId) ?? {
183
+ id: chainId,
184
+ name: `Chain ${chainId}`,
185
+ nativeCurrency: {
186
+ name: "Ether",
187
+ decimals: 18,
188
+ symbol: "ETH"
189
+ },
190
+ rpcUrls: {
191
+ default: { http: [""] }
192
+ }
193
+ };
194
+ },
195
+ /**
196
+ * Handle accounts changed
197
+ */
198
+ onAccountsChanged(accounts) {
199
+ if (accounts.length === 0) {
200
+ this.onDisconnect();
201
+ } else {
202
+ wagmiConfig.emitter.emit("change", {
203
+ accounts
204
+ });
205
+ }
206
+ },
207
+ /**
208
+ * Handle chain changed
209
+ */
210
+ onChainChanged(chain) {
211
+ const chainId = Number(chain);
212
+ wagmiConfig.emitter.emit("change", { chainId });
213
+ },
214
+ /**
215
+ * Handle disconnect
216
+ */
217
+ onDisconnect(_error) {
218
+ provider.clearWallet();
219
+ clearAuthState();
220
+ wagmiConfig.emitter.emit("disconnect");
221
+ }
222
+ };
223
+ });
224
+ }
225
+
226
+ export {
227
+ abcConnector
228
+ };
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import {
3
+ abcConnector
4
+ } from "./chunk-WR7HSVMH.js";
5
+ import {
6
+ ABC_WALLET_METADATA
7
+ } from "./chunk-VETRBBA2.js";
8
+
9
+ // src/wallets/walletConnectors/abcWallet/abcWallet.ts
10
+ var abcWallet = (specificOptions) => ({ projectId }) => {
11
+ const waasUrl = specificOptions?.waasUrl || process.env.NEXT_PUBLIC_ABC_WAAS_URL || process.env.VITE_ABC_WAAS_URL;
12
+ if (!waasUrl) {
13
+ throw new Error(
14
+ 'ABC WaaS URL is required. Please provide it via:\n1. abcWallet({ waasUrl: "..." }) options, or\n2. NEXT_PUBLIC_ABC_WAAS_URL environment variable, or\n3. VITE_ABC_WAAS_URL environment variable'
15
+ );
16
+ }
17
+ const config = {
18
+ waasUrl,
19
+ apiKey: specificOptions?.apiKey,
20
+ plain: specificOptions?.plain || "",
21
+ // Deprecated - not used (secure.ts uses random generation)
22
+ environment: specificOptions?.environment || "development",
23
+ projectId
24
+ };
25
+ return {
26
+ id: ABC_WALLET_METADATA.id,
27
+ name: ABC_WALLET_METADATA.name,
28
+ rdns: ABC_WALLET_METADATA.rdns,
29
+ iconUrl: async () => (await import("./abcWallet-AYWSIGAG.js")).default,
30
+ iconBackground: ABC_WALLET_METADATA.iconBackground,
31
+ // Embedded wallet - no installation required
32
+ installed: void 0,
33
+ // No download URLs for embedded wallet
34
+ downloadUrls: void 0,
35
+ // Create connector - wrapper function required by Wallet type
36
+ createConnector: (_walletDetails) => abcConnector({ config }),
37
+ // Embedded wallet always available
38
+ hidden: () => false
39
+ };
40
+ };
41
+
42
+ export {
43
+ abcWallet
44
+ };