@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,91 @@
|
|
|
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/zealWallet/zealWallet.ts
|
|
11
|
+
var zealWallet = ({
|
|
12
|
+
projectId,
|
|
13
|
+
walletConnectParameters
|
|
14
|
+
}) => {
|
|
15
|
+
const isZealWalletInjected = hasInjectedProvider({ flag: "isZeal" });
|
|
16
|
+
const shouldUseWalletConnect = !isZealWalletInjected;
|
|
17
|
+
return {
|
|
18
|
+
id: "zeal",
|
|
19
|
+
name: "Zeal",
|
|
20
|
+
rdns: "app.zeal",
|
|
21
|
+
iconUrl: async () => (await import("./zealWallet-URNQ2AWF.js")).default,
|
|
22
|
+
iconBackground: "#fff0",
|
|
23
|
+
iconAccent: "#00FFFF",
|
|
24
|
+
downloadUrls: {
|
|
25
|
+
browserExtension: "https://zeal.app",
|
|
26
|
+
chrome: "https://chromewebstore.google.com/detail/zeal-wallet/heamnjbnflcikcggoiplibfommfbkjpj",
|
|
27
|
+
android: "https://play.google.com/store/apps/details?id=app.zeal.wallet",
|
|
28
|
+
ios: "https://testflight.apple.com/join/MP72Ytw8",
|
|
29
|
+
mobile: "https://zeal.app",
|
|
30
|
+
qrCode: "https://zeal.app"
|
|
31
|
+
},
|
|
32
|
+
mobile: {
|
|
33
|
+
getUri: shouldUseWalletConnect ? (uri) => {
|
|
34
|
+
return `zeal://wc?uri=${encodeURIComponent(uri)}`;
|
|
35
|
+
} : void 0
|
|
36
|
+
},
|
|
37
|
+
qrCode: shouldUseWalletConnect ? {
|
|
38
|
+
getUri: (uri) => uri,
|
|
39
|
+
instructions: {
|
|
40
|
+
learnMoreUrl: "https://zeal.app",
|
|
41
|
+
steps: [
|
|
42
|
+
{
|
|
43
|
+
description: "wallet_connectors.zeal.qr_code.step1.description",
|
|
44
|
+
step: "install",
|
|
45
|
+
title: "wallet_connectors.zeal.qr_code.step1.title"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
description: "wallet_connectors.zeal.qr_code.step2.description",
|
|
49
|
+
step: "create",
|
|
50
|
+
title: "wallet_connectors.zeal.qr_code.step2.title"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
description: "wallet_connectors.zeal.qr_code.step3.description",
|
|
54
|
+
step: "scan",
|
|
55
|
+
title: "wallet_connectors.zeal.qr_code.step3.title"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
} : void 0,
|
|
60
|
+
extension: {
|
|
61
|
+
instructions: {
|
|
62
|
+
learnMoreUrl: "https://zeal.app",
|
|
63
|
+
steps: [
|
|
64
|
+
{
|
|
65
|
+
description: "wallet_connectors.zeal.extension.step1.description",
|
|
66
|
+
step: "install",
|
|
67
|
+
title: "wallet_connectors.zeal.extension.step1.title"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
description: "wallet_connectors.zeal.extension.step2.description",
|
|
71
|
+
step: "create",
|
|
72
|
+
title: "wallet_connectors.zeal.extension.step2.title"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
description: "wallet_connectors.zeal.extension.step3.description",
|
|
76
|
+
step: "refresh",
|
|
77
|
+
title: "wallet_connectors.zeal.extension.step3.title"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
83
|
+
projectId,
|
|
84
|
+
walletConnectParameters
|
|
85
|
+
}) : getInjectedConnector({ flag: "isZeal" })
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
zealWallet
|
|
91
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
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/subWallet/subWallet.ts
|
|
11
|
+
var subWallet = ({
|
|
12
|
+
projectId,
|
|
13
|
+
walletConnectParameters
|
|
14
|
+
}) => {
|
|
15
|
+
const isSubWalletInjected = hasInjectedProvider({ namespace: "SubWallet" });
|
|
16
|
+
const shouldUseWalletConnect = !isSubWalletInjected;
|
|
17
|
+
const getUriMobile = (uri) => {
|
|
18
|
+
return `subwallet://wc?uri=${encodeURIComponent(uri)}`;
|
|
19
|
+
};
|
|
20
|
+
const getUriQR = (uri) => {
|
|
21
|
+
return uri;
|
|
22
|
+
};
|
|
23
|
+
const mobileConnector = {
|
|
24
|
+
getUri: shouldUseWalletConnect ? getUriMobile : void 0
|
|
25
|
+
};
|
|
26
|
+
let qrConnector = void 0;
|
|
27
|
+
if (shouldUseWalletConnect) {
|
|
28
|
+
qrConnector = {
|
|
29
|
+
getUri: getUriQR,
|
|
30
|
+
instructions: {
|
|
31
|
+
learnMoreUrl: "https://www.subwallet.app/",
|
|
32
|
+
steps: [
|
|
33
|
+
{
|
|
34
|
+
description: "wallet_connectors.subwallet.qr_code.step1.description",
|
|
35
|
+
step: "install",
|
|
36
|
+
title: "wallet_connectors.subwallet.qr_code.step1.title"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
description: "wallet_connectors.subwallet.qr_code.step2.description",
|
|
40
|
+
step: "create",
|
|
41
|
+
title: "wallet_connectors.subwallet.qr_code.step2.title"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
description: "wallet_connectors.subwallet.qr_code.step3.description",
|
|
45
|
+
step: "scan",
|
|
46
|
+
title: "wallet_connectors.subwallet.qr_code.step3.title"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const extensionConnector = {
|
|
53
|
+
instructions: {
|
|
54
|
+
learnMoreUrl: "https://www.subwallet.app/",
|
|
55
|
+
steps: [
|
|
56
|
+
{
|
|
57
|
+
description: "wallet_connectors.subwallet.extension.step1.description",
|
|
58
|
+
step: "install",
|
|
59
|
+
title: "wallet_connectors.subwallet.extension.step1.title"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
description: "wallet_connectors.subwallet.extension.step2.description",
|
|
63
|
+
step: "create",
|
|
64
|
+
title: "wallet_connectors.subwallet.extension.step2.title"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
description: "wallet_connectors.subwallet.extension.step3.description",
|
|
68
|
+
step: "refresh",
|
|
69
|
+
title: "wallet_connectors.subwallet.extension.step3.title"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
id: "subwallet",
|
|
76
|
+
name: "SubWallet",
|
|
77
|
+
rdns: "app.subwallet",
|
|
78
|
+
iconUrl: async () => (await import("./subWallet-LOZELSAO.js")).default,
|
|
79
|
+
iconBackground: "#fff",
|
|
80
|
+
installed: isSubWalletInjected || void 0,
|
|
81
|
+
downloadUrls: {
|
|
82
|
+
browserExtension: "https://www.subwallet.app/download",
|
|
83
|
+
chrome: "https://chrome.google.com/webstore/detail/subwallet-polkadot-wallet/onhogfjeacnfoofkfgppdlbmlmnplgbn",
|
|
84
|
+
firefox: "https://addons.mozilla.org/en-US/firefox/addon/subwallet/",
|
|
85
|
+
edge: "https://chrome.google.com/webstore/detail/subwallet-polkadot-wallet/onhogfjeacnfoofkfgppdlbmlmnplgbn",
|
|
86
|
+
mobile: "https://www.subwallet.app/download",
|
|
87
|
+
android: "https://play.google.com/store/apps/details?id=app.subwallet.mobile",
|
|
88
|
+
ios: "https://apps.apple.com/us/app/subwallet-polkadot-wallet/id1633050285",
|
|
89
|
+
qrCode: "https://www.subwallet.app/download"
|
|
90
|
+
},
|
|
91
|
+
mobile: mobileConnector,
|
|
92
|
+
qrCode: qrConnector,
|
|
93
|
+
extension: extensionConnector,
|
|
94
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
95
|
+
projectId,
|
|
96
|
+
walletConnectParameters
|
|
97
|
+
}) : getInjectedConnector({ namespace: "SubWallet" })
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
subWallet
|
|
103
|
+
};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
AbcError
|
|
4
|
+
} from "./chunk-4P3SPC44.js";
|
|
5
|
+
import {
|
|
6
|
+
PIN_CONFIG,
|
|
7
|
+
STORAGE_PREFIX,
|
|
8
|
+
TOKEN_EXPIRY
|
|
9
|
+
} from "./chunk-6KRX73ED.js";
|
|
10
|
+
|
|
11
|
+
// src/wallets/walletConnectors/abcWallet/utils.ts
|
|
12
|
+
function validatePin(pin) {
|
|
13
|
+
if (!pin || typeof pin !== "string") {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const pinLength = pin.length;
|
|
17
|
+
if (pinLength < PIN_CONFIG.MIN_LENGTH || pinLength > PIN_CONFIG.MAX_LENGTH) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return /^\d+$/.test(pin);
|
|
21
|
+
}
|
|
22
|
+
function validateEmail(email) {
|
|
23
|
+
if (!email || typeof email !== "string") {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
27
|
+
return emailRegex.test(email);
|
|
28
|
+
}
|
|
29
|
+
function getStorageKey(key) {
|
|
30
|
+
return `${STORAGE_PREFIX}${key}`;
|
|
31
|
+
}
|
|
32
|
+
function saveToStorage(key, value) {
|
|
33
|
+
if (typeof window === "undefined")
|
|
34
|
+
return;
|
|
35
|
+
try {
|
|
36
|
+
const storageKey = getStorageKey(key);
|
|
37
|
+
const serialized = JSON.stringify(value);
|
|
38
|
+
localStorage.setItem(storageKey, serialized);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error("Failed to save to storage:", error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function loadFromStorage(key) {
|
|
44
|
+
if (typeof window === "undefined")
|
|
45
|
+
return null;
|
|
46
|
+
try {
|
|
47
|
+
const storageKey = getStorageKey(key);
|
|
48
|
+
const serialized = localStorage.getItem(storageKey);
|
|
49
|
+
if (!serialized)
|
|
50
|
+
return null;
|
|
51
|
+
try {
|
|
52
|
+
return JSON.parse(serialized);
|
|
53
|
+
} catch {
|
|
54
|
+
return serialized;
|
|
55
|
+
}
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error("Failed to load from storage:", error);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function removeFromStorage(key) {
|
|
62
|
+
if (typeof window === "undefined")
|
|
63
|
+
return;
|
|
64
|
+
try {
|
|
65
|
+
const storageKey = getStorageKey(key);
|
|
66
|
+
localStorage.removeItem(storageKey);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error("Failed to remove from storage:", error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function clearStorage() {
|
|
72
|
+
if (typeof window === "undefined")
|
|
73
|
+
return;
|
|
74
|
+
const keysToRemove = [];
|
|
75
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
76
|
+
const key = localStorage.key(i);
|
|
77
|
+
if (key?.startsWith(STORAGE_PREFIX)) {
|
|
78
|
+
keysToRemove.push(key);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
for (const key of keysToRemove) {
|
|
82
|
+
localStorage.removeItem(key);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function isTokenExpired(expiresAt) {
|
|
86
|
+
if (!expiresAt)
|
|
87
|
+
return true;
|
|
88
|
+
return Date.now() >= expiresAt - TOKEN_EXPIRY.REFRESH_BUFFER;
|
|
89
|
+
}
|
|
90
|
+
function calculateExpiryTimestamp(expiresIn) {
|
|
91
|
+
return Date.now() + expiresIn * 1e3;
|
|
92
|
+
}
|
|
93
|
+
function saveAuthState(state) {
|
|
94
|
+
saveToStorage("auth_state" /* AUTH_STATE */, state);
|
|
95
|
+
if (state.user) {
|
|
96
|
+
saveToStorage("user" /* USER */, state.user);
|
|
97
|
+
}
|
|
98
|
+
if (state.wallet) {
|
|
99
|
+
saveToStorage("wallet" /* WALLET */, state.wallet);
|
|
100
|
+
}
|
|
101
|
+
if (state.solanaWallet) {
|
|
102
|
+
saveToStorage("solana_wallet" /* SOLANA_WALLET */, state.solanaWallet);
|
|
103
|
+
}
|
|
104
|
+
if (state.bitcoinWallet) {
|
|
105
|
+
saveToStorage("bitcoin_wallet" /* BITCOIN_WALLET */, state.bitcoinWallet);
|
|
106
|
+
}
|
|
107
|
+
if (state.tronWallet) {
|
|
108
|
+
saveToStorage("tron_wallet" /* TRON_WALLET */, state.tronWallet);
|
|
109
|
+
}
|
|
110
|
+
if (state.accessToken) {
|
|
111
|
+
saveToStorage("access_token" /* ACCESS_TOKEN */, state.accessToken);
|
|
112
|
+
}
|
|
113
|
+
if (state.refreshToken) {
|
|
114
|
+
saveToStorage("refresh_token" /* REFRESH_TOKEN */, state.refreshToken);
|
|
115
|
+
}
|
|
116
|
+
if (state.expiresAt) {
|
|
117
|
+
saveToStorage("expires_at" /* EXPIRES_AT */, state.expiresAt);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function hydrateAuthStateFromIndividualStorage(state) {
|
|
121
|
+
const user = loadFromStorage("user" /* USER */);
|
|
122
|
+
const wallet = loadFromStorage("wallet" /* WALLET */);
|
|
123
|
+
const solanaWallet = loadFromStorage(
|
|
124
|
+
"solana_wallet" /* SOLANA_WALLET */
|
|
125
|
+
);
|
|
126
|
+
const bitcoinWallet = loadFromStorage(
|
|
127
|
+
"bitcoin_wallet" /* BITCOIN_WALLET */
|
|
128
|
+
);
|
|
129
|
+
const tronWallet = loadFromStorage("tron_wallet" /* TRON_WALLET */);
|
|
130
|
+
const accessToken = loadFromStorage("access_token" /* ACCESS_TOKEN */);
|
|
131
|
+
const refreshToken = loadFromStorage("refresh_token" /* REFRESH_TOKEN */);
|
|
132
|
+
const expiresAt = loadFromStorage("expires_at" /* EXPIRES_AT */);
|
|
133
|
+
const nextState = {
|
|
134
|
+
...state,
|
|
135
|
+
user: state.user || user || null,
|
|
136
|
+
wallet: state.wallet || wallet || null,
|
|
137
|
+
solanaWallet: state.solanaWallet || solanaWallet || null,
|
|
138
|
+
bitcoinWallet: state.bitcoinWallet || bitcoinWallet || null,
|
|
139
|
+
tronWallet: state.tronWallet || tronWallet || null,
|
|
140
|
+
accessToken: state.accessToken || accessToken || null,
|
|
141
|
+
refreshToken: state.refreshToken || refreshToken || null,
|
|
142
|
+
expiresAt: state.expiresAt || expiresAt || null
|
|
143
|
+
};
|
|
144
|
+
const wasHydrated = nextState.user !== state.user || nextState.wallet !== state.wallet || nextState.solanaWallet !== state.solanaWallet || nextState.bitcoinWallet !== state.bitcoinWallet || nextState.tronWallet !== state.tronWallet || nextState.accessToken !== state.accessToken || nextState.refreshToken !== state.refreshToken || nextState.expiresAt !== state.expiresAt;
|
|
145
|
+
if (wasHydrated) {
|
|
146
|
+
saveToStorage("auth_state" /* AUTH_STATE */, nextState);
|
|
147
|
+
}
|
|
148
|
+
return nextState;
|
|
149
|
+
}
|
|
150
|
+
function loadAuthState() {
|
|
151
|
+
const state = loadFromStorage("auth_state" /* AUTH_STATE */);
|
|
152
|
+
if (state) {
|
|
153
|
+
const isExpired = state.accessKeyMode ? state.accessKeyExpiresAt && Date.now() >= new Date(state.accessKeyExpiresAt).getTime() : state.accessToken && isTokenExpired(state.expiresAt);
|
|
154
|
+
if (isExpired) {
|
|
155
|
+
clearStorage();
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
return hydrateAuthStateFromIndividualStorage(state);
|
|
159
|
+
}
|
|
160
|
+
const user = loadFromStorage("user" /* USER */);
|
|
161
|
+
const wallet = loadFromStorage("wallet" /* WALLET */);
|
|
162
|
+
const solanaWallet = loadFromStorage("solana_wallet" /* SOLANA_WALLET */);
|
|
163
|
+
const accessToken = loadFromStorage("access_token" /* ACCESS_TOKEN */);
|
|
164
|
+
const refreshToken = loadFromStorage("refresh_token" /* REFRESH_TOKEN */);
|
|
165
|
+
const expiresAt = loadFromStorage("expires_at" /* EXPIRES_AT */);
|
|
166
|
+
if (!user || !accessToken) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
const bitcoinWallet = loadFromStorage("bitcoin_wallet" /* BITCOIN_WALLET */);
|
|
170
|
+
const tronWallet = loadFromStorage("tron_wallet" /* TRON_WALLET */);
|
|
171
|
+
return {
|
|
172
|
+
isAuthenticated: true,
|
|
173
|
+
user,
|
|
174
|
+
wallet,
|
|
175
|
+
solanaWallet,
|
|
176
|
+
bitcoinWallet,
|
|
177
|
+
tronWallet,
|
|
178
|
+
accessToken,
|
|
179
|
+
refreshToken,
|
|
180
|
+
expiresAt
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function clearAuthState() {
|
|
184
|
+
clearStorage();
|
|
185
|
+
}
|
|
186
|
+
function createAbcError(code, message, details, statusCode) {
|
|
187
|
+
return new AbcError(code, message, details, statusCode);
|
|
188
|
+
}
|
|
189
|
+
function hexToNumber(hex) {
|
|
190
|
+
return Number.parseInt(hex, 16);
|
|
191
|
+
}
|
|
192
|
+
function numberToHex(num) {
|
|
193
|
+
return `0x${num.toString(16)}`;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export {
|
|
197
|
+
validatePin,
|
|
198
|
+
validateEmail,
|
|
199
|
+
getStorageKey,
|
|
200
|
+
saveToStorage,
|
|
201
|
+
loadFromStorage,
|
|
202
|
+
removeFromStorage,
|
|
203
|
+
clearStorage,
|
|
204
|
+
isTokenExpired,
|
|
205
|
+
calculateExpiryTimestamp,
|
|
206
|
+
saveAuthState,
|
|
207
|
+
loadAuthState,
|
|
208
|
+
clearAuthState,
|
|
209
|
+
createAbcError,
|
|
210
|
+
hexToNumber,
|
|
211
|
+
numberToHex
|
|
212
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/utils/encryption.ts
|
|
4
|
+
async function hashPin(pin) {
|
|
5
|
+
if (typeof globalThis.crypto?.subtle?.digest !== "function") {
|
|
6
|
+
throw new Error(
|
|
7
|
+
"[TalkenKit] hashPin requires Web Crypto API (crypto.subtle). Ensure this code runs in a browser or Node.js 15.7+ environment."
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
const encoder = new TextEncoder();
|
|
11
|
+
const data = encoder.encode(pin);
|
|
12
|
+
const hash = await crypto.subtle.digest("SHA-256", data);
|
|
13
|
+
return Array.from(new Uint8Array(hash)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
hashPin
|
|
18
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
abcConnector
|
|
4
|
+
} from "./chunk-QEDCPITY.js";
|
|
5
|
+
import {
|
|
6
|
+
createTalkenApiClient
|
|
7
|
+
} from "./chunk-5ERWBR7D.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveTalkenApiUrl
|
|
10
|
+
} from "./chunk-GFWUFYT2.js";
|
|
11
|
+
import {
|
|
12
|
+
ABC_WALLET_METADATA,
|
|
13
|
+
loadTgAccessKey
|
|
14
|
+
} from "./chunk-6KRX73ED.js";
|
|
15
|
+
|
|
16
|
+
// src/wallets/walletConnectors/abcWallet/abcWallet.ts
|
|
17
|
+
import { setTalkenApiClient } from "@talken/talkenkit";
|
|
18
|
+
var abcWallet = (specificOptions) => ({ projectId }) => {
|
|
19
|
+
const talkenApiUrl = resolveTalkenApiUrl(specificOptions?.talkenApiUrl);
|
|
20
|
+
const talkenApi = createTalkenApiClient({
|
|
21
|
+
baseUrl: talkenApiUrl,
|
|
22
|
+
debug: specificOptions?.environment === "development"
|
|
23
|
+
});
|
|
24
|
+
setTalkenApiClient(talkenApi);
|
|
25
|
+
const accessKey = specificOptions?.accessKey || loadTgAccessKey() || null;
|
|
26
|
+
const config = {
|
|
27
|
+
talkenApiUrl,
|
|
28
|
+
apiKey: specificOptions?.apiKey,
|
|
29
|
+
plain: specificOptions?.plain || "",
|
|
30
|
+
// Deprecated - not used (secure.ts uses random generation)
|
|
31
|
+
environment: specificOptions?.environment || "development",
|
|
32
|
+
defaultChainId: specificOptions?.defaultChainId,
|
|
33
|
+
defaultSolanaNetwork: specificOptions?.defaultSolanaNetwork,
|
|
34
|
+
defaultBitcoinNetwork: specificOptions?.defaultBitcoinNetwork,
|
|
35
|
+
projectId,
|
|
36
|
+
...accessKey && { accessKey }
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
id: ABC_WALLET_METADATA.id,
|
|
40
|
+
name: ABC_WALLET_METADATA.name,
|
|
41
|
+
rdns: ABC_WALLET_METADATA.rdns,
|
|
42
|
+
iconUrl: async () => (await import("./abcWallet-AYWSIGAG.js")).default,
|
|
43
|
+
iconBackground: ABC_WALLET_METADATA.iconBackground,
|
|
44
|
+
// Embedded wallet - no installation required
|
|
45
|
+
installed: void 0,
|
|
46
|
+
// No download URLs for embedded wallet
|
|
47
|
+
downloadUrls: void 0,
|
|
48
|
+
// Create connector - wrapper function required by Wallet type
|
|
49
|
+
// If accessKey exists, abcConnector will use AbcAccessKeyProvider internally
|
|
50
|
+
createConnector: (_walletDetails) => abcConnector({ config }),
|
|
51
|
+
// Embedded wallet always available
|
|
52
|
+
hidden: () => false
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
abcWallet
|
|
58
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
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/bybitWallet/bybitWallet.ts
|
|
11
|
+
var bybitWallet = ({
|
|
12
|
+
projectId,
|
|
13
|
+
walletConnectParameters
|
|
14
|
+
}) => {
|
|
15
|
+
const isBybitInjected = hasInjectedProvider({
|
|
16
|
+
namespace: "bybitWallet"
|
|
17
|
+
});
|
|
18
|
+
const shouldUseWalletConnect = !isBybitInjected;
|
|
19
|
+
const getUri = (uri) => {
|
|
20
|
+
return `bybitapp://open/route?targetUrl=by://web3/walletconnect/wc?uri=${encodeURIComponent(
|
|
21
|
+
uri
|
|
22
|
+
)}`;
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
id: "bybit",
|
|
26
|
+
name: "Bybit Wallet",
|
|
27
|
+
rdns: "com.bybit",
|
|
28
|
+
iconUrl: async () => (await import("./bybitWallet-GR4PFINZ.js")).default,
|
|
29
|
+
installed: !shouldUseWalletConnect ? isBybitInjected : void 0,
|
|
30
|
+
iconBackground: "#000000",
|
|
31
|
+
downloadUrls: {
|
|
32
|
+
chrome: "https://chromewebstore.google.com/detail/bybit-wallet/pdliaogehgdbhbnmkklieghmmjkpigpa",
|
|
33
|
+
browserExtension: "https://www.bybit.com/en/web3",
|
|
34
|
+
android: "https://play.google.com/store/apps/details?id=com.bybit.app",
|
|
35
|
+
ios: "https://apps.apple.com/us/app/bybit-buy-trade-crypto/id1488296980",
|
|
36
|
+
mobile: "https://www.bybit.com/en/web3",
|
|
37
|
+
qrCode: "https://www.bybit.com/en/web3"
|
|
38
|
+
},
|
|
39
|
+
mobile: {
|
|
40
|
+
getUri: shouldUseWalletConnect ? getUri : void 0
|
|
41
|
+
},
|
|
42
|
+
qrCode: shouldUseWalletConnect ? {
|
|
43
|
+
getUri: (uri) => uri,
|
|
44
|
+
instructions: {
|
|
45
|
+
learnMoreUrl: "https://www.bybit.com/en/web3",
|
|
46
|
+
steps: [
|
|
47
|
+
{
|
|
48
|
+
description: "wallet_connectors.bybit.qr_code.step1.description",
|
|
49
|
+
step: "install",
|
|
50
|
+
title: "wallet_connectors.bybit.qr_code.step1.title"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
description: "wallet_connectors.bybit.qr_code.step2.description",
|
|
54
|
+
step: "create",
|
|
55
|
+
title: "wallet_connectors.bybit.qr_code.step2.title"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
description: "wallet_connectors.bybit.qr_code.step3.description",
|
|
59
|
+
step: "scan",
|
|
60
|
+
title: "wallet_connectors.bybit.qr_code.step3.title"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
} : void 0,
|
|
65
|
+
extension: {
|
|
66
|
+
instructions: {
|
|
67
|
+
learnMoreUrl: "https://www.bybit.com/en/web3",
|
|
68
|
+
steps: [
|
|
69
|
+
{
|
|
70
|
+
description: "wallet_connectors.bybit.extension.step1.description",
|
|
71
|
+
step: "install",
|
|
72
|
+
title: "wallet_connectors.bybit.extension.step1.title"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
description: "wallet_connectors.bybit.extension.step2.description",
|
|
76
|
+
step: "create",
|
|
77
|
+
title: "wallet_connectors.bybit.extension.step2.title"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
description: "wallet_connectors.bybit.extension.step3.description",
|
|
81
|
+
step: "refresh",
|
|
82
|
+
title: "wallet_connectors.bybit.extension.step3.title"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
88
|
+
projectId,
|
|
89
|
+
walletConnectParameters
|
|
90
|
+
}) : getInjectedConnector({
|
|
91
|
+
namespace: "bybitWallet"
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
bybitWallet
|
|
98
|
+
};
|
|
@@ -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/roninWallet/roninWallet.ts
|
|
11
|
+
var roninWallet = ({
|
|
12
|
+
projectId,
|
|
13
|
+
walletConnectParameters
|
|
14
|
+
}) => {
|
|
15
|
+
const isRoninInjected = hasInjectedProvider({
|
|
16
|
+
namespace: "ronin.provider"
|
|
17
|
+
});
|
|
18
|
+
const shouldUseWalletConnect = !isRoninInjected;
|
|
19
|
+
const getUri = (uri) => {
|
|
20
|
+
return `roninwallet://wc?uri=${encodeURIComponent(uri)}`;
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
id: "ronin",
|
|
24
|
+
name: "Ronin Wallet",
|
|
25
|
+
iconUrl: async () => (await import("./roninWallet-SAB5ESVK.js")).default,
|
|
26
|
+
iconBackground: "#ffffff",
|
|
27
|
+
rdns: "com.roninchain.wallet",
|
|
28
|
+
installed: isRoninInjected || void 0,
|
|
29
|
+
downloadUrls: {
|
|
30
|
+
android: "https://play.google.com/store/apps/details?id=com.skymavis.genesis",
|
|
31
|
+
ios: "https://apps.apple.com/us/app/ronin-wallet/id1592675001",
|
|
32
|
+
mobile: "https://wallet.roninchain.com",
|
|
33
|
+
chrome: "https://chrome.google.com/webstore/detail/ronin-wallet/fnjhmkhhmkbjkkabndcnnogagogbneec",
|
|
34
|
+
edge: "https://microsoftedge.microsoft.com/addons/detail/ronin-wallet/kjmoohlgokccodicjjfebfomlbljgfhk",
|
|
35
|
+
firefox: "https://addons.mozilla.org/firefox/addon/ronin-wallet",
|
|
36
|
+
browserExtension: "https://wallet.roninchain.com/",
|
|
37
|
+
qrCode: "https://wallet.roninchain.com/"
|
|
38
|
+
},
|
|
39
|
+
mobile: {
|
|
40
|
+
getUri: shouldUseWalletConnect ? getUri : void 0
|
|
41
|
+
},
|
|
42
|
+
qrCode: shouldUseWalletConnect ? {
|
|
43
|
+
getUri: (uri) => uri,
|
|
44
|
+
instructions: {
|
|
45
|
+
learnMoreUrl: "https://wallet.roninchain.com/",
|
|
46
|
+
steps: [
|
|
47
|
+
{
|
|
48
|
+
description: "wallet_connectors.ronin.qr_code.step1.description",
|
|
49
|
+
step: "install",
|
|
50
|
+
title: "wallet_connectors.ronin.qr_code.step1.title"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
description: "wallet_connectors.ronin.qr_code.step2.description",
|
|
54
|
+
step: "create",
|
|
55
|
+
title: "wallet_connectors.ronin.qr_code.step2.title"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
description: "wallet_connectors.ronin.qr_code.step3.description",
|
|
59
|
+
step: "scan",
|
|
60
|
+
title: "wallet_connectors.ronin.qr_code.step3.title"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
} : void 0,
|
|
65
|
+
extension: {
|
|
66
|
+
instructions: {
|
|
67
|
+
learnMoreUrl: "https://wallet.roninchain.com/",
|
|
68
|
+
steps: [
|
|
69
|
+
{
|
|
70
|
+
description: "wallet_connectors.ronin.extension.step1.description",
|
|
71
|
+
step: "install",
|
|
72
|
+
title: "wallet_connectors.ronin.extension.step1.title"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
description: "wallet_connectors.ronin.extension.step2.description",
|
|
76
|
+
step: "create",
|
|
77
|
+
title: "wallet_connectors.ronin.extension.step2.title"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
description: "wallet_connectors.ronin.extension.step3.description",
|
|
81
|
+
step: "refresh",
|
|
82
|
+
title: "wallet_connectors.ronin.extension.step3.title"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
88
|
+
projectId,
|
|
89
|
+
walletConnectParameters
|
|
90
|
+
}) : getInjectedConnector({ namespace: "ronin.provider" })
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
roninWallet
|
|
96
|
+
};
|