stablezact-pay 0.66.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.
@@ -0,0 +1,138 @@
1
+ import { i as isFeatureEnabled, F as FEATURES, c as chainTransports, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BA2ym_mw.js";
2
+ const logo = "https://coinley.io/logo.png";
3
+ let appKitInstance = null;
4
+ let isInitializing = false;
5
+ let initializationPromise = null;
6
+ const getAppMetadata = () => ({
7
+ name: "Coinley Payment",
8
+ description: "Crypto Payment Gateway - Accept payments in 600+ wallets",
9
+ url: typeof window !== "undefined" ? window.location.origin : "https://coinley.io",
10
+ icons: [logo]
11
+ });
12
+ const getFeaturedWallets = () => [
13
+ "c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",
14
+ // MetaMask
15
+ "fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",
16
+ // Coinbase Wallet
17
+ "4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",
18
+ // Trust Wallet
19
+ "1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",
20
+ // Rainbow
21
+ "19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927"
22
+ // Ledger Live
23
+ ];
24
+ const initializeAppKitEVM = async (wagmiConfig) => {
25
+ if (appKitInstance) {
26
+ if (FEATURES.debugWalletConnect) {
27
+ console.log("✅ AppKit EVM: Using existing instance");
28
+ }
29
+ return appKitInstance;
30
+ }
31
+ if (isInitializing) {
32
+ if (FEATURES.debugWalletConnect) {
33
+ console.log("⏳ AppKit EVM: Waiting for initialization...");
34
+ }
35
+ return initializationPromise;
36
+ }
37
+ if (!isFeatureEnabled("useAppKitEVM")) {
38
+ throw new Error("AppKit EVM is disabled via feature flags");
39
+ }
40
+ isInitializing = true;
41
+ initializationPromise = (async () => {
42
+ try {
43
+ if (FEATURES.debugWalletConnect) {
44
+ console.log("🚀 AppKit EVM: Starting lazy load...");
45
+ console.time("AppKit EVM Load Time");
46
+ }
47
+ const { createAppKit } = await import("@reown/appkit/react");
48
+ const { WagmiAdapter } = await import("@reown/appkit-adapter-wagmi");
49
+ if (FEATURES.debugWalletConnect) {
50
+ console.timeEnd("AppKit EVM Load Time");
51
+ console.log("📦 AppKit EVM: Modules loaded");
52
+ }
53
+ const wagmiAdapter = new WagmiAdapter({
54
+ projectId: WALLETCONNECT_PROJECT_ID,
55
+ networks: wagmiConfig.chains,
56
+ transports: chainTransports
57
+ });
58
+ if (FEATURES.debugWalletConnect) {
59
+ console.log("🔗 AppKit EVM: Wagmi adapter created");
60
+ console.log("📋 Supported chains:", wagmiConfig.chains.map((c) => c.name).join(", "));
61
+ }
62
+ const modal = createAppKit({
63
+ adapters: [wagmiAdapter],
64
+ projectId: WALLETCONNECT_PROJECT_ID,
65
+ networks: wagmiConfig.chains,
66
+ metadata: getAppMetadata(),
67
+ features: {
68
+ analytics: false,
69
+ // Disable analytics to reduce bundle size
70
+ email: false,
71
+ // Disable email login (not needed for crypto payments)
72
+ socials: []
73
+ // No social login
74
+ },
75
+ featuredWalletIds: getFeaturedWallets(),
76
+ themeMode: "light",
77
+ // Match Coinley branding
78
+ themeVariables: {
79
+ "--w3m-accent": "#7042D2",
80
+ // Coinley purple
81
+ "--w3m-border-radius-master": "8px"
82
+ }
83
+ });
84
+ appKitInstance = modal;
85
+ if (FEATURES.debugWalletConnect) {
86
+ console.log("✅ AppKit EVM: Initialized successfully");
87
+ }
88
+ return modal;
89
+ } catch (error) {
90
+ console.error("❌ AppKit EVM: Initialization failed", error);
91
+ throw error;
92
+ } finally {
93
+ isInitializing = false;
94
+ }
95
+ })();
96
+ return initializationPromise;
97
+ };
98
+ const openAppKitModal = async () => {
99
+ if (!appKitInstance) {
100
+ throw new Error("AppKit not initialized. Call initializeAppKitEVM first.");
101
+ }
102
+ try {
103
+ await appKitInstance.open();
104
+ if (FEATURES.debugWalletConnect) {
105
+ console.log("📱 AppKit EVM: Modal opened");
106
+ }
107
+ } catch (error) {
108
+ console.error("❌ AppKit EVM: Failed to open modal", error);
109
+ throw error;
110
+ }
111
+ };
112
+ const closeAppKitModal = () => {
113
+ if (appKitInstance) {
114
+ appKitInstance.close();
115
+ if (FEATURES.debugWalletConnect) {
116
+ console.log("📱 AppKit EVM: Modal closed");
117
+ }
118
+ }
119
+ };
120
+ const getAppKitInstance = () => appKitInstance;
121
+ const resetAppKitInstance = () => {
122
+ if (FEATURES.debugWalletConnect) {
123
+ console.log("🔄 AppKit EVM: Resetting instance");
124
+ }
125
+ appKitInstance = null;
126
+ isInitializing = false;
127
+ initializationPromise = null;
128
+ };
129
+ const isAppKitReady = () => appKitInstance !== null;
130
+ export {
131
+ closeAppKitModal,
132
+ getAppKitInstance,
133
+ initializeAppKitEVM,
134
+ isAppKitReady,
135
+ openAppKitModal,
136
+ resetAppKitInstance
137
+ };
138
+ //# sourceMappingURL=appKitEVM--bpTC7Do.js.map
@@ -0,0 +1,309 @@
1
+ import { F as FEATURES, W as WALLETCONNECT_PROJECT_ID } from "./CoinleyPayment-BA2ym_mw.js";
2
+ const logo = "https://coinley.io/logo.png";
3
+ let appKitInstance = null;
4
+ let isInitializing = false;
5
+ let initializationPromise = null;
6
+ const getAppMetadata = () => ({
7
+ name: "Coinley Payment",
8
+ description: "Crypto Payment Gateway - Accept Solana payments from 600+ wallets",
9
+ url: typeof window !== "undefined" ? window.location.origin : "https://coinley.io",
10
+ icons: [logo]
11
+ });
12
+ const getFeaturedSolanaWallets = () => [
13
+ "7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",
14
+ // Phantom
15
+ "971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",
16
+ // OKX Wallet
17
+ "1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",
18
+ // Rainbow
19
+ "38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662"
20
+ // Bitget Wallet
21
+ ];
22
+ const initializeAppKitSolana = async (solanaWallet) => {
23
+ if (appKitInstance) {
24
+ if (FEATURES.debugWalletConnect) {
25
+ console.log("✅ AppKit Solana: Using existing instance");
26
+ }
27
+ try {
28
+ await appKitInstance.open();
29
+ if (FEATURES.debugWalletConnect) {
30
+ console.log("📱 AppKit Solana: Modal reopened");
31
+ }
32
+ } catch (openError) {
33
+ console.error("❌ AppKit Solana: Failed to open modal", openError);
34
+ }
35
+ return appKitInstance;
36
+ }
37
+ if (isInitializing) {
38
+ if (FEATURES.debugWalletConnect) {
39
+ console.log("⏳ AppKit Solana: Waiting for initialization...");
40
+ }
41
+ return initializationPromise;
42
+ }
43
+ isInitializing = true;
44
+ initializationPromise = (async () => {
45
+ try {
46
+ if (FEATURES.debugWalletConnect) {
47
+ console.log("🚀 AppKit Solana: Starting lazy load...");
48
+ console.time("AppKit Solana Load Time");
49
+ }
50
+ const { createAppKit } = await import("@reown/appkit/react");
51
+ const { SolanaAdapter } = await import("@reown/appkit-adapter-solana/react");
52
+ const { solana } = await import("@reown/appkit/networks");
53
+ if (FEATURES.debugWalletConnect) {
54
+ console.timeEnd("AppKit Solana Load Time");
55
+ console.log("📦 AppKit Solana: Modules loaded");
56
+ }
57
+ const solanaChain = solana;
58
+ if (FEATURES.debugWalletConnect) {
59
+ console.log("🔗 Using Solana chain:", solanaChain);
60
+ }
61
+ const solanaAdapter = new SolanaAdapter({
62
+ wallets: []
63
+ // Empty - only WalletConnect, no browser extension auto-detection
64
+ });
65
+ if (FEATURES.debugWalletConnect) {
66
+ console.log("🔗 AppKit Solana: Adapter created");
67
+ console.log("📋 Network: Solana Mainnet");
68
+ console.log("📋 Chain config:", solanaChain);
69
+ }
70
+ const modal = createAppKit({
71
+ adapters: [solanaAdapter],
72
+ projectId: WALLETCONNECT_PROJECT_ID,
73
+ networks: [solanaChain],
74
+ defaultNetwork: solanaChain,
75
+ metadata: getAppMetadata(),
76
+ features: {
77
+ analytics: false,
78
+ // Disable analytics to reduce bundle size
79
+ email: false,
80
+ // Disable email login (not needed for crypto payments)
81
+ socials: [],
82
+ // No social login
83
+ onramp: false,
84
+ // Disable on-ramp
85
+ swaps: false
86
+ // Disable swaps
87
+ },
88
+ featuredWalletIds: getFeaturedSolanaWallets(),
89
+ includeWalletIds: [
90
+ // Explicitly include Solana-compatible wallets
91
+ "7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",
92
+ // Phantom
93
+ "971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",
94
+ // OKX Wallet
95
+ "1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",
96
+ // Rainbow
97
+ "38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",
98
+ // Bitget Wallet
99
+ "c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",
100
+ // MetaMask (for Solana Snaps)
101
+ "225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",
102
+ // Safe
103
+ "fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",
104
+ // Coinbase Wallet
105
+ "4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0"
106
+ // Trust Wallet
107
+ ],
108
+ themeMode: "light",
109
+ // Match Coinley branding
110
+ themeVariables: {
111
+ "--w3m-accent": "#7042D2",
112
+ // Coinley purple
113
+ "--w3m-border-radius-master": "8px"
114
+ }
115
+ });
116
+ appKitInstance = modal;
117
+ if (FEATURES.debugWalletConnect) {
118
+ console.log("✅ AppKit Solana: Initialized successfully");
119
+ }
120
+ try {
121
+ const currentState = modal.getState ? modal.getState() : {};
122
+ if (currentState.isConnected || currentState.address) {
123
+ if (FEATURES.debugWalletConnect) {
124
+ console.log("🔌 Disconnecting previous session before opening modal...");
125
+ }
126
+ await modal.disconnect();
127
+ }
128
+ } catch (disconnectError) {
129
+ if (FEATURES.debugWalletConnect) {
130
+ console.log("No previous session to disconnect");
131
+ }
132
+ }
133
+ try {
134
+ await modal.open();
135
+ if (FEATURES.debugWalletConnect) {
136
+ console.log("📱 AppKit Solana: Modal opened");
137
+ }
138
+ } catch (openError) {
139
+ console.error("❌ AppKit Solana: Failed to open modal", openError);
140
+ }
141
+ return modal;
142
+ } catch (error) {
143
+ console.error("❌ AppKit Solana: Initialization failed", error);
144
+ throw error;
145
+ } finally {
146
+ isInitializing = false;
147
+ }
148
+ })();
149
+ return initializationPromise;
150
+ };
151
+ const openAppKitModalSolana = async () => {
152
+ if (!appKitInstance) {
153
+ throw new Error("AppKit Solana not initialized. Call initializeAppKitSolana first.");
154
+ }
155
+ try {
156
+ await appKitInstance.open();
157
+ if (FEATURES.debugWalletConnect) {
158
+ console.log("📱 AppKit Solana: Modal opened");
159
+ }
160
+ } catch (error) {
161
+ console.error("❌ AppKit Solana: Failed to open modal", error);
162
+ throw error;
163
+ }
164
+ };
165
+ const closeAppKitModalSolana = () => {
166
+ if (appKitInstance) {
167
+ appKitInstance.close();
168
+ if (FEATURES.debugWalletConnect) {
169
+ console.log("📱 AppKit Solana: Modal closed");
170
+ }
171
+ }
172
+ };
173
+ const getAppKitInstanceSolana = () => appKitInstance;
174
+ const getConnectedAddress = () => {
175
+ if (!appKitInstance) return null;
176
+ try {
177
+ const state = appKitInstance.getState();
178
+ return (state == null ? void 0 : state.address) || null;
179
+ } catch (error) {
180
+ console.error("Error getting connected address:", error);
181
+ return null;
182
+ }
183
+ };
184
+ const getConnectionState = () => {
185
+ if (!appKitInstance) return null;
186
+ try {
187
+ const state = appKitInstance.getState();
188
+ return {
189
+ address: (state == null ? void 0 : state.address) || null,
190
+ isConnected: (state == null ? void 0 : state.isConnected) || false,
191
+ chainId: (state == null ? void 0 : state.selectedNetworkId) || null
192
+ };
193
+ } catch (error) {
194
+ console.error("Error getting connection state:", error);
195
+ return null;
196
+ }
197
+ };
198
+ const createWalletConnectAdapter = (address) => {
199
+ if (!address) {
200
+ throw new Error("No address provided for WalletConnect adapter");
201
+ }
202
+ console.log("📝 Creating WalletConnect adapter for address:", address);
203
+ return {
204
+ publicKey: {
205
+ toString: () => address,
206
+ toBase58: () => address
207
+ },
208
+ connected: true,
209
+ connecting: false,
210
+ disconnect: async () => {
211
+ await disconnectWalletConnect();
212
+ },
213
+ // Implement actual transaction signing via AppKit
214
+ signTransaction: async (transaction) => {
215
+ if (!appKitInstance) {
216
+ throw new Error("AppKit not initialized");
217
+ }
218
+ console.log("🔏 Signing transaction via WalletConnect...");
219
+ try {
220
+ const provider = appKitInstance.getWalletProvider();
221
+ if (!provider || !provider.signTransaction) {
222
+ throw new Error("WalletConnect provider not available or does not support signing");
223
+ }
224
+ const serializedTx = transaction.serialize({
225
+ requireAllSignatures: false,
226
+ verifySignatures: false
227
+ });
228
+ console.log("📤 Sending transaction to wallet for signing...");
229
+ const signedTransaction = await provider.signTransaction(transaction);
230
+ console.log("✅ Transaction signed successfully");
231
+ return signedTransaction;
232
+ } catch (error) {
233
+ console.error("❌ Transaction signing failed:", error);
234
+ throw new Error(`Failed to sign transaction: ${error.message}`);
235
+ }
236
+ },
237
+ signAllTransactions: async (transactions) => {
238
+ if (!appKitInstance) {
239
+ throw new Error("AppKit not initialized");
240
+ }
241
+ console.log("🔏 Signing multiple transactions via WalletConnect...");
242
+ try {
243
+ const provider = appKitInstance.getWalletProvider();
244
+ if (!provider || !provider.signAllTransactions) {
245
+ throw new Error("WalletConnect provider not available or does not support batch signing");
246
+ }
247
+ console.log(`📤 Sending ${transactions.length} transactions to wallet for signing...`);
248
+ const signedTransactions = await provider.signAllTransactions(transactions);
249
+ console.log("✅ All transactions signed successfully");
250
+ return signedTransactions;
251
+ } catch (error) {
252
+ console.error("❌ Batch transaction signing failed:", error);
253
+ throw new Error(`Failed to sign transactions: ${error.message}`);
254
+ }
255
+ },
256
+ signMessage: async (message) => {
257
+ if (!appKitInstance) {
258
+ throw new Error("AppKit not initialized");
259
+ }
260
+ console.log("🔏 Signing message via WalletConnect...");
261
+ try {
262
+ const provider = appKitInstance.getWalletProvider();
263
+ if (!provider || !provider.signMessage) {
264
+ throw new Error("WalletConnect provider does not support message signing");
265
+ }
266
+ const signedMessage = await provider.signMessage(message);
267
+ console.log("✅ Message signed successfully");
268
+ return signedMessage;
269
+ } catch (error) {
270
+ console.error("❌ Message signing failed:", error);
271
+ throw new Error(`Failed to sign message: ${error.message}`);
272
+ }
273
+ }
274
+ };
275
+ };
276
+ const disconnectWalletConnect = async () => {
277
+ if (appKitInstance) {
278
+ try {
279
+ await appKitInstance.disconnect();
280
+ if (FEATURES.debugWalletConnect) {
281
+ console.log("🔌 AppKit Solana: Disconnected");
282
+ }
283
+ } catch (error) {
284
+ console.error("Error disconnecting WalletConnect:", error);
285
+ }
286
+ }
287
+ };
288
+ const resetAppKitInstanceSolana = () => {
289
+ if (FEATURES.debugWalletConnect) {
290
+ console.log("🔄 AppKit Solana: Resetting instance");
291
+ }
292
+ appKitInstance = null;
293
+ isInitializing = false;
294
+ initializationPromise = null;
295
+ };
296
+ const isAppKitReadySolana = () => appKitInstance !== null;
297
+ export {
298
+ closeAppKitModalSolana,
299
+ createWalletConnectAdapter,
300
+ disconnectWalletConnect,
301
+ getAppKitInstanceSolana,
302
+ getConnectedAddress,
303
+ getConnectionState,
304
+ initializeAppKitSolana,
305
+ isAppKitReadySolana,
306
+ openAppKitModalSolana,
307
+ resetAppKitInstanceSolana
308
+ };
309
+ //# sourceMappingURL=appKitSolana-DUo_eFgJ.js.map