@talken/talkenkit 2.6.1 → 2.7.0
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/abcWallet-XBPHUTFQ.js +172 -0
- package/dist/chunk-D3AVQQJG.js +5703 -0
- package/dist/index.js +1 -1
- package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.d.ts +67 -0
- package/dist/wallets/walletConnectors/abcWallet/AbstractChainProvider.js +10 -0
- package/dist/wallets/walletConnectors/abcWallet/EventEmitter.d.ts +12 -0
- package/dist/wallets/walletConnectors/abcWallet/EventEmitter.js +7 -0
- package/dist/wallets/walletConnectors/abcWallet/ProviderError.d.ts +42 -0
- package/dist/wallets/walletConnectors/abcWallet/ProviderError.js +17 -0
- package/dist/wallets/walletConnectors/chunk-2KHTFKPP.js +186 -0
- package/dist/wallets/walletConnectors/chunk-34GT4R3A.js +501 -0
- package/dist/wallets/walletConnectors/chunk-3QC567QK.js +94 -0
- package/dist/wallets/walletConnectors/chunk-4666JD5V.js +333 -0
- package/dist/wallets/walletConnectors/chunk-4V3HRM2R.js +95 -0
- package/dist/wallets/walletConnectors/chunk-5QYCHHVB.js +98 -0
- package/dist/wallets/walletConnectors/chunk-5UITEZJU.js +121 -0
- package/dist/wallets/walletConnectors/chunk-7IBMHOYD.js +102 -0
- package/dist/wallets/walletConnectors/chunk-A2DZALFI.js +108 -0
- package/dist/wallets/walletConnectors/chunk-BZPKBSWY.js +66 -0
- package/dist/wallets/walletConnectors/chunk-CBKU2ERC.js +54 -0
- package/dist/wallets/walletConnectors/chunk-CEOJSQAI.js +66 -0
- package/dist/wallets/walletConnectors/chunk-DHWJ3552.js +93 -0
- package/dist/wallets/walletConnectors/chunk-EJALZNAR.js +101 -0
- package/dist/wallets/walletConnectors/chunk-FGYJTUYV.js +94 -0
- package/dist/wallets/walletConnectors/chunk-FVA6H2VF.js +95 -0
- package/dist/wallets/walletConnectors/chunk-GJ4CJL7F.js +57 -0
- package/dist/wallets/walletConnectors/chunk-HALTGRQW.js +87 -0
- package/dist/wallets/walletConnectors/chunk-HQO76VJR.js +1470 -0
- package/dist/wallets/walletConnectors/chunk-IL6T5D4L.js +362 -0
- package/dist/wallets/walletConnectors/chunk-IONL6LMJ.js +71 -0
- package/dist/wallets/walletConnectors/chunk-KBM7EYHR.js +58 -0
- package/dist/wallets/walletConnectors/chunk-KQDFRZT4.js +65 -0
- package/dist/wallets/walletConnectors/chunk-LBG7ZBQY.js +273 -0
- package/dist/wallets/walletConnectors/chunk-PAYYNMNP.js +347 -0
- package/dist/wallets/walletConnectors/chunk-PXL5G2PM.js +96 -0
- package/dist/wallets/walletConnectors/chunk-QB3QLNSL.js +76 -0
- package/dist/wallets/walletConnectors/chunk-QEDCPITY.js +344 -0
- package/dist/wallets/walletConnectors/chunk-QRU6XFHH.js +110 -0
- package/dist/wallets/walletConnectors/chunk-T6RB3SM7.js +73 -0
- package/dist/wallets/walletConnectors/chunk-TA4DDCKN.js +96 -0
- package/dist/wallets/walletConnectors/chunk-TWVKSPTP.js +91 -0
- package/dist/wallets/walletConnectors/chunk-V5LGED4F.js +103 -0
- package/dist/wallets/walletConnectors/chunk-VRI5ZALU.js +212 -0
- package/dist/wallets/walletConnectors/chunk-W5HMOCGP.js +18 -0
- package/dist/wallets/walletConnectors/chunk-XFCZU22I.js +58 -0
- package/dist/wallets/walletConnectors/chunk-XS6GJRRA.js +98 -0
- package/dist/wallets/walletConnectors/chunk-XSX5EECZ.js +96 -0
- package/dist/wallets/walletConnectors/index.js +34 -34
- package/package.json +1 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
isAndroid
|
|
4
|
+
} from "./chunk-RETKWSKD.js";
|
|
5
|
+
import {
|
|
6
|
+
getInjectedConnector,
|
|
7
|
+
hasInjectedProvider
|
|
8
|
+
} from "./chunk-PONHGUSY.js";
|
|
9
|
+
import {
|
|
10
|
+
getWalletConnectConnector
|
|
11
|
+
} from "./chunk-PODFK4OS.js";
|
|
12
|
+
|
|
13
|
+
// src/wallets/walletConnectors/binanceWallet/binanceWallet.ts
|
|
14
|
+
var binanceWallet = ({
|
|
15
|
+
projectId,
|
|
16
|
+
walletConnectParameters
|
|
17
|
+
}) => {
|
|
18
|
+
const isBinanceInjected = hasInjectedProvider({
|
|
19
|
+
flag: "isBinance"
|
|
20
|
+
});
|
|
21
|
+
const shouldUseWalletConnect = !isBinanceInjected;
|
|
22
|
+
return {
|
|
23
|
+
id: "binance",
|
|
24
|
+
name: "Binance Wallet",
|
|
25
|
+
rdns: "com.binance.wallet",
|
|
26
|
+
iconUrl: async () => (await import("./binanceWallet-BCWLBY3Q.js")).default,
|
|
27
|
+
iconBackground: "#000000",
|
|
28
|
+
installed: !shouldUseWalletConnect ? isBinanceInjected : void 0,
|
|
29
|
+
downloadUrls: {
|
|
30
|
+
android: "https://play.google.com/store/apps/details?id=com.binance.dev",
|
|
31
|
+
ios: "https://apps.apple.com/us/app/id1436799971",
|
|
32
|
+
mobile: "https://www.binance.com/en/download",
|
|
33
|
+
qrCode: "https://www.binance.com/en/web3wallet"
|
|
34
|
+
},
|
|
35
|
+
mobile: shouldUseWalletConnect ? {
|
|
36
|
+
getUri: (uri) => {
|
|
37
|
+
return isAndroid() ? uri : `bnc://app.binance.com/cedefi/wc?uri=${encodeURIComponent(
|
|
38
|
+
uri
|
|
39
|
+
)}`;
|
|
40
|
+
}
|
|
41
|
+
} : void 0,
|
|
42
|
+
qrCode: shouldUseWalletConnect ? {
|
|
43
|
+
getUri: (uri) => uri,
|
|
44
|
+
instructions: {
|
|
45
|
+
learnMoreUrl: "https://www.binance.com/en/web3wallet",
|
|
46
|
+
steps: [
|
|
47
|
+
{
|
|
48
|
+
description: "wallet_connectors.binance.qr_code.step1.description",
|
|
49
|
+
step: "install",
|
|
50
|
+
title: "wallet_connectors.binance.qr_code.step1.title"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
description: "wallet_connectors.binance.qr_code.step2.description",
|
|
54
|
+
step: "create",
|
|
55
|
+
title: "wallet_connectors.binance.qr_code.step2.title"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
description: "wallet_connectors.binance.qr_code.step3.description",
|
|
59
|
+
step: "scan",
|
|
60
|
+
title: "wallet_connectors.binance.qr_code.step3.title"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
} : void 0,
|
|
65
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
66
|
+
projectId,
|
|
67
|
+
walletConnectParameters
|
|
68
|
+
}) : getInjectedConnector({
|
|
69
|
+
flag: "isBinance"
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
binanceWallet
|
|
76
|
+
};
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
createAbcEvmProvider
|
|
4
|
+
} from "./chunk-HQO76VJR.js";
|
|
5
|
+
import {
|
|
6
|
+
createTalkenApiClient
|
|
7
|
+
} from "./chunk-5ERWBR7D.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveTalkenApiUrl
|
|
10
|
+
} from "./chunk-GFWUFYT2.js";
|
|
11
|
+
import {
|
|
12
|
+
setGlobalDefaultBitcoinNetwork,
|
|
13
|
+
setGlobalDefaultChainId,
|
|
14
|
+
setGlobalDefaultSolanaNetwork
|
|
15
|
+
} from "./chunk-O4AU63LK.js";
|
|
16
|
+
import {
|
|
17
|
+
clearAuthState,
|
|
18
|
+
clearStorage,
|
|
19
|
+
loadAuthState,
|
|
20
|
+
loadFromStorage,
|
|
21
|
+
saveAuthState
|
|
22
|
+
} from "./chunk-VRI5ZALU.js";
|
|
23
|
+
import {
|
|
24
|
+
getCredentialManager
|
|
25
|
+
} from "./chunk-36BJXEBA.js";
|
|
26
|
+
import {
|
|
27
|
+
setTalkenApiClient
|
|
28
|
+
} from "./chunk-R6ZE7JAZ.js";
|
|
29
|
+
import {
|
|
30
|
+
loadTgAccessKey
|
|
31
|
+
} from "./chunk-6KRX73ED.js";
|
|
32
|
+
|
|
33
|
+
// src/wallets/walletConnectors/abcWallet/abcConnector.ts
|
|
34
|
+
import { getTalkenApiClient } from "@talken/talkenkit";
|
|
35
|
+
import { createConnector } from "wagmi";
|
|
36
|
+
function abcConnector(options) {
|
|
37
|
+
const { config } = options;
|
|
38
|
+
if (config.defaultChainId) {
|
|
39
|
+
setGlobalDefaultChainId(config.defaultChainId);
|
|
40
|
+
}
|
|
41
|
+
if (config.defaultSolanaNetwork) {
|
|
42
|
+
setGlobalDefaultSolanaNetwork(config.defaultSolanaNetwork);
|
|
43
|
+
}
|
|
44
|
+
if (config.defaultBitcoinNetwork) {
|
|
45
|
+
setGlobalDefaultBitcoinNetwork(config.defaultBitcoinNetwork);
|
|
46
|
+
}
|
|
47
|
+
return createConnector((wagmiConfig) => {
|
|
48
|
+
const talkenApi = getTalkenApiClient() || createTalkenApiClient({
|
|
49
|
+
baseUrl: resolveTalkenApiUrl(config.talkenApiUrl),
|
|
50
|
+
environment: config.environment,
|
|
51
|
+
debug: config.environment === "development",
|
|
52
|
+
defaultChainId: config.defaultChainId
|
|
53
|
+
});
|
|
54
|
+
setTalkenApiClient(talkenApi);
|
|
55
|
+
const storedAccessKey = typeof window !== "undefined" ? (() => {
|
|
56
|
+
try {
|
|
57
|
+
return localStorage.getItem("talken_api_access_key_raw");
|
|
58
|
+
} catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
})() : null;
|
|
62
|
+
const effectiveAccessKey = config.accessKey || storedAccessKey;
|
|
63
|
+
const isAccessKeyMode = !!effectiveAccessKey;
|
|
64
|
+
if (isAccessKeyMode && effectiveAccessKey) {
|
|
65
|
+
talkenApi.setAccessKey(effectiveAccessKey);
|
|
66
|
+
}
|
|
67
|
+
const provider = createAbcEvmProvider(talkenApi);
|
|
68
|
+
let accountsChangedHandler;
|
|
69
|
+
let chainChangedHandler;
|
|
70
|
+
let disconnectHandler;
|
|
71
|
+
return {
|
|
72
|
+
id: "abc",
|
|
73
|
+
name: "ABC Wallet",
|
|
74
|
+
type: "abc",
|
|
75
|
+
/**
|
|
76
|
+
* Connect wallet
|
|
77
|
+
*/
|
|
78
|
+
async connect() {
|
|
79
|
+
try {
|
|
80
|
+
const authState = loadAuthState();
|
|
81
|
+
if (!authState || !authState.isAuthenticated || !authState.wallet) {
|
|
82
|
+
throw new Error("ABC_LOGIN_REQUIRED");
|
|
83
|
+
}
|
|
84
|
+
if (isAccessKeyMode) {
|
|
85
|
+
const w = authState.wallet;
|
|
86
|
+
provider.setWallet({
|
|
87
|
+
address: w.address,
|
|
88
|
+
chainId: w.chainId || config.defaultChainId || 1,
|
|
89
|
+
uid: w.uid || "",
|
|
90
|
+
sessionId: w.sessionId || "",
|
|
91
|
+
keyId: w.keyId || "",
|
|
92
|
+
encryptedShare: w.encryptedShare || "",
|
|
93
|
+
sid: w.sid || "",
|
|
94
|
+
type: "evm",
|
|
95
|
+
email: w.email || authState.user?.email || ""
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
provider.setWallet(authState.wallet);
|
|
99
|
+
if (authState.accessToken && authState.refreshToken && authState.expiresAt) {
|
|
100
|
+
talkenApi.setTokens(
|
|
101
|
+
authState.accessToken,
|
|
102
|
+
authState.refreshToken,
|
|
103
|
+
authState.expiresAt
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const accounts = await provider.request({
|
|
108
|
+
method: "eth_requestAccounts"
|
|
109
|
+
});
|
|
110
|
+
let currentChainId = await provider.request({
|
|
111
|
+
method: "eth_chainId"
|
|
112
|
+
});
|
|
113
|
+
const currentChainIdNumber = Number(currentChainId);
|
|
114
|
+
const isChainSupported = wagmiConfig.chains.some(
|
|
115
|
+
(c) => c.id === currentChainIdNumber
|
|
116
|
+
);
|
|
117
|
+
if (!isChainSupported && wagmiConfig.chains.length > 0) {
|
|
118
|
+
const fallbackChainId = wagmiConfig.chains[0].id;
|
|
119
|
+
await provider.request({
|
|
120
|
+
method: "wallet_switchEthereumChain",
|
|
121
|
+
params: [{ chainId: `0x${fallbackChainId.toString(16)}` }]
|
|
122
|
+
});
|
|
123
|
+
currentChainId = `0x${fallbackChainId.toString(16)}`;
|
|
124
|
+
if (authState.wallet) {
|
|
125
|
+
authState.wallet.chainId = fallbackChainId;
|
|
126
|
+
saveAuthState(authState);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (accountsChangedHandler) {
|
|
130
|
+
provider.removeListener("accountsChanged", accountsChangedHandler);
|
|
131
|
+
}
|
|
132
|
+
accountsChangedHandler = (accounts2) => {
|
|
133
|
+
wagmiConfig.emitter.emit("change", {
|
|
134
|
+
accounts: accounts2
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
provider.on("accountsChanged", accountsChangedHandler);
|
|
138
|
+
if (chainChangedHandler) {
|
|
139
|
+
provider.removeListener("chainChanged", chainChangedHandler);
|
|
140
|
+
}
|
|
141
|
+
chainChangedHandler = (chainId) => {
|
|
142
|
+
wagmiConfig.emitter.emit("change", {
|
|
143
|
+
chainId: Number(chainId)
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
provider.on("chainChanged", chainChangedHandler);
|
|
147
|
+
if (disconnectHandler) {
|
|
148
|
+
provider.removeListener("disconnect", disconnectHandler);
|
|
149
|
+
}
|
|
150
|
+
disconnectHandler = () => {
|
|
151
|
+
wagmiConfig.emitter.emit("disconnect");
|
|
152
|
+
this.onDisconnect();
|
|
153
|
+
};
|
|
154
|
+
provider.on("disconnect", disconnectHandler);
|
|
155
|
+
wagmiConfig.emitter.emit("connect", {
|
|
156
|
+
accounts,
|
|
157
|
+
chainId: Number(currentChainId)
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
accounts,
|
|
161
|
+
chainId: Number(currentChainId)
|
|
162
|
+
};
|
|
163
|
+
} catch (error) {
|
|
164
|
+
console.error("\u274C ABC Connector connect() failed:", {
|
|
165
|
+
message: error.message,
|
|
166
|
+
code: error.code,
|
|
167
|
+
error
|
|
168
|
+
});
|
|
169
|
+
if (error.message === "ABC_LOGIN_REQUIRED") {
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Disconnect wallet
|
|
177
|
+
*/
|
|
178
|
+
async disconnect() {
|
|
179
|
+
if (accountsChangedHandler) {
|
|
180
|
+
provider.removeListener("accountsChanged", accountsChangedHandler);
|
|
181
|
+
accountsChangedHandler = void 0;
|
|
182
|
+
}
|
|
183
|
+
if (chainChangedHandler) {
|
|
184
|
+
provider.removeListener("chainChanged", chainChangedHandler);
|
|
185
|
+
chainChangedHandler = void 0;
|
|
186
|
+
}
|
|
187
|
+
if (disconnectHandler) {
|
|
188
|
+
provider.removeListener("disconnect", disconnectHandler);
|
|
189
|
+
disconnectHandler = void 0;
|
|
190
|
+
}
|
|
191
|
+
provider.clearWallet();
|
|
192
|
+
talkenApi.auth.logout();
|
|
193
|
+
try {
|
|
194
|
+
localStorage.removeItem("talken_api_access_key_raw");
|
|
195
|
+
} catch {
|
|
196
|
+
}
|
|
197
|
+
clearAuthState();
|
|
198
|
+
getCredentialManager().clear();
|
|
199
|
+
},
|
|
200
|
+
/**
|
|
201
|
+
* Get accounts
|
|
202
|
+
*/
|
|
203
|
+
async getAccounts() {
|
|
204
|
+
const accounts = await provider.request({
|
|
205
|
+
method: "eth_accounts"
|
|
206
|
+
});
|
|
207
|
+
return accounts.map((account) => account);
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* Get chain ID
|
|
211
|
+
*/
|
|
212
|
+
async getChainId() {
|
|
213
|
+
const chainId = await provider.request({
|
|
214
|
+
method: "eth_chainId"
|
|
215
|
+
});
|
|
216
|
+
return Number(chainId);
|
|
217
|
+
},
|
|
218
|
+
/**
|
|
219
|
+
* Get provider
|
|
220
|
+
*/
|
|
221
|
+
async getProvider() {
|
|
222
|
+
return provider;
|
|
223
|
+
},
|
|
224
|
+
/**
|
|
225
|
+
* Check if authorized (has valid session)
|
|
226
|
+
* Auto-refreshes access token if expired but refresh token is valid
|
|
227
|
+
*/
|
|
228
|
+
async isAuthorized() {
|
|
229
|
+
try {
|
|
230
|
+
if (isAccessKeyMode) {
|
|
231
|
+
if (provider.isConnected())
|
|
232
|
+
return true;
|
|
233
|
+
const hasKey = !!effectiveAccessKey || typeof localStorage !== "undefined" && (!!localStorage.getItem("talken_api_access_key_raw") || !!loadTgAccessKey());
|
|
234
|
+
const authState2 = loadAuthState();
|
|
235
|
+
return hasKey && !!authState2?.wallet?.address;
|
|
236
|
+
}
|
|
237
|
+
const authState = loadAuthState();
|
|
238
|
+
if (!authState || !authState.isAuthenticated) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
if (!authState.wallet) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
if (talkenApi.isAuthenticated()) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
if (talkenApi.isAccessKeyMode()) {
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
const refreshToken = loadFromStorage(
|
|
251
|
+
"refresh_token" /* REFRESH_TOKEN */
|
|
252
|
+
);
|
|
253
|
+
if (!refreshToken) {
|
|
254
|
+
clearStorage();
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
try {
|
|
258
|
+
const api = getTalkenApiClient();
|
|
259
|
+
if (!api) {
|
|
260
|
+
clearStorage();
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
const res = await api.auth.refresh();
|
|
264
|
+
talkenApi.setTokens(
|
|
265
|
+
res.accessToken,
|
|
266
|
+
res.refreshToken,
|
|
267
|
+
Date.now() + res.expiresIn * 1e3
|
|
268
|
+
);
|
|
269
|
+
const updatedState = loadAuthState();
|
|
270
|
+
return updatedState?.isAuthenticated ?? false;
|
|
271
|
+
} catch (error) {
|
|
272
|
+
console.error("[AbcConnector] Token refresh failed:", error);
|
|
273
|
+
clearStorage();
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
} catch (error) {
|
|
277
|
+
console.error(
|
|
278
|
+
"[AbcConnector] Unexpected error in isAuthorized:",
|
|
279
|
+
error
|
|
280
|
+
);
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
/**
|
|
285
|
+
* Switch chain
|
|
286
|
+
*/
|
|
287
|
+
async switchChain({ chainId }) {
|
|
288
|
+
await provider.request({
|
|
289
|
+
method: "wallet_switchEthereumChain",
|
|
290
|
+
params: [{ chainId: `0x${chainId.toString(16)}` }]
|
|
291
|
+
});
|
|
292
|
+
const newChainId = await this.getChainId();
|
|
293
|
+
const authState = loadAuthState();
|
|
294
|
+
if (authState?.wallet) {
|
|
295
|
+
authState.wallet.chainId = newChainId;
|
|
296
|
+
saveAuthState(authState);
|
|
297
|
+
}
|
|
298
|
+
return wagmiConfig.chains.find((x) => x.id === chainId) ?? {
|
|
299
|
+
id: chainId,
|
|
300
|
+
name: `Chain ${chainId}`,
|
|
301
|
+
nativeCurrency: {
|
|
302
|
+
name: "Ether",
|
|
303
|
+
decimals: 18,
|
|
304
|
+
symbol: "ETH"
|
|
305
|
+
},
|
|
306
|
+
rpcUrls: {
|
|
307
|
+
default: { http: [""] }
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
},
|
|
311
|
+
/**
|
|
312
|
+
* Handle accounts changed
|
|
313
|
+
*/
|
|
314
|
+
onAccountsChanged(accounts) {
|
|
315
|
+
if (accounts.length === 0) {
|
|
316
|
+
this.onDisconnect();
|
|
317
|
+
} else {
|
|
318
|
+
wagmiConfig.emitter.emit("change", {
|
|
319
|
+
accounts
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
/**
|
|
324
|
+
* Handle chain changed
|
|
325
|
+
*/
|
|
326
|
+
onChainChanged(chain) {
|
|
327
|
+
const chainId = Number(chain);
|
|
328
|
+
wagmiConfig.emitter.emit("change", { chainId });
|
|
329
|
+
},
|
|
330
|
+
/**
|
|
331
|
+
* Handle disconnect
|
|
332
|
+
*/
|
|
333
|
+
onDisconnect(_error) {
|
|
334
|
+
provider.clearWallet();
|
|
335
|
+
clearAuthState();
|
|
336
|
+
wagmiConfig.emitter.emit("disconnect");
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export {
|
|
343
|
+
abcConnector
|
|
344
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-PONHGUSY.js";
|
|
6
|
+
import {
|
|
7
|
+
getWalletConnectConnector
|
|
8
|
+
} from "./chunk-PODFK4OS.js";
|
|
9
|
+
|
|
10
|
+
// src/wallets/walletConnectors/safepalWallet/safepalWallet.ts
|
|
11
|
+
var safepalWallet = ({
|
|
12
|
+
projectId,
|
|
13
|
+
walletConnectParameters
|
|
14
|
+
}) => {
|
|
15
|
+
const isSafePalWalletInjected = hasInjectedProvider({
|
|
16
|
+
namespace: "safepalProvider",
|
|
17
|
+
flag: "isSafePal"
|
|
18
|
+
});
|
|
19
|
+
const shouldUseWalletConnect = !isSafePalWalletInjected;
|
|
20
|
+
const getUriMobile = (uri) => {
|
|
21
|
+
return `safepalwallet://wc?uri=${encodeURIComponent(uri)}`;
|
|
22
|
+
};
|
|
23
|
+
const getUriQR = async (uri) => {
|
|
24
|
+
return uri;
|
|
25
|
+
};
|
|
26
|
+
const mobileConnector = {
|
|
27
|
+
getUri: shouldUseWalletConnect ? getUriMobile : void 0
|
|
28
|
+
};
|
|
29
|
+
let qrConnector = void 0;
|
|
30
|
+
if (shouldUseWalletConnect) {
|
|
31
|
+
qrConnector = {
|
|
32
|
+
getUri: getUriQR,
|
|
33
|
+
instructions: {
|
|
34
|
+
learnMoreUrl: "https://safepal.com/",
|
|
35
|
+
steps: [
|
|
36
|
+
{
|
|
37
|
+
description: "wallet_connectors.safepal.qr_code.step1.description",
|
|
38
|
+
step: "install",
|
|
39
|
+
title: "wallet_connectors.safepal.qr_code.step1.title"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
description: "wallet_connectors.safepal.qr_code.step2.description",
|
|
43
|
+
step: "create",
|
|
44
|
+
title: "wallet_connectors.safepal.qr_code.step2.title"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
description: "wallet_connectors.safepal.qr_code.step3.description",
|
|
48
|
+
step: "scan",
|
|
49
|
+
title: "wallet_connectors.safepal.qr_code.step3.title"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const extensionConnector = {
|
|
56
|
+
instructions: {
|
|
57
|
+
learnMoreUrl: "https://www.safepal.com/download?product=2",
|
|
58
|
+
steps: [
|
|
59
|
+
{
|
|
60
|
+
description: "wallet_connectors.safepal.extension.step1.description",
|
|
61
|
+
step: "install",
|
|
62
|
+
title: "wallet_connectors.safepal.extension.step1.title"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
description: "wallet_connectors.safepal.extension.step2.description",
|
|
66
|
+
step: "create",
|
|
67
|
+
title: "wallet_connectors.safepal.extension.step2.title"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
description: "wallet_connectors.safepal.extension.step3.description",
|
|
71
|
+
step: "refresh",
|
|
72
|
+
title: "wallet_connectors.safepal.extension.step3.title"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
id: "safepal",
|
|
79
|
+
name: "SafePal Wallet",
|
|
80
|
+
iconUrl: async () => (await import("./safepalWallet-KQJ4OCNH.js")).default,
|
|
81
|
+
// Note that we never resolve `installed` to `false` because the
|
|
82
|
+
// SafePal Wallet provider falls back to other connection methods if
|
|
83
|
+
// the injected connector isn't available
|
|
84
|
+
installed: isSafePalWalletInjected,
|
|
85
|
+
iconAccent: "#3375BB",
|
|
86
|
+
iconBackground: "#fff",
|
|
87
|
+
downloadUrls: {
|
|
88
|
+
android: "https://play.google.com/store/apps/details?id=io.safepal.wallet&referrer=utm_source%3Drainbowkit%26utm_medium%3Ddisplay%26utm_campaign%3Ddownload",
|
|
89
|
+
ios: "https://apps.apple.com/app/apple-store/id1548297139?pt=122504219&ct=rainbowkit&mt=8",
|
|
90
|
+
mobile: "https://www.safepal.com/en/download",
|
|
91
|
+
qrCode: "https://www.safepal.com/en/download",
|
|
92
|
+
chrome: "https://chrome.google.com/webstore/detail/safepal-extension-wallet/lgmpcpglpngdoalbgeoldeajfclnhafa",
|
|
93
|
+
browserExtension: "https://www.safepal.com/download?product=2"
|
|
94
|
+
},
|
|
95
|
+
mobile: mobileConnector,
|
|
96
|
+
...qrConnector ? qrConnector : {},
|
|
97
|
+
extension: extensionConnector,
|
|
98
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
99
|
+
projectId,
|
|
100
|
+
walletConnectParameters
|
|
101
|
+
}) : getInjectedConnector({
|
|
102
|
+
namespace: "safepalProvider",
|
|
103
|
+
flag: "isSafePal"
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
safepalWallet
|
|
110
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
isAndroid,
|
|
4
|
+
isIOS
|
|
5
|
+
} from "./chunk-RETKWSKD.js";
|
|
6
|
+
import {
|
|
7
|
+
getInjectedConnector,
|
|
8
|
+
hasInjectedProvider
|
|
9
|
+
} from "./chunk-PONHGUSY.js";
|
|
10
|
+
import {
|
|
11
|
+
getWalletConnectConnector
|
|
12
|
+
} from "./chunk-PODFK4OS.js";
|
|
13
|
+
|
|
14
|
+
// src/wallets/walletConnectors/rainbowWallet/rainbowWallet.ts
|
|
15
|
+
var rainbowWallet = ({
|
|
16
|
+
projectId,
|
|
17
|
+
walletConnectParameters
|
|
18
|
+
}) => {
|
|
19
|
+
const isRainbowInjected = hasInjectedProvider({ flag: "isRainbow" });
|
|
20
|
+
const shouldUseWalletConnect = !isRainbowInjected;
|
|
21
|
+
const getUri = (uri) => {
|
|
22
|
+
return isAndroid() ? uri : isIOS() ? `rainbow://wc?uri=${encodeURIComponent(uri)}&connector=rainbowkit` : `https://rnbwapp.com/wc?uri=${encodeURIComponent(
|
|
23
|
+
uri
|
|
24
|
+
)}&connector=rainbowkit`;
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
id: "rainbow",
|
|
28
|
+
name: "Rainbow",
|
|
29
|
+
rdns: "me.rainbow",
|
|
30
|
+
iconUrl: async () => (await import("./rainbowWallet-2SR6TVBF.js")).default,
|
|
31
|
+
iconBackground: "#0c2f78",
|
|
32
|
+
installed: !shouldUseWalletConnect ? isRainbowInjected : void 0,
|
|
33
|
+
downloadUrls: {
|
|
34
|
+
android: "https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Drainbowkit&utm_source=rainbowkit",
|
|
35
|
+
ios: "https://apps.apple.com/app/apple-store/id1457119021?pt=119997837&ct=rainbowkit&mt=8",
|
|
36
|
+
mobile: "https://rainbow.download?utm_source=rainbowkit",
|
|
37
|
+
qrCode: "https://rainbow.download?utm_source=rainbowkit&utm_medium=qrcode",
|
|
38
|
+
browserExtension: "https://rainbow.me/extension?utm_source=rainbowkit"
|
|
39
|
+
},
|
|
40
|
+
mobile: { getUri: shouldUseWalletConnect ? getUri : void 0 },
|
|
41
|
+
qrCode: shouldUseWalletConnect ? {
|
|
42
|
+
getUri,
|
|
43
|
+
instructions: {
|
|
44
|
+
learnMoreUrl: "https://learn.rainbow.me/connect-to-a-website-or-app?utm_source=rainbowkit&utm_medium=connector&utm_campaign=learnmore",
|
|
45
|
+
steps: [
|
|
46
|
+
{
|
|
47
|
+
description: "wallet_connectors.rainbow.qr_code.step1.description",
|
|
48
|
+
step: "install",
|
|
49
|
+
title: "wallet_connectors.rainbow.qr_code.step1.title"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
description: "wallet_connectors.rainbow.qr_code.step2.description",
|
|
53
|
+
step: "create",
|
|
54
|
+
title: "wallet_connectors.rainbow.qr_code.step2.title"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
description: "wallet_connectors.rainbow.qr_code.step3.description",
|
|
58
|
+
step: "scan",
|
|
59
|
+
title: "wallet_connectors.rainbow.qr_code.step3.title"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
} : void 0,
|
|
64
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
65
|
+
projectId,
|
|
66
|
+
walletConnectParameters
|
|
67
|
+
}) : getInjectedConnector({ flag: "isRainbow" })
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
rainbowWallet
|
|
73
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-PONHGUSY.js";
|
|
6
|
+
import {
|
|
7
|
+
getWalletConnectConnector
|
|
8
|
+
} from "./chunk-PODFK4OS.js";
|
|
9
|
+
|
|
10
|
+
// src/wallets/walletConnectors/coin98Wallet/coin98Wallet.ts
|
|
11
|
+
var coin98Wallet = ({
|
|
12
|
+
projectId,
|
|
13
|
+
walletConnectParameters
|
|
14
|
+
}) => {
|
|
15
|
+
const isCoin98WalletInjected = hasInjectedProvider({
|
|
16
|
+
namespace: "coin98.provider",
|
|
17
|
+
flag: "isCoin98"
|
|
18
|
+
});
|
|
19
|
+
const shouldUseWalletConnect = !isCoin98WalletInjected;
|
|
20
|
+
return {
|
|
21
|
+
id: "coin98",
|
|
22
|
+
name: "Coin98 Wallet",
|
|
23
|
+
iconUrl: async () => (await import("./coin98Wallet-RFXRNVWP.js")).default,
|
|
24
|
+
installed: isCoin98WalletInjected,
|
|
25
|
+
iconAccent: "#CDA349",
|
|
26
|
+
iconBackground: "#fff",
|
|
27
|
+
rdns: "coin98.com",
|
|
28
|
+
downloadUrls: {
|
|
29
|
+
android: "https://play.google.com/store/apps/details?id=coin98.crypto.finance.media",
|
|
30
|
+
ios: "https://apps.apple.com/vn/app/coin98-super-app/id1561969966",
|
|
31
|
+
mobile: "https://coin98.com/wallet",
|
|
32
|
+
qrCode: "https://coin98.com/wallet",
|
|
33
|
+
chrome: "https://chrome.google.com/webstore/detail/coin98-wallet/aeachknmefphepccionboohckonoeemg",
|
|
34
|
+
browserExtension: "https://coin98.com/wallet"
|
|
35
|
+
},
|
|
36
|
+
mobile: {
|
|
37
|
+
getUri: shouldUseWalletConnect ? (uri) => uri : void 0
|
|
38
|
+
},
|
|
39
|
+
qrCode: shouldUseWalletConnect ? {
|
|
40
|
+
getUri: (uri) => uri,
|
|
41
|
+
instructions: {
|
|
42
|
+
learnMoreUrl: "https://coin98.com/wallet",
|
|
43
|
+
steps: [
|
|
44
|
+
{
|
|
45
|
+
description: "wallet_connectors.coin98.qr_code.step1.description",
|
|
46
|
+
step: "install",
|
|
47
|
+
title: "wallet_connectors.coin98.qr_code.step1.title"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
description: "wallet_connectors.coin98.qr_code.step2.description",
|
|
51
|
+
step: "create",
|
|
52
|
+
title: "wallet_connectors.coin98.qr_code.step2.title"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
description: "wallet_connectors.coin98.qr_code.step3.description",
|
|
56
|
+
step: "scan",
|
|
57
|
+
title: "wallet_connectors.coin98.qr_code.step3.title"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
} : void 0,
|
|
62
|
+
extension: {
|
|
63
|
+
instructions: {
|
|
64
|
+
learnMoreUrl: "https://coin98.com/wallet",
|
|
65
|
+
steps: [
|
|
66
|
+
{
|
|
67
|
+
description: "wallet_connectors.coin98.extension.step1.description",
|
|
68
|
+
step: "install",
|
|
69
|
+
title: "wallet_connectors.coin98.extension.step1.title"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
description: "wallet_connectors.coin98.extension.step2.description",
|
|
73
|
+
step: "create",
|
|
74
|
+
title: "wallet_connectors.coin98.extension.step2.title"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
description: "wallet_connectors.coin98.extension.step3.description",
|
|
78
|
+
step: "refresh",
|
|
79
|
+
title: "wallet_connectors.coin98.extension.step3.title"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
85
|
+
projectId,
|
|
86
|
+
walletConnectParameters
|
|
87
|
+
}) : getInjectedConnector({
|
|
88
|
+
namespace: "coin98Wallet",
|
|
89
|
+
flag: "isCoin98"
|
|
90
|
+
})
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
coin98Wallet
|
|
96
|
+
};
|