@talken/talkenkit 2.4.19 → 2.4.21
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 +9 -3
- package/dist/wallets/walletConnectors/abcWallet/abcConnector.js +2 -2
- package/dist/wallets/walletConnectors/abcWallet/abcWallet.js +3 -3
- package/dist/wallets/walletConnectors/abcWallet/index.js +14 -14
- package/dist/wallets/walletConnectors/chunk-CN672ZCD.js +52 -0
- package/dist/wallets/walletConnectors/chunk-EAKU7HN4.js +302 -0
- package/dist/wallets/walletConnectors/chunk-EXLVQ5ES.js +302 -0
- package/dist/wallets/walletConnectors/chunk-GJOFP2FQ.js +71 -0
- package/dist/wallets/walletConnectors/chunk-K37GTJN7.js +52 -0
- package/dist/wallets/walletConnectors/chunk-M6KRNMD3.js +71 -0
- package/dist/wallets/walletConnectors/chunk-N7W4H2XZ.js +71 -0
- package/dist/wallets/walletConnectors/index.js +35 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6983,7 +6983,7 @@ function setRainbowKitVersion({ version }) {
|
|
|
6983
6983
|
}
|
|
6984
6984
|
function useFingerprint() {
|
|
6985
6985
|
const fingerprint = useCallback13(() => {
|
|
6986
|
-
setRainbowKitVersion({ version: "2.4.
|
|
6986
|
+
setRainbowKitVersion({ version: "2.4.21" });
|
|
6987
6987
|
}, []);
|
|
6988
6988
|
useEffect16(() => {
|
|
6989
6989
|
fingerprint();
|
|
@@ -9856,7 +9856,9 @@ function useAbcWaasAuth(props) {
|
|
|
9856
9856
|
}
|
|
9857
9857
|
} catch (err) {
|
|
9858
9858
|
console.error("[useAbcWaasAuth] Password submit error:", err);
|
|
9859
|
-
|
|
9859
|
+
const detailsCode = err.details?.code ?? err.details?.errCode;
|
|
9860
|
+
const is619 = Number(err.code) === 619 || String(err.code) === "619" || Number(detailsCode) === 619 || String(detailsCode) === "619";
|
|
9861
|
+
if (is619) {
|
|
9860
9862
|
try {
|
|
9861
9863
|
const api = getApi();
|
|
9862
9864
|
await api.auth.sendOtp(email);
|
|
@@ -9869,7 +9871,11 @@ function useAbcWaasAuth(props) {
|
|
|
9869
9871
|
setIsLoading(false);
|
|
9870
9872
|
return;
|
|
9871
9873
|
}
|
|
9872
|
-
|
|
9874
|
+
if (err.statusCode === 401 || err.code === "UNAUTHORIZED" || err.message === "Password login failed") {
|
|
9875
|
+
setError("Incorrect email or password. Please try again.");
|
|
9876
|
+
} else {
|
|
9877
|
+
setError("Login failed. Please try again.");
|
|
9878
|
+
}
|
|
9873
9879
|
} finally {
|
|
9874
9880
|
setIsLoading(false);
|
|
9875
9881
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
abcConnector
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MEAJDFYT.js";
|
|
5
|
+
import "../chunk-F5C6OZYF.js";
|
|
5
6
|
import "../chunk-BDM7TUVM.js";
|
|
6
7
|
import "../chunk-O4AU63LK.js";
|
|
7
|
-
import "../chunk-F5C6OZYF.js";
|
|
8
8
|
import "../chunk-7QHCSJDN.js";
|
|
9
9
|
import "../chunk-6LH6ZME2.js";
|
|
10
10
|
import "../chunk-D5EFTEOM.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
abcWallet
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-ZAZVSLZK.js";
|
|
5
5
|
import "../chunk-BBD77PEX.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-MEAJDFYT.js";
|
|
7
|
+
import "../chunk-F5C6OZYF.js";
|
|
7
8
|
import "../chunk-BDM7TUVM.js";
|
|
8
9
|
import "../chunk-O4AU63LK.js";
|
|
9
|
-
import "../chunk-F5C6OZYF.js";
|
|
10
10
|
import "../chunk-7QHCSJDN.js";
|
|
11
11
|
import "../chunk-6LH6ZME2.js";
|
|
12
12
|
import "../chunk-D5EFTEOM.js";
|
|
@@ -22,8 +22,11 @@ import {
|
|
|
22
22
|
import "../chunk-O47OQDRJ.js";
|
|
23
23
|
import "../chunk-CPAYLZZL.js";
|
|
24
24
|
import "../chunk-IX6DQDRE.js";
|
|
25
|
-
import
|
|
26
|
-
|
|
25
|
+
import {
|
|
26
|
+
AbcTronProvider,
|
|
27
|
+
TRON_NETWORKS,
|
|
28
|
+
TronProviderError
|
|
29
|
+
} from "../chunk-H2RCMAOR.js";
|
|
27
30
|
import {
|
|
28
31
|
AbcBitcoinConnector,
|
|
29
32
|
createAbcBitcoinConnector
|
|
@@ -37,18 +40,20 @@ import {
|
|
|
37
40
|
AbcSolanaProvider,
|
|
38
41
|
SolanaProviderError
|
|
39
42
|
} from "../chunk-7RSNIMBB.js";
|
|
40
|
-
import
|
|
41
|
-
|
|
42
|
-
TRON_NETWORKS,
|
|
43
|
-
TronProviderError
|
|
44
|
-
} from "../chunk-H2RCMAOR.js";
|
|
43
|
+
import "../chunk-C4L5XI6N.js";
|
|
44
|
+
import "../chunk-7ZCM4DCC.js";
|
|
45
45
|
import {
|
|
46
46
|
abcWallet
|
|
47
|
-
} from "../chunk-
|
|
47
|
+
} from "../chunk-ZAZVSLZK.js";
|
|
48
48
|
import "../chunk-BBD77PEX.js";
|
|
49
49
|
import {
|
|
50
50
|
abcConnector
|
|
51
|
-
} from "../chunk-
|
|
51
|
+
} from "../chunk-MEAJDFYT.js";
|
|
52
|
+
import {
|
|
53
|
+
AbcEvmProvider,
|
|
54
|
+
createAbcEvmProvider,
|
|
55
|
+
createAbcProvider
|
|
56
|
+
} from "../chunk-F5C6OZYF.js";
|
|
52
57
|
import {
|
|
53
58
|
AbcWaasClient,
|
|
54
59
|
createAbcWaasClient
|
|
@@ -62,11 +67,6 @@ import {
|
|
|
62
67
|
getSolanaNetwork,
|
|
63
68
|
getTronNetwork
|
|
64
69
|
} from "../chunk-O4AU63LK.js";
|
|
65
|
-
import {
|
|
66
|
-
AbcEvmProvider,
|
|
67
|
-
createAbcEvmProvider,
|
|
68
|
-
createAbcProvider
|
|
69
|
-
} from "../chunk-F5C6OZYF.js";
|
|
70
70
|
import "../chunk-7QHCSJDN.js";
|
|
71
71
|
import {
|
|
72
72
|
calculateExpiryTimestamp,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
createTalkenApiClient
|
|
4
|
+
} from "./chunk-BBD77PEX.js";
|
|
5
|
+
import {
|
|
6
|
+
abcConnector
|
|
7
|
+
} from "./chunk-EXLVQ5ES.js";
|
|
8
|
+
import {
|
|
9
|
+
ABC_WALLET_METADATA
|
|
10
|
+
} from "./chunk-DHHVIM22.js";
|
|
11
|
+
|
|
12
|
+
// src/wallets/walletConnectors/abcWallet/abcWallet.ts
|
|
13
|
+
import { setTalkenApiClient } from "@talken/talkenkit";
|
|
14
|
+
var abcWallet = (specificOptions) => ({ projectId }) => {
|
|
15
|
+
const talkenApiUrl = specificOptions?.talkenApiUrl || process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001/api/v1";
|
|
16
|
+
const talkenApi = createTalkenApiClient({
|
|
17
|
+
baseUrl: talkenApiUrl,
|
|
18
|
+
debug: specificOptions?.environment === "development"
|
|
19
|
+
});
|
|
20
|
+
setTalkenApiClient(talkenApi);
|
|
21
|
+
const waasUrl = specificOptions?.waasUrl || process.env.NEXT_PUBLIC_ABC_WAAS_URL || process.env.VITE_ABC_WAAS_URL || "";
|
|
22
|
+
const config = {
|
|
23
|
+
waasUrl,
|
|
24
|
+
apiKey: specificOptions?.apiKey,
|
|
25
|
+
plain: specificOptions?.plain || "",
|
|
26
|
+
// Deprecated - not used (secure.ts uses random generation)
|
|
27
|
+
environment: specificOptions?.environment || "development",
|
|
28
|
+
defaultChainId: specificOptions?.defaultChainId,
|
|
29
|
+
defaultSolanaNetwork: specificOptions?.defaultSolanaNetwork,
|
|
30
|
+
defaultBitcoinNetwork: specificOptions?.defaultBitcoinNetwork,
|
|
31
|
+
projectId
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
id: ABC_WALLET_METADATA.id,
|
|
35
|
+
name: ABC_WALLET_METADATA.name,
|
|
36
|
+
rdns: ABC_WALLET_METADATA.rdns,
|
|
37
|
+
iconUrl: async () => (await import("./abcWallet-AYWSIGAG.js")).default,
|
|
38
|
+
iconBackground: ABC_WALLET_METADATA.iconBackground,
|
|
39
|
+
// Embedded wallet - no installation required
|
|
40
|
+
installed: void 0,
|
|
41
|
+
// No download URLs for embedded wallet
|
|
42
|
+
downloadUrls: void 0,
|
|
43
|
+
// Create connector - wrapper function required by Wallet type
|
|
44
|
+
createConnector: (_walletDetails) => abcConnector({ config }),
|
|
45
|
+
// Embedded wallet always available
|
|
46
|
+
hidden: () => false
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
abcWallet
|
|
52
|
+
};
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
setGlobalDefaultBitcoinNetwork,
|
|
4
|
+
setGlobalDefaultChainId,
|
|
5
|
+
setGlobalDefaultSolanaNetwork
|
|
6
|
+
} from "./chunk-O4AU63LK.js";
|
|
7
|
+
import {
|
|
8
|
+
createAbcWaasClient
|
|
9
|
+
} from "./chunk-BDM7TUVM.js";
|
|
10
|
+
import {
|
|
11
|
+
createAbcEvmProvider
|
|
12
|
+
} from "./chunk-F5C6OZYF.js";
|
|
13
|
+
import {
|
|
14
|
+
clearAuthState,
|
|
15
|
+
clearEncryptedTokens,
|
|
16
|
+
clearStorage,
|
|
17
|
+
loadAuthState,
|
|
18
|
+
loadFromStorage,
|
|
19
|
+
saveAuthState
|
|
20
|
+
} from "./chunk-6LH6ZME2.js";
|
|
21
|
+
|
|
22
|
+
// src/wallets/walletConnectors/abcWallet/abcConnector.ts
|
|
23
|
+
import { getTalkenApiClient } from "@talken/talkenkit";
|
|
24
|
+
import { createConnector } from "wagmi";
|
|
25
|
+
function abcConnector(options) {
|
|
26
|
+
const { config } = options;
|
|
27
|
+
if (config.defaultChainId) {
|
|
28
|
+
setGlobalDefaultChainId(config.defaultChainId);
|
|
29
|
+
}
|
|
30
|
+
if (config.defaultSolanaNetwork) {
|
|
31
|
+
setGlobalDefaultSolanaNetwork(config.defaultSolanaNetwork);
|
|
32
|
+
}
|
|
33
|
+
if (config.defaultBitcoinNetwork) {
|
|
34
|
+
setGlobalDefaultBitcoinNetwork(config.defaultBitcoinNetwork);
|
|
35
|
+
}
|
|
36
|
+
return createConnector((wagmiConfig) => {
|
|
37
|
+
const client = createAbcWaasClient(config);
|
|
38
|
+
const provider = createAbcEvmProvider(client);
|
|
39
|
+
let accountsChangedHandler;
|
|
40
|
+
let chainChangedHandler;
|
|
41
|
+
let disconnectHandler;
|
|
42
|
+
return {
|
|
43
|
+
id: "abc",
|
|
44
|
+
name: "ABC Wallet",
|
|
45
|
+
type: "abc",
|
|
46
|
+
/**
|
|
47
|
+
* Connect wallet
|
|
48
|
+
*/
|
|
49
|
+
async connect() {
|
|
50
|
+
try {
|
|
51
|
+
const authState = loadAuthState();
|
|
52
|
+
if (!authState || !authState.isAuthenticated || !authState.wallet) {
|
|
53
|
+
throw new Error("ABC_LOGIN_REQUIRED");
|
|
54
|
+
}
|
|
55
|
+
provider.setWallet(authState.wallet);
|
|
56
|
+
if (authState.accessToken && authState.refreshToken && authState.expiresAt) {
|
|
57
|
+
client.setTokens(
|
|
58
|
+
authState.accessToken,
|
|
59
|
+
authState.refreshToken,
|
|
60
|
+
authState.expiresAt
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const accounts = await provider.request({
|
|
64
|
+
method: "eth_requestAccounts"
|
|
65
|
+
});
|
|
66
|
+
let currentChainId = await provider.request({
|
|
67
|
+
method: "eth_chainId"
|
|
68
|
+
});
|
|
69
|
+
const currentChainIdNumber = Number(currentChainId);
|
|
70
|
+
const isChainSupported = wagmiConfig.chains.some(
|
|
71
|
+
(c) => c.id === currentChainIdNumber
|
|
72
|
+
);
|
|
73
|
+
if (!isChainSupported && wagmiConfig.chains.length > 0) {
|
|
74
|
+
const fallbackChainId = wagmiConfig.chains[0].id;
|
|
75
|
+
await provider.request({
|
|
76
|
+
method: "wallet_switchEthereumChain",
|
|
77
|
+
params: [{ chainId: `0x${fallbackChainId.toString(16)}` }]
|
|
78
|
+
});
|
|
79
|
+
currentChainId = `0x${fallbackChainId.toString(16)}`;
|
|
80
|
+
if (authState.wallet) {
|
|
81
|
+
authState.wallet.chainId = fallbackChainId;
|
|
82
|
+
saveAuthState(authState);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (accountsChangedHandler) {
|
|
86
|
+
provider.removeListener("accountsChanged", accountsChangedHandler);
|
|
87
|
+
}
|
|
88
|
+
accountsChangedHandler = (accounts2) => {
|
|
89
|
+
wagmiConfig.emitter.emit("change", {
|
|
90
|
+
accounts: accounts2
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
provider.on("accountsChanged", accountsChangedHandler);
|
|
94
|
+
if (chainChangedHandler) {
|
|
95
|
+
provider.removeListener("chainChanged", chainChangedHandler);
|
|
96
|
+
}
|
|
97
|
+
chainChangedHandler = (chainId) => {
|
|
98
|
+
wagmiConfig.emitter.emit("change", {
|
|
99
|
+
chainId: Number(chainId)
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
provider.on("chainChanged", chainChangedHandler);
|
|
103
|
+
if (disconnectHandler) {
|
|
104
|
+
provider.removeListener("disconnect", disconnectHandler);
|
|
105
|
+
}
|
|
106
|
+
disconnectHandler = () => {
|
|
107
|
+
wagmiConfig.emitter.emit("disconnect");
|
|
108
|
+
this.onDisconnect();
|
|
109
|
+
};
|
|
110
|
+
provider.on("disconnect", disconnectHandler);
|
|
111
|
+
wagmiConfig.emitter.emit("connect", {
|
|
112
|
+
accounts,
|
|
113
|
+
chainId: Number(currentChainId)
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
accounts,
|
|
117
|
+
chainId: Number(currentChainId)
|
|
118
|
+
};
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error("\u274C ABC Connector connect() failed:", {
|
|
121
|
+
message: error.message,
|
|
122
|
+
code: error.code,
|
|
123
|
+
error
|
|
124
|
+
});
|
|
125
|
+
if (error.message === "ABC_LOGIN_REQUIRED") {
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* Disconnect wallet
|
|
133
|
+
*/
|
|
134
|
+
async disconnect() {
|
|
135
|
+
if (accountsChangedHandler) {
|
|
136
|
+
provider.removeListener("accountsChanged", accountsChangedHandler);
|
|
137
|
+
accountsChangedHandler = void 0;
|
|
138
|
+
}
|
|
139
|
+
if (chainChangedHandler) {
|
|
140
|
+
provider.removeListener("chainChanged", chainChangedHandler);
|
|
141
|
+
chainChangedHandler = void 0;
|
|
142
|
+
}
|
|
143
|
+
if (disconnectHandler) {
|
|
144
|
+
provider.removeListener("disconnect", disconnectHandler);
|
|
145
|
+
disconnectHandler = void 0;
|
|
146
|
+
}
|
|
147
|
+
provider.clearWallet();
|
|
148
|
+
await client.logout();
|
|
149
|
+
let savedPinHash = null;
|
|
150
|
+
let savedEmail = null;
|
|
151
|
+
if (typeof window !== "undefined") {
|
|
152
|
+
savedPinHash = localStorage.getItem("talkenkit_abc_pin_hash");
|
|
153
|
+
savedEmail = localStorage.getItem("talkenkit_abc_saved_email");
|
|
154
|
+
}
|
|
155
|
+
clearAuthState();
|
|
156
|
+
clearEncryptedTokens();
|
|
157
|
+
if (typeof window !== "undefined") {
|
|
158
|
+
localStorage.removeItem("talkenkit_abc_enc_salt");
|
|
159
|
+
localStorage.removeItem("talkenkit_abc_enc_tokens");
|
|
160
|
+
if (savedPinHash) {
|
|
161
|
+
localStorage.setItem("talkenkit_abc_pin_hash", savedPinHash);
|
|
162
|
+
}
|
|
163
|
+
if (savedEmail) {
|
|
164
|
+
localStorage.setItem("talkenkit_abc_saved_email", savedEmail);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* Get accounts
|
|
170
|
+
*/
|
|
171
|
+
async getAccounts() {
|
|
172
|
+
const accounts = await provider.request({
|
|
173
|
+
method: "eth_accounts"
|
|
174
|
+
});
|
|
175
|
+
return accounts.map((account) => account);
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* Get chain ID
|
|
179
|
+
*/
|
|
180
|
+
async getChainId() {
|
|
181
|
+
const chainId = await provider.request({
|
|
182
|
+
method: "eth_chainId"
|
|
183
|
+
});
|
|
184
|
+
return Number(chainId);
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* Get provider
|
|
188
|
+
*/
|
|
189
|
+
async getProvider() {
|
|
190
|
+
return provider;
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* Check if authorized (has valid session)
|
|
194
|
+
* Auto-refreshes access token if expired but refresh token is valid
|
|
195
|
+
*/
|
|
196
|
+
async isAuthorized() {
|
|
197
|
+
try {
|
|
198
|
+
const authState = loadAuthState();
|
|
199
|
+
if (!authState || !authState.isAuthenticated) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
if (!authState.wallet) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
if (client.isAuthenticated()) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
const refreshToken = loadFromStorage(
|
|
209
|
+
"refresh_token" /* REFRESH_TOKEN */
|
|
210
|
+
);
|
|
211
|
+
if (!refreshToken) {
|
|
212
|
+
clearStorage();
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
try {
|
|
216
|
+
const api = getTalkenApiClient();
|
|
217
|
+
if (!api) {
|
|
218
|
+
clearStorage();
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
const res = await api.auth.refresh();
|
|
222
|
+
client.setTokens(
|
|
223
|
+
res.accessToken,
|
|
224
|
+
res.refreshToken,
|
|
225
|
+
Date.now() + res.expiresIn * 1e3
|
|
226
|
+
);
|
|
227
|
+
const updatedState = loadAuthState();
|
|
228
|
+
return updatedState?.isAuthenticated ?? false;
|
|
229
|
+
} catch (error) {
|
|
230
|
+
console.error("[AbcConnector] Token refresh failed:", error);
|
|
231
|
+
clearStorage();
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
} catch (error) {
|
|
235
|
+
console.error(
|
|
236
|
+
"[AbcConnector] Unexpected error in isAuthorized:",
|
|
237
|
+
error
|
|
238
|
+
);
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
/**
|
|
243
|
+
* Switch chain
|
|
244
|
+
*/
|
|
245
|
+
async switchChain({ chainId }) {
|
|
246
|
+
await provider.request({
|
|
247
|
+
method: "wallet_switchEthereumChain",
|
|
248
|
+
params: [{ chainId: `0x${chainId.toString(16)}` }]
|
|
249
|
+
});
|
|
250
|
+
const newChainId = await this.getChainId();
|
|
251
|
+
const authState = loadAuthState();
|
|
252
|
+
if (authState?.wallet) {
|
|
253
|
+
authState.wallet.chainId = newChainId;
|
|
254
|
+
saveAuthState(authState);
|
|
255
|
+
}
|
|
256
|
+
return wagmiConfig.chains.find((x) => x.id === chainId) ?? {
|
|
257
|
+
id: chainId,
|
|
258
|
+
name: `Chain ${chainId}`,
|
|
259
|
+
nativeCurrency: {
|
|
260
|
+
name: "Ether",
|
|
261
|
+
decimals: 18,
|
|
262
|
+
symbol: "ETH"
|
|
263
|
+
},
|
|
264
|
+
rpcUrls: {
|
|
265
|
+
default: { http: [""] }
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
/**
|
|
270
|
+
* Handle accounts changed
|
|
271
|
+
*/
|
|
272
|
+
onAccountsChanged(accounts) {
|
|
273
|
+
if (accounts.length === 0) {
|
|
274
|
+
this.onDisconnect();
|
|
275
|
+
} else {
|
|
276
|
+
wagmiConfig.emitter.emit("change", {
|
|
277
|
+
accounts
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
/**
|
|
282
|
+
* Handle chain changed
|
|
283
|
+
*/
|
|
284
|
+
onChainChanged(chain) {
|
|
285
|
+
const chainId = Number(chain);
|
|
286
|
+
wagmiConfig.emitter.emit("change", { chainId });
|
|
287
|
+
},
|
|
288
|
+
/**
|
|
289
|
+
* Handle disconnect
|
|
290
|
+
*/
|
|
291
|
+
onDisconnect(_error) {
|
|
292
|
+
provider.clearWallet();
|
|
293
|
+
clearAuthState();
|
|
294
|
+
wagmiConfig.emitter.emit("disconnect");
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export {
|
|
301
|
+
abcConnector
|
|
302
|
+
};
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
createAbcEvmProvider
|
|
4
|
+
} from "./chunk-F5C6OZYF.js";
|
|
5
|
+
import {
|
|
6
|
+
setGlobalDefaultBitcoinNetwork,
|
|
7
|
+
setGlobalDefaultChainId,
|
|
8
|
+
setGlobalDefaultSolanaNetwork
|
|
9
|
+
} from "./chunk-O4AU63LK.js";
|
|
10
|
+
import {
|
|
11
|
+
createAbcWaasClient
|
|
12
|
+
} from "./chunk-BDM7TUVM.js";
|
|
13
|
+
import {
|
|
14
|
+
clearAuthState,
|
|
15
|
+
clearEncryptedTokens,
|
|
16
|
+
clearStorage,
|
|
17
|
+
loadAuthState,
|
|
18
|
+
loadFromStorage,
|
|
19
|
+
saveAuthState
|
|
20
|
+
} from "./chunk-6LH6ZME2.js";
|
|
21
|
+
|
|
22
|
+
// src/wallets/walletConnectors/abcWallet/abcConnector.ts
|
|
23
|
+
import { getTalkenApiClient } from "@talken/talkenkit";
|
|
24
|
+
import { createConnector } from "wagmi";
|
|
25
|
+
function abcConnector(options) {
|
|
26
|
+
const { config } = options;
|
|
27
|
+
if (config.defaultChainId) {
|
|
28
|
+
setGlobalDefaultChainId(config.defaultChainId);
|
|
29
|
+
}
|
|
30
|
+
if (config.defaultSolanaNetwork) {
|
|
31
|
+
setGlobalDefaultSolanaNetwork(config.defaultSolanaNetwork);
|
|
32
|
+
}
|
|
33
|
+
if (config.defaultBitcoinNetwork) {
|
|
34
|
+
setGlobalDefaultBitcoinNetwork(config.defaultBitcoinNetwork);
|
|
35
|
+
}
|
|
36
|
+
return createConnector((wagmiConfig) => {
|
|
37
|
+
const client = createAbcWaasClient(config);
|
|
38
|
+
const provider = createAbcEvmProvider(client);
|
|
39
|
+
let accountsChangedHandler;
|
|
40
|
+
let chainChangedHandler;
|
|
41
|
+
let disconnectHandler;
|
|
42
|
+
return {
|
|
43
|
+
id: "abc",
|
|
44
|
+
name: "ABC Wallet",
|
|
45
|
+
type: "abc",
|
|
46
|
+
/**
|
|
47
|
+
* Connect wallet
|
|
48
|
+
*/
|
|
49
|
+
async connect() {
|
|
50
|
+
try {
|
|
51
|
+
const authState = loadAuthState();
|
|
52
|
+
if (!authState || !authState.isAuthenticated || !authState.wallet) {
|
|
53
|
+
throw new Error("ABC_LOGIN_REQUIRED");
|
|
54
|
+
}
|
|
55
|
+
provider.setWallet(authState.wallet);
|
|
56
|
+
if (authState.accessToken && authState.refreshToken && authState.expiresAt) {
|
|
57
|
+
client.setTokens(
|
|
58
|
+
authState.accessToken,
|
|
59
|
+
authState.refreshToken,
|
|
60
|
+
authState.expiresAt
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const accounts = await provider.request({
|
|
64
|
+
method: "eth_requestAccounts"
|
|
65
|
+
});
|
|
66
|
+
let currentChainId = await provider.request({
|
|
67
|
+
method: "eth_chainId"
|
|
68
|
+
});
|
|
69
|
+
const currentChainIdNumber = Number(currentChainId);
|
|
70
|
+
const isChainSupported = wagmiConfig.chains.some(
|
|
71
|
+
(c) => c.id === currentChainIdNumber
|
|
72
|
+
);
|
|
73
|
+
if (!isChainSupported && wagmiConfig.chains.length > 0) {
|
|
74
|
+
const fallbackChainId = wagmiConfig.chains[0].id;
|
|
75
|
+
await provider.request({
|
|
76
|
+
method: "wallet_switchEthereumChain",
|
|
77
|
+
params: [{ chainId: `0x${fallbackChainId.toString(16)}` }]
|
|
78
|
+
});
|
|
79
|
+
currentChainId = `0x${fallbackChainId.toString(16)}`;
|
|
80
|
+
if (authState.wallet) {
|
|
81
|
+
authState.wallet.chainId = fallbackChainId;
|
|
82
|
+
saveAuthState(authState);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (accountsChangedHandler) {
|
|
86
|
+
provider.removeListener("accountsChanged", accountsChangedHandler);
|
|
87
|
+
}
|
|
88
|
+
accountsChangedHandler = (accounts2) => {
|
|
89
|
+
wagmiConfig.emitter.emit("change", {
|
|
90
|
+
accounts: accounts2
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
provider.on("accountsChanged", accountsChangedHandler);
|
|
94
|
+
if (chainChangedHandler) {
|
|
95
|
+
provider.removeListener("chainChanged", chainChangedHandler);
|
|
96
|
+
}
|
|
97
|
+
chainChangedHandler = (chainId) => {
|
|
98
|
+
wagmiConfig.emitter.emit("change", {
|
|
99
|
+
chainId: Number(chainId)
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
provider.on("chainChanged", chainChangedHandler);
|
|
103
|
+
if (disconnectHandler) {
|
|
104
|
+
provider.removeListener("disconnect", disconnectHandler);
|
|
105
|
+
}
|
|
106
|
+
disconnectHandler = () => {
|
|
107
|
+
wagmiConfig.emitter.emit("disconnect");
|
|
108
|
+
this.onDisconnect();
|
|
109
|
+
};
|
|
110
|
+
provider.on("disconnect", disconnectHandler);
|
|
111
|
+
wagmiConfig.emitter.emit("connect", {
|
|
112
|
+
accounts,
|
|
113
|
+
chainId: Number(currentChainId)
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
accounts,
|
|
117
|
+
chainId: Number(currentChainId)
|
|
118
|
+
};
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error("\u274C ABC Connector connect() failed:", {
|
|
121
|
+
message: error.message,
|
|
122
|
+
code: error.code,
|
|
123
|
+
error
|
|
124
|
+
});
|
|
125
|
+
if (error.message === "ABC_LOGIN_REQUIRED") {
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* Disconnect wallet
|
|
133
|
+
*/
|
|
134
|
+
async disconnect() {
|
|
135
|
+
if (accountsChangedHandler) {
|
|
136
|
+
provider.removeListener("accountsChanged", accountsChangedHandler);
|
|
137
|
+
accountsChangedHandler = void 0;
|
|
138
|
+
}
|
|
139
|
+
if (chainChangedHandler) {
|
|
140
|
+
provider.removeListener("chainChanged", chainChangedHandler);
|
|
141
|
+
chainChangedHandler = void 0;
|
|
142
|
+
}
|
|
143
|
+
if (disconnectHandler) {
|
|
144
|
+
provider.removeListener("disconnect", disconnectHandler);
|
|
145
|
+
disconnectHandler = void 0;
|
|
146
|
+
}
|
|
147
|
+
provider.clearWallet();
|
|
148
|
+
await client.logout();
|
|
149
|
+
let savedPinHash = null;
|
|
150
|
+
let savedEmail = null;
|
|
151
|
+
if (typeof window !== "undefined") {
|
|
152
|
+
savedPinHash = localStorage.getItem("talkenkit_abc_pin_hash");
|
|
153
|
+
savedEmail = localStorage.getItem("talkenkit_abc_saved_email");
|
|
154
|
+
}
|
|
155
|
+
clearAuthState();
|
|
156
|
+
clearEncryptedTokens();
|
|
157
|
+
if (typeof window !== "undefined") {
|
|
158
|
+
localStorage.removeItem("talkenkit_abc_enc_salt");
|
|
159
|
+
localStorage.removeItem("talkenkit_abc_enc_tokens");
|
|
160
|
+
if (savedPinHash) {
|
|
161
|
+
localStorage.setItem("talkenkit_abc_pin_hash", savedPinHash);
|
|
162
|
+
}
|
|
163
|
+
if (savedEmail) {
|
|
164
|
+
localStorage.setItem("talkenkit_abc_saved_email", savedEmail);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* Get accounts
|
|
170
|
+
*/
|
|
171
|
+
async getAccounts() {
|
|
172
|
+
const accounts = await provider.request({
|
|
173
|
+
method: "eth_accounts"
|
|
174
|
+
});
|
|
175
|
+
return accounts.map((account) => account);
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* Get chain ID
|
|
179
|
+
*/
|
|
180
|
+
async getChainId() {
|
|
181
|
+
const chainId = await provider.request({
|
|
182
|
+
method: "eth_chainId"
|
|
183
|
+
});
|
|
184
|
+
return Number(chainId);
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* Get provider
|
|
188
|
+
*/
|
|
189
|
+
async getProvider() {
|
|
190
|
+
return provider;
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* Check if authorized (has valid session)
|
|
194
|
+
* Auto-refreshes access token if expired but refresh token is valid
|
|
195
|
+
*/
|
|
196
|
+
async isAuthorized() {
|
|
197
|
+
try {
|
|
198
|
+
const authState = loadAuthState();
|
|
199
|
+
if (!authState || !authState.isAuthenticated) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
if (!authState.wallet) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
if (client.isAuthenticated()) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
const refreshToken = loadFromStorage(
|
|
209
|
+
"refresh_token" /* REFRESH_TOKEN */
|
|
210
|
+
);
|
|
211
|
+
if (!refreshToken) {
|
|
212
|
+
clearStorage();
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
try {
|
|
216
|
+
const api = getTalkenApiClient();
|
|
217
|
+
if (!api) {
|
|
218
|
+
clearStorage();
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
const res = await api.auth.refresh();
|
|
222
|
+
client.setTokens(
|
|
223
|
+
res.accessToken,
|
|
224
|
+
res.refreshToken,
|
|
225
|
+
Date.now() + res.expiresIn * 1e3
|
|
226
|
+
);
|
|
227
|
+
const updatedState = loadAuthState();
|
|
228
|
+
return updatedState?.isAuthenticated ?? false;
|
|
229
|
+
} catch (error) {
|
|
230
|
+
console.error("[AbcConnector] Token refresh failed:", error);
|
|
231
|
+
clearStorage();
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
} catch (error) {
|
|
235
|
+
console.error(
|
|
236
|
+
"[AbcConnector] Unexpected error in isAuthorized:",
|
|
237
|
+
error
|
|
238
|
+
);
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
/**
|
|
243
|
+
* Switch chain
|
|
244
|
+
*/
|
|
245
|
+
async switchChain({ chainId }) {
|
|
246
|
+
await provider.request({
|
|
247
|
+
method: "wallet_switchEthereumChain",
|
|
248
|
+
params: [{ chainId: `0x${chainId.toString(16)}` }]
|
|
249
|
+
});
|
|
250
|
+
const newChainId = await this.getChainId();
|
|
251
|
+
const authState = loadAuthState();
|
|
252
|
+
if (authState?.wallet) {
|
|
253
|
+
authState.wallet.chainId = newChainId;
|
|
254
|
+
saveAuthState(authState);
|
|
255
|
+
}
|
|
256
|
+
return wagmiConfig.chains.find((x) => x.id === chainId) ?? {
|
|
257
|
+
id: chainId,
|
|
258
|
+
name: `Chain ${chainId}`,
|
|
259
|
+
nativeCurrency: {
|
|
260
|
+
name: "Ether",
|
|
261
|
+
decimals: 18,
|
|
262
|
+
symbol: "ETH"
|
|
263
|
+
},
|
|
264
|
+
rpcUrls: {
|
|
265
|
+
default: { http: [""] }
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
/**
|
|
270
|
+
* Handle accounts changed
|
|
271
|
+
*/
|
|
272
|
+
onAccountsChanged(accounts) {
|
|
273
|
+
if (accounts.length === 0) {
|
|
274
|
+
this.onDisconnect();
|
|
275
|
+
} else {
|
|
276
|
+
wagmiConfig.emitter.emit("change", {
|
|
277
|
+
accounts
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
/**
|
|
282
|
+
* Handle chain changed
|
|
283
|
+
*/
|
|
284
|
+
onChainChanged(chain) {
|
|
285
|
+
const chainId = Number(chain);
|
|
286
|
+
wagmiConfig.emitter.emit("change", { chainId });
|
|
287
|
+
},
|
|
288
|
+
/**
|
|
289
|
+
* Handle disconnect
|
|
290
|
+
*/
|
|
291
|
+
onDisconnect(_error) {
|
|
292
|
+
provider.clearWallet();
|
|
293
|
+
clearAuthState();
|
|
294
|
+
wagmiConfig.emitter.emit("disconnect");
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export {
|
|
301
|
+
abcConnector
|
|
302
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
TronApi
|
|
4
|
+
} from "./chunk-RS36ZX4P.js";
|
|
5
|
+
import {
|
|
6
|
+
TransactionApi
|
|
7
|
+
} from "./chunk-NBEDPUHX.js";
|
|
8
|
+
import {
|
|
9
|
+
WalletApi
|
|
10
|
+
} from "./chunk-QHCLOJYA.js";
|
|
11
|
+
import {
|
|
12
|
+
WalletscanApi
|
|
13
|
+
} from "./chunk-7MDXHYMB.js";
|
|
14
|
+
import {
|
|
15
|
+
BitcoinApi
|
|
16
|
+
} from "./chunk-CPAYLZZL.js";
|
|
17
|
+
import {
|
|
18
|
+
GasApi
|
|
19
|
+
} from "./chunk-IX6DQDRE.js";
|
|
20
|
+
import {
|
|
21
|
+
AuthApi
|
|
22
|
+
} from "./chunk-O47OQDRJ.js";
|
|
23
|
+
import {
|
|
24
|
+
SolanaApi
|
|
25
|
+
} from "./chunk-C4L5XI6N.js";
|
|
26
|
+
|
|
27
|
+
// src/wallets/walletConnectors/abcWallet/api/index.ts
|
|
28
|
+
var AbcWaasApiClient = class {
|
|
29
|
+
constructor(config) {
|
|
30
|
+
this.auth = new AuthApi(config);
|
|
31
|
+
this.wallet = new WalletApi(config);
|
|
32
|
+
this.transaction = new TransactionApi(config);
|
|
33
|
+
this.solana = new SolanaApi(config);
|
|
34
|
+
this.bitcoin = new BitcoinApi(config);
|
|
35
|
+
this.tron = new TronApi(config);
|
|
36
|
+
this.walletscan = new WalletscanApi(config);
|
|
37
|
+
this.gas = new GasApi(config);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check if user is authenticated
|
|
41
|
+
*/
|
|
42
|
+
isAuthenticated() {
|
|
43
|
+
return this.auth.isAuthenticated();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check if access token is expired
|
|
47
|
+
*/
|
|
48
|
+
isTokenExpired() {
|
|
49
|
+
return this.auth.isTokenExpired();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get current access token
|
|
53
|
+
*/
|
|
54
|
+
getAccessToken() {
|
|
55
|
+
return this.auth.getAccessToken();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Logout (clear tokens)
|
|
59
|
+
*/
|
|
60
|
+
async logout() {
|
|
61
|
+
await this.auth.logout();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function createAbcWaasApiClient(config) {
|
|
65
|
+
return new AbcWaasApiClient(config);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
AbcWaasApiClient,
|
|
70
|
+
createAbcWaasApiClient
|
|
71
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
createTalkenApiClient
|
|
4
|
+
} from "./chunk-BBD77PEX.js";
|
|
5
|
+
import {
|
|
6
|
+
abcConnector
|
|
7
|
+
} from "./chunk-EAKU7HN4.js";
|
|
8
|
+
import {
|
|
9
|
+
ABC_WALLET_METADATA
|
|
10
|
+
} from "./chunk-DHHVIM22.js";
|
|
11
|
+
|
|
12
|
+
// src/wallets/walletConnectors/abcWallet/abcWallet.ts
|
|
13
|
+
import { setTalkenApiClient } from "@talken/talkenkit";
|
|
14
|
+
var abcWallet = (specificOptions) => ({ projectId }) => {
|
|
15
|
+
const talkenApiUrl = specificOptions?.talkenApiUrl || process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001/api/v1";
|
|
16
|
+
const talkenApi = createTalkenApiClient({
|
|
17
|
+
baseUrl: talkenApiUrl,
|
|
18
|
+
debug: specificOptions?.environment === "development"
|
|
19
|
+
});
|
|
20
|
+
setTalkenApiClient(talkenApi);
|
|
21
|
+
const waasUrl = specificOptions?.waasUrl || process.env.NEXT_PUBLIC_ABC_WAAS_URL || process.env.VITE_ABC_WAAS_URL || "";
|
|
22
|
+
const config = {
|
|
23
|
+
waasUrl,
|
|
24
|
+
apiKey: specificOptions?.apiKey,
|
|
25
|
+
plain: specificOptions?.plain || "",
|
|
26
|
+
// Deprecated - not used (secure.ts uses random generation)
|
|
27
|
+
environment: specificOptions?.environment || "development",
|
|
28
|
+
defaultChainId: specificOptions?.defaultChainId,
|
|
29
|
+
defaultSolanaNetwork: specificOptions?.defaultSolanaNetwork,
|
|
30
|
+
defaultBitcoinNetwork: specificOptions?.defaultBitcoinNetwork,
|
|
31
|
+
projectId
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
id: ABC_WALLET_METADATA.id,
|
|
35
|
+
name: ABC_WALLET_METADATA.name,
|
|
36
|
+
rdns: ABC_WALLET_METADATA.rdns,
|
|
37
|
+
iconUrl: async () => (await import("./abcWallet-AYWSIGAG.js")).default,
|
|
38
|
+
iconBackground: ABC_WALLET_METADATA.iconBackground,
|
|
39
|
+
// Embedded wallet - no installation required
|
|
40
|
+
installed: void 0,
|
|
41
|
+
// No download URLs for embedded wallet
|
|
42
|
+
downloadUrls: void 0,
|
|
43
|
+
// Create connector - wrapper function required by Wallet type
|
|
44
|
+
createConnector: (_walletDetails) => abcConnector({ config }),
|
|
45
|
+
// Embedded wallet always available
|
|
46
|
+
hidden: () => false
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
abcWallet
|
|
52
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
TronApi
|
|
4
|
+
} from "./chunk-RS36ZX4P.js";
|
|
5
|
+
import {
|
|
6
|
+
TransactionApi
|
|
7
|
+
} from "./chunk-NBEDPUHX.js";
|
|
8
|
+
import {
|
|
9
|
+
WalletApi
|
|
10
|
+
} from "./chunk-QHCLOJYA.js";
|
|
11
|
+
import {
|
|
12
|
+
WalletscanApi
|
|
13
|
+
} from "./chunk-7MDXHYMB.js";
|
|
14
|
+
import {
|
|
15
|
+
AuthApi
|
|
16
|
+
} from "./chunk-O47OQDRJ.js";
|
|
17
|
+
import {
|
|
18
|
+
BitcoinApi
|
|
19
|
+
} from "./chunk-CPAYLZZL.js";
|
|
20
|
+
import {
|
|
21
|
+
GasApi
|
|
22
|
+
} from "./chunk-IX6DQDRE.js";
|
|
23
|
+
import {
|
|
24
|
+
SolanaApi
|
|
25
|
+
} from "./chunk-C4L5XI6N.js";
|
|
26
|
+
|
|
27
|
+
// src/wallets/walletConnectors/abcWallet/api/index.ts
|
|
28
|
+
var AbcWaasApiClient = class {
|
|
29
|
+
constructor(config) {
|
|
30
|
+
this.auth = new AuthApi(config);
|
|
31
|
+
this.wallet = new WalletApi(config);
|
|
32
|
+
this.transaction = new TransactionApi(config);
|
|
33
|
+
this.solana = new SolanaApi(config);
|
|
34
|
+
this.bitcoin = new BitcoinApi(config);
|
|
35
|
+
this.tron = new TronApi(config);
|
|
36
|
+
this.walletscan = new WalletscanApi(config);
|
|
37
|
+
this.gas = new GasApi(config);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check if user is authenticated
|
|
41
|
+
*/
|
|
42
|
+
isAuthenticated() {
|
|
43
|
+
return this.auth.isAuthenticated();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check if access token is expired
|
|
47
|
+
*/
|
|
48
|
+
isTokenExpired() {
|
|
49
|
+
return this.auth.isTokenExpired();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get current access token
|
|
53
|
+
*/
|
|
54
|
+
getAccessToken() {
|
|
55
|
+
return this.auth.getAccessToken();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Logout (clear tokens)
|
|
59
|
+
*/
|
|
60
|
+
async logout() {
|
|
61
|
+
await this.auth.logout();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function createAbcWaasApiClient(config) {
|
|
65
|
+
return new AbcWaasApiClient(config);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
AbcWaasApiClient,
|
|
70
|
+
createAbcWaasApiClient
|
|
71
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
WalletApi
|
|
4
|
+
} from "./chunk-QHCLOJYA.js";
|
|
5
|
+
import {
|
|
6
|
+
WalletscanApi
|
|
7
|
+
} from "./chunk-7MDXHYMB.js";
|
|
8
|
+
import {
|
|
9
|
+
TronApi
|
|
10
|
+
} from "./chunk-RS36ZX4P.js";
|
|
11
|
+
import {
|
|
12
|
+
TransactionApi
|
|
13
|
+
} from "./chunk-NBEDPUHX.js";
|
|
14
|
+
import {
|
|
15
|
+
AuthApi
|
|
16
|
+
} from "./chunk-O47OQDRJ.js";
|
|
17
|
+
import {
|
|
18
|
+
BitcoinApi
|
|
19
|
+
} from "./chunk-CPAYLZZL.js";
|
|
20
|
+
import {
|
|
21
|
+
GasApi
|
|
22
|
+
} from "./chunk-IX6DQDRE.js";
|
|
23
|
+
import {
|
|
24
|
+
SolanaApi
|
|
25
|
+
} from "./chunk-C4L5XI6N.js";
|
|
26
|
+
|
|
27
|
+
// src/wallets/walletConnectors/abcWallet/api/index.ts
|
|
28
|
+
var AbcWaasApiClient = class {
|
|
29
|
+
constructor(config) {
|
|
30
|
+
this.auth = new AuthApi(config);
|
|
31
|
+
this.wallet = new WalletApi(config);
|
|
32
|
+
this.transaction = new TransactionApi(config);
|
|
33
|
+
this.solana = new SolanaApi(config);
|
|
34
|
+
this.bitcoin = new BitcoinApi(config);
|
|
35
|
+
this.tron = new TronApi(config);
|
|
36
|
+
this.walletscan = new WalletscanApi(config);
|
|
37
|
+
this.gas = new GasApi(config);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check if user is authenticated
|
|
41
|
+
*/
|
|
42
|
+
isAuthenticated() {
|
|
43
|
+
return this.auth.isAuthenticated();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check if access token is expired
|
|
47
|
+
*/
|
|
48
|
+
isTokenExpired() {
|
|
49
|
+
return this.auth.isTokenExpired();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get current access token
|
|
53
|
+
*/
|
|
54
|
+
getAccessToken() {
|
|
55
|
+
return this.auth.getAccessToken();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Logout (clear tokens)
|
|
59
|
+
*/
|
|
60
|
+
async logout() {
|
|
61
|
+
await this.auth.logout();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function createAbcWaasApiClient(config) {
|
|
65
|
+
return new AbcWaasApiClient(config);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
AbcWaasApiClient,
|
|
70
|
+
createAbcWaasApiClient
|
|
71
|
+
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
abcWallet
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZAZVSLZK.js";
|
|
5
5
|
import "./chunk-BBD77PEX.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-MEAJDFYT.js";
|
|
7
|
+
import "./chunk-F5C6OZYF.js";
|
|
7
8
|
import "./chunk-BDM7TUVM.js";
|
|
8
9
|
import "./chunk-O4AU63LK.js";
|
|
9
|
-
import "./chunk-F5C6OZYF.js";
|
|
10
10
|
import "./chunk-7QHCSJDN.js";
|
|
11
11
|
import "./chunk-6LH6ZME2.js";
|
|
12
12
|
import "./chunk-D5EFTEOM.js";
|
|
13
13
|
import "./chunk-DHHVIM22.js";
|
|
14
14
|
import {
|
|
15
|
-
|
|
16
|
-
} from "./chunk-
|
|
15
|
+
trustWallet
|
|
16
|
+
} from "./chunk-EM6BREIH.js";
|
|
17
17
|
import {
|
|
18
18
|
uniswapWallet
|
|
19
19
|
} from "./chunk-DLDZUVTB.js";
|
|
20
|
-
import {
|
|
21
|
-
valoraWallet
|
|
22
|
-
} from "./chunk-CVUEWUDI.js";
|
|
23
20
|
import {
|
|
24
21
|
walletConnectWallet
|
|
25
22
|
} from "./chunk-KU5R3WAJ.js";
|
|
26
23
|
import {
|
|
27
24
|
wigwamWallet
|
|
28
25
|
} from "./chunk-EFYKBPOB.js";
|
|
26
|
+
import {
|
|
27
|
+
valoraWallet
|
|
28
|
+
} from "./chunk-CVUEWUDI.js";
|
|
29
29
|
import {
|
|
30
30
|
xdefiWallet
|
|
31
31
|
} from "./chunk-26RJNF7V.js";
|
|
@@ -57,8 +57,8 @@ import {
|
|
|
57
57
|
tokenPocketWallet
|
|
58
58
|
} from "./chunk-RCZCJUTR.js";
|
|
59
59
|
import {
|
|
60
|
-
|
|
61
|
-
} from "./chunk-
|
|
60
|
+
tokenaryWallet
|
|
61
|
+
} from "./chunk-U24COF36.js";
|
|
62
62
|
import {
|
|
63
63
|
oneKeyWallet
|
|
64
64
|
} from "./chunk-6UGYPEQE.js";
|
|
@@ -83,18 +83,18 @@ import {
|
|
|
83
83
|
import {
|
|
84
84
|
safeWallet
|
|
85
85
|
} from "./chunk-Z2QCE6O6.js";
|
|
86
|
-
import {
|
|
87
|
-
magicEdenWallet
|
|
88
|
-
} from "./chunk-WB7EEKPS.js";
|
|
89
86
|
import {
|
|
90
87
|
metaMaskWallet
|
|
91
88
|
} from "./chunk-VUMT22HL.js";
|
|
92
89
|
import {
|
|
93
|
-
|
|
94
|
-
} from "./chunk-
|
|
90
|
+
magicEdenWallet
|
|
91
|
+
} from "./chunk-WB7EEKPS.js";
|
|
95
92
|
import {
|
|
96
93
|
nestWallet
|
|
97
94
|
} from "./chunk-NN4KGG3I.js";
|
|
95
|
+
import {
|
|
96
|
+
mewWallet
|
|
97
|
+
} from "./chunk-ZRY6ILYP.js";
|
|
98
98
|
import {
|
|
99
99
|
oktoWallet
|
|
100
100
|
} from "./chunk-7SSXG35M.js";
|
|
@@ -110,9 +110,6 @@ import {
|
|
|
110
110
|
import {
|
|
111
111
|
imTokenWallet
|
|
112
112
|
} from "./chunk-EHE2536P.js";
|
|
113
|
-
import {
|
|
114
|
-
injectedWallet
|
|
115
|
-
} from "./chunk-GDGRUMZB.js";
|
|
116
113
|
import {
|
|
117
114
|
iopayWallet
|
|
118
115
|
} from "./chunk-A2XAHJNR.js";
|
|
@@ -120,17 +117,20 @@ import {
|
|
|
120
117
|
kaiaWallet
|
|
121
118
|
} from "./chunk-KE6RMEB7.js";
|
|
122
119
|
import {
|
|
123
|
-
|
|
124
|
-
} from "./chunk-
|
|
120
|
+
injectedWallet
|
|
121
|
+
} from "./chunk-GDGRUMZB.js";
|
|
125
122
|
import {
|
|
126
123
|
kaikasWallet
|
|
127
124
|
} from "./chunk-MUJPEDFF.js";
|
|
128
125
|
import {
|
|
129
|
-
|
|
130
|
-
} from "./chunk-
|
|
126
|
+
krakenWallet
|
|
127
|
+
} from "./chunk-CYOZFCR6.js";
|
|
131
128
|
import {
|
|
132
129
|
ledgerWallet
|
|
133
130
|
} from "./chunk-BF3VSNPL.js";
|
|
131
|
+
import {
|
|
132
|
+
kresusWallet
|
|
133
|
+
} from "./chunk-CM3VR7OM.js";
|
|
134
134
|
import {
|
|
135
135
|
coreWallet
|
|
136
136
|
} from "./chunk-I6ONK6DO.js";
|
|
@@ -158,12 +158,12 @@ import {
|
|
|
158
158
|
import {
|
|
159
159
|
bitverseWallet
|
|
160
160
|
} from "./chunk-6HCSSBZY.js";
|
|
161
|
-
import {
|
|
162
|
-
braveWallet
|
|
163
|
-
} from "./chunk-EYN3CVFM.js";
|
|
164
161
|
import {
|
|
165
162
|
bloomWallet
|
|
166
163
|
} from "./chunk-3KPCADAF.js";
|
|
164
|
+
import {
|
|
165
|
+
braveWallet
|
|
166
|
+
} from "./chunk-EYN3CVFM.js";
|
|
167
167
|
import {
|
|
168
168
|
bybitWallet
|
|
169
169
|
} from "./chunk-DW37ROR6.js";
|
|
@@ -173,35 +173,35 @@ import {
|
|
|
173
173
|
import {
|
|
174
174
|
coin98Wallet
|
|
175
175
|
} from "./chunk-ZFVYS64S.js";
|
|
176
|
-
import {
|
|
177
|
-
coinbaseWallet
|
|
178
|
-
} from "./chunk-PNEDRY6O.js";
|
|
179
176
|
import {
|
|
180
177
|
compassWallet
|
|
181
178
|
} from "./chunk-3OO564GS.js";
|
|
179
|
+
import {
|
|
180
|
+
coinbaseWallet
|
|
181
|
+
} from "./chunk-PNEDRY6O.js";
|
|
182
182
|
import {
|
|
183
183
|
argentWallet
|
|
184
184
|
} from "./chunk-XT2WYPN5.js";
|
|
185
185
|
import {
|
|
186
186
|
bestWallet
|
|
187
187
|
} from "./chunk-OPAPBEA5.js";
|
|
188
|
-
import {
|
|
189
|
-
bifrostWallet
|
|
190
|
-
} from "./chunk-WXXI4WBF.js";
|
|
191
188
|
import {
|
|
192
189
|
berasigWallet
|
|
193
190
|
} from "./chunk-UZWMFUJU.js";
|
|
194
191
|
import {
|
|
195
|
-
|
|
196
|
-
} from "./chunk-
|
|
192
|
+
bifrostWallet
|
|
193
|
+
} from "./chunk-WXXI4WBF.js";
|
|
197
194
|
import {
|
|
198
195
|
bitgetWallet
|
|
199
196
|
} from "./chunk-ITLTDJ3D.js";
|
|
200
|
-
import "./chunk-RETKWSKD.js";
|
|
201
|
-
import "./chunk-PODFK4OS.js";
|
|
202
197
|
import {
|
|
203
198
|
bitskiWallet
|
|
204
199
|
} from "./chunk-DZB25PZ7.js";
|
|
200
|
+
import {
|
|
201
|
+
binanceWallet
|
|
202
|
+
} from "./chunk-TUDZHFVC.js";
|
|
203
|
+
import "./chunk-RETKWSKD.js";
|
|
204
|
+
import "./chunk-PODFK4OS.js";
|
|
205
205
|
import "./chunk-MBBGZGXF.js";
|
|
206
206
|
export {
|
|
207
207
|
abcWallet,
|