coinley-checkout 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -165,22 +165,32 @@ const TOKEN_CONFIG = {
|
|
165
165
|
}
|
166
166
|
}
|
167
167
|
};
|
168
|
-
let Web3Cache = null;
|
169
168
|
const getWeb3Instance = () => __async(void 0, null, function* () {
|
170
|
-
if (Web3Cache) {
|
171
|
-
return Web3Cache;
|
172
|
-
}
|
173
169
|
try {
|
174
|
-
if (typeof window
|
175
|
-
|
176
|
-
|
170
|
+
if (typeof window === "undefined" || !window.ethereum) {
|
171
|
+
throw new Error("No ethereum provider found");
|
172
|
+
}
|
173
|
+
let Web3Class = null;
|
174
|
+
try {
|
175
|
+
const Web3Module = yield import("web3");
|
176
|
+
Web3Class = Web3Module.default || Web3Module.Web3 || Web3Module;
|
177
|
+
console.log("Web3 imported via dynamic import:", Web3Class);
|
178
|
+
} catch (importError) {
|
179
|
+
console.log("Dynamic import failed, trying global Web3:", importError);
|
180
|
+
if (typeof window !== "undefined" && window.Web3) {
|
181
|
+
Web3Class = window.Web3;
|
182
|
+
console.log("Using global Web3:", Web3Class);
|
183
|
+
}
|
177
184
|
}
|
178
|
-
|
179
|
-
|
180
|
-
|
185
|
+
if (!Web3Class) {
|
186
|
+
throw new Error("Web3 not available. Please ensure web3 is installed or MetaMask is running.");
|
187
|
+
}
|
188
|
+
const web3Instance = new Web3Class(window.ethereum);
|
189
|
+
console.log("Web3 instance created successfully:", web3Instance);
|
190
|
+
return web3Instance;
|
181
191
|
} catch (error) {
|
182
192
|
console.error("Failed to load Web3:", error);
|
183
|
-
throw new Error(
|
193
|
+
throw new Error(`Web3 initialization failed: ${error.message}. Please ensure MetaMask is installed and running.`);
|
184
194
|
}
|
185
195
|
});
|
186
196
|
const detectWallets = () => {
|
@@ -211,6 +221,7 @@ const getSupportedWalletsForNetwork = (network) => {
|
|
211
221
|
return networkConfig.supportedWallets.filter((wallet) => availableWallets[wallet]);
|
212
222
|
};
|
213
223
|
const connectWallet = (walletType, network) => __async(void 0, null, function* () {
|
224
|
+
console.log("connectWallet called with:", { walletType, network });
|
214
225
|
switch (walletType) {
|
215
226
|
case WALLET_TYPES.METAMASK:
|
216
227
|
return yield connectMetaMask(network);
|
@@ -225,28 +236,41 @@ const connectWallet = (walletType, network) => __async(void 0, null, function* (
|
|
225
236
|
}
|
226
237
|
});
|
227
238
|
const connectMetaMask = (network) => __async(void 0, null, function* () {
|
228
|
-
|
239
|
+
console.log("Attempting to connect MetaMask for network:", network);
|
240
|
+
if (typeof window === "undefined" || !window.ethereum) {
|
229
241
|
throw new Error("MetaMask is not installed. Please install MetaMask extension.");
|
230
242
|
}
|
243
|
+
if (!window.ethereum.isMetaMask) {
|
244
|
+
console.warn("MetaMask not detected as primary provider");
|
245
|
+
}
|
231
246
|
try {
|
247
|
+
console.log("Requesting accounts from MetaMask...");
|
232
248
|
const accounts = yield window.ethereum.request({
|
233
249
|
method: "eth_requestAccounts"
|
234
250
|
});
|
251
|
+
console.log("Accounts received:", accounts);
|
235
252
|
if (!accounts || accounts.length === 0) {
|
236
|
-
throw new Error("No accounts found. Please unlock MetaMask.");
|
253
|
+
throw new Error("No accounts found. Please unlock MetaMask and ensure you have at least one account.");
|
237
254
|
}
|
238
255
|
const networkConfig = NETWORK_CONFIG[network];
|
239
256
|
if (networkConfig && networkConfig.chainId) {
|
257
|
+
console.log("Switching to network:", networkConfig.chainName);
|
240
258
|
yield switchEVMNetwork(networkConfig);
|
241
259
|
}
|
242
|
-
|
260
|
+
const connection = {
|
243
261
|
address: accounts[0],
|
244
262
|
network,
|
245
263
|
walletType: WALLET_TYPES.METAMASK
|
246
264
|
};
|
265
|
+
console.log("MetaMask connected successfully:", connection);
|
266
|
+
return connection;
|
247
267
|
} catch (error) {
|
268
|
+
console.error("MetaMask connection error:", error);
|
248
269
|
if (error.code === 4001) {
|
249
|
-
throw new Error("
|
270
|
+
throw new Error("Connection rejected by user. Please accept the connection request in MetaMask.");
|
271
|
+
}
|
272
|
+
if (error.code === -32002) {
|
273
|
+
throw new Error("Connection request already pending. Please check MetaMask.");
|
250
274
|
}
|
251
275
|
throw new Error(`Failed to connect MetaMask: ${error.message}`);
|
252
276
|
}
|
@@ -325,30 +349,37 @@ const switchEVMNetwork = (networkConfig) => __async(void 0, null, function* () {
|
|
325
349
|
throw new Error("Ethereum provider not found");
|
326
350
|
}
|
327
351
|
try {
|
352
|
+
console.log("Attempting to switch to:", networkConfig.chainName);
|
328
353
|
yield window.ethereum.request({
|
329
354
|
method: "wallet_switchEthereumChain",
|
330
355
|
params: [{ chainId: networkConfig.chainId }]
|
331
356
|
});
|
357
|
+
console.log("Network switched successfully");
|
332
358
|
} catch (switchError) {
|
359
|
+
console.error("Network switch error:", switchError);
|
333
360
|
if (switchError.code === 4902) {
|
361
|
+
console.log("Network not found, attempting to add:", networkConfig.chainName);
|
334
362
|
try {
|
335
363
|
yield window.ethereum.request({
|
336
364
|
method: "wallet_addEthereumChain",
|
337
365
|
params: [networkConfig]
|
338
366
|
});
|
367
|
+
console.log("Network added successfully");
|
339
368
|
} catch (addError) {
|
340
|
-
|
369
|
+
console.error("Failed to add network:", addError);
|
370
|
+
throw new Error(`Failed to add ${networkConfig.chainName} to wallet. Please add it manually.`);
|
341
371
|
}
|
342
372
|
} else if (switchError.code === 4001) {
|
343
|
-
throw new Error("User rejected network switch request");
|
373
|
+
throw new Error("User rejected network switch request. Please switch network manually in MetaMask.");
|
344
374
|
} else {
|
345
|
-
throw new Error(`Failed to switch to ${networkConfig.chainName}
|
375
|
+
throw new Error(`Failed to switch to ${networkConfig.chainName}. Please switch manually in MetaMask.`);
|
346
376
|
}
|
347
377
|
}
|
348
378
|
});
|
349
379
|
const sendTransaction = (walletConnection, transactionData) => __async(void 0, null, function* () {
|
350
380
|
const { walletType, network, address } = walletConnection;
|
351
381
|
const { to, amount, tokenAddress, tokenDecimals } = transactionData;
|
382
|
+
console.log("sendTransaction called with:", { walletConnection, transactionData });
|
352
383
|
switch (walletType) {
|
353
384
|
case WALLET_TYPES.METAMASK:
|
354
385
|
case WALLET_TYPES.TRUST_WALLET:
|
@@ -362,16 +393,24 @@ const sendTransaction = (walletConnection, transactionData) => __async(void 0, n
|
|
362
393
|
}
|
363
394
|
});
|
364
395
|
const sendEVMTransaction = (from, to, amount, tokenAddress, tokenDecimals) => __async(void 0, null, function* () {
|
396
|
+
console.log("sendEVMTransaction called with:", { from, to, amount, tokenAddress, tokenDecimals });
|
365
397
|
if (typeof window === "undefined" || !window.ethereum) {
|
366
398
|
throw new Error("Ethereum provider not found");
|
367
399
|
}
|
368
400
|
try {
|
369
|
-
const
|
370
|
-
|
371
|
-
const
|
372
|
-
|
401
|
+
const web3 = yield getWeb3Instance();
|
402
|
+
console.log("Web3 instance obtained for transaction");
|
403
|
+
const decimals = tokenDecimals || 18;
|
404
|
+
const amountBN = web3.utils.toBN(
|
405
|
+
Math.floor(parseFloat(amount) * Math.pow(10, decimals)).toString()
|
373
406
|
);
|
407
|
+
console.log("Amount calculated:", {
|
408
|
+
originalAmount: amount,
|
409
|
+
decimals,
|
410
|
+
calculatedAmount: amountBN.toString()
|
411
|
+
});
|
374
412
|
if (tokenAddress && tokenAddress !== "native") {
|
413
|
+
console.log("Preparing ERC20 token transfer...");
|
375
414
|
const tokenABI = [
|
376
415
|
{
|
377
416
|
constant: false,
|
@@ -387,21 +426,32 @@ const sendEVMTransaction = (from, to, amount, tokenAddress, tokenDecimals) => __
|
|
387
426
|
}
|
388
427
|
];
|
389
428
|
const contract = new web3.eth.Contract(tokenABI, tokenAddress);
|
390
|
-
|
429
|
+
console.log("Contract created, sending transaction...");
|
430
|
+
const receipt = yield contract.methods.transfer(to, amountBN.toString()).send({ from });
|
431
|
+
console.log("ERC20 transaction successful:", receipt.transactionHash);
|
391
432
|
return receipt.transactionHash;
|
392
433
|
} else {
|
434
|
+
console.log("Preparing native token transfer...");
|
393
435
|
const receipt = yield web3.eth.sendTransaction({
|
394
436
|
from,
|
395
437
|
to,
|
396
|
-
value:
|
438
|
+
value: amountBN.toString()
|
397
439
|
});
|
440
|
+
console.log("Native transaction successful:", receipt.transactionHash);
|
398
441
|
return receipt.transactionHash;
|
399
442
|
}
|
400
443
|
} catch (error) {
|
444
|
+
console.error("EVM transaction error:", error);
|
401
445
|
if (error.code === 4001) {
|
402
446
|
throw new Error("Transaction was rejected by user");
|
403
447
|
}
|
404
|
-
|
448
|
+
if (error.message && error.message.includes("insufficient funds")) {
|
449
|
+
throw new Error("Insufficient funds to complete the transaction");
|
450
|
+
}
|
451
|
+
if (error.message && error.message.includes("gas")) {
|
452
|
+
throw new Error("Transaction failed due to gas estimation issues. Please try again.");
|
453
|
+
}
|
454
|
+
throw new Error(`Transaction failed: ${error.message || "Unknown error"}`);
|
405
455
|
}
|
406
456
|
});
|
407
457
|
const sendTronTransaction = (to, amount, tokenAddress, tokenDecimals) => __async(void 0, null, function* () {
|
@@ -2285,6 +2335,29 @@ const PaymentMethods = ({ onSelect, selected, theme = "light", supportedNetworks
|
|
2285
2335
|
};
|
2286
2336
|
const availableMethods = getPaymentMethodsForNetwork(selectedNetwork);
|
2287
2337
|
const visibleMethods = showMore ? availableMethods : availableMethods.slice(0, 4);
|
2338
|
+
function getRequiredWallet(network) {
|
2339
|
+
switch (network) {
|
2340
|
+
case NETWORK_TYPES.ETHEREUM:
|
2341
|
+
case NETWORK_TYPES.BSC:
|
2342
|
+
return WALLET_TYPES.METAMASK;
|
2343
|
+
case NETWORK_TYPES.TRON:
|
2344
|
+
return WALLET_TYPES.TRONLINK;
|
2345
|
+
case NETWORK_TYPES.ALGORAND:
|
2346
|
+
return WALLET_TYPES.LUTE;
|
2347
|
+
default:
|
2348
|
+
return WALLET_TYPES.METAMASK;
|
2349
|
+
}
|
2350
|
+
}
|
2351
|
+
function getNetworkRequirement(network) {
|
2352
|
+
const wallet = getRequiredWallet(network);
|
2353
|
+
const isAvailable = availableWallets[wallet];
|
2354
|
+
const walletNames = {
|
2355
|
+
[WALLET_TYPES.METAMASK]: "MetaMask",
|
2356
|
+
[WALLET_TYPES.TRONLINK]: "TronLink",
|
2357
|
+
[WALLET_TYPES.LUTE]: "Lute Wallet"
|
2358
|
+
};
|
2359
|
+
return isAvailable ? `${walletNames[wallet]} detected - Ready to pay` : `${walletNames[wallet]} required - Please install to continue`;
|
2360
|
+
}
|
2288
2361
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
2289
2362
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-lg font-medium mb-4 ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "Select Payment Method" }),
|
2290
2363
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6", children: [
|
@@ -2351,29 +2424,6 @@ const PaymentMethods = ({ onSelect, selected, theme = "light", supportedNetworks
|
|
2351
2424
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs", children: getNetworkRequirement(selectedNetwork) })
|
2352
2425
|
] }) })
|
2353
2426
|
] });
|
2354
|
-
function getRequiredWallet(network) {
|
2355
|
-
switch (network) {
|
2356
|
-
case NETWORK_TYPES.ETHEREUM:
|
2357
|
-
case NETWORK_TYPES.BSC:
|
2358
|
-
return "metamask";
|
2359
|
-
case NETWORK_TYPES.TRON:
|
2360
|
-
return "tronlink";
|
2361
|
-
case NETWORK_TYPES.ALGORAND:
|
2362
|
-
return "lute";
|
2363
|
-
default:
|
2364
|
-
return "metamask";
|
2365
|
-
}
|
2366
|
-
}
|
2367
|
-
function getNetworkRequirement(network) {
|
2368
|
-
const wallet = getRequiredWallet(network);
|
2369
|
-
const isAvailable = availableWallets[wallet];
|
2370
|
-
const walletNames = {
|
2371
|
-
metamask: "MetaMask",
|
2372
|
-
tronlink: "TronLink",
|
2373
|
-
lute: "Lute Wallet"
|
2374
|
-
};
|
2375
|
-
return isAvailable ? `${walletNames[wallet]} detected - Ready to pay` : `${walletNames[wallet]} required - Please install to continue`;
|
2376
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hDlGgZgmuQLdT8HBmi1Hjfl3HnO2wbEhT2qWDniAeNIdD+z6jqQlXcuHL6MMHFYpEuDfYo2sSUtsPzQiDs6CQySTQgRldkWU6UKf+KRROxOaR4h5cF0kzk+pm2qdydUJF2D8yXH3NyPP21tf9dbYdOkDAOU3JFtF6R76EraO9PrfJC39hZv5NidG835b085Eb3qi4G/A2inrQKnVgMFAAAAABJRU5ErkJggg==";
|
2379
2429
|
const CoinleyModal = ({
|
@@ -2397,7 +2447,6 @@ const CoinleyModal = ({
|
|
2397
2447
|
supportedWallets = [],
|
2398
2448
|
step = "select-currency",
|
2399
2449
|
merchantWalletAddresses = {}
|
2400
|
-
// Add this prop
|
2401
2450
|
}) => {
|
2402
2451
|
const [paymentType, setPaymentType] = useState("wallet");
|
2403
2452
|
const getWalletAddressForNetwork = () => {
|
@@ -2495,8 +2544,12 @@ const CoinleyModal = ({
|
|
2495
2544
|
selectedPaymentMethod && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
2496
2545
|
"button",
|
2497
2546
|
{
|
2498
|
-
onClick: () =>
|
2547
|
+
onClick: () => {
|
2548
|
+
console.log("Proceed button clicked, calling onPaymentMethodSelect");
|
2549
|
+
onPaymentMethodSelect(selectedPaymentMethod);
|
2550
|
+
},
|
2499
2551
|
className: "w-full py-3 px-4 bg-[#7042D2] hover:bg-[#7042D2] text-white font-medium rounded-lg transition-colors",
|
2552
|
+
disabled: !selectedPaymentMethod,
|
2500
2553
|
children: [
|
2501
2554
|
"Proceed with ",
|
2502
2555
|
selectedPaymentMethod.currency,
|
@@ -2603,7 +2656,10 @@ const CoinleyModal = ({
|
|
2603
2656
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
2604
2657
|
"button",
|
2605
2658
|
{
|
2606
|
-
onClick: () =>
|
2659
|
+
onClick: () => {
|
2660
|
+
console.log("Connect wallet button clicked for:", walletType);
|
2661
|
+
onConnectWallet(walletType);
|
2662
|
+
},
|
2607
2663
|
className: "py-2 px-4 bg-[#7042D2] hover:bg-[#7042D2] text-white font-medium rounded-md text-sm",
|
2608
2664
|
children: "Connect"
|
2609
2665
|
}
|
@@ -2829,9 +2885,14 @@ const CoinleyCheckout = forwardRef(({
|
|
2829
2885
|
onClose();
|
2830
2886
|
};
|
2831
2887
|
const handlePaymentMethodSelect = (paymentMethod) => {
|
2888
|
+
console.log("=== PAYMENT METHOD SELECTION DEBUG ===");
|
2889
|
+
console.log("1. Payment method selected:", paymentMethod);
|
2890
|
+
console.log("2. Current step before:", step);
|
2832
2891
|
log("Payment method selected:", paymentMethod);
|
2833
2892
|
setSelectedPaymentMethod(paymentMethod);
|
2834
2893
|
setStep("confirm");
|
2894
|
+
console.log("3. Step should now be: confirm");
|
2895
|
+
console.log("=== END PAYMENT METHOD SELECTION DEBUG ===");
|
2835
2896
|
};
|
2836
2897
|
const handleBack = () => {
|
2837
2898
|
if (step === "confirm") {
|
@@ -2840,20 +2901,31 @@ const CoinleyCheckout = forwardRef(({
|
|
2840
2901
|
}
|
2841
2902
|
};
|
2842
2903
|
const handleConnectWallet = (walletType) => __async(void 0, null, function* () {
|
2904
|
+
console.log("=== WALLET CONNECTION DEBUG ===");
|
2905
|
+
console.log("1. Wallet type requested:", walletType);
|
2906
|
+
console.log("2. Selected payment method:", selectedPaymentMethod);
|
2907
|
+
console.log("3. Available wallets:", availableWallets);
|
2908
|
+
console.log("4. Current step:", step);
|
2843
2909
|
if (!selectedPaymentMethod) {
|
2910
|
+
console.error("No payment method selected");
|
2844
2911
|
setError("Please select a payment method first");
|
2845
2912
|
return;
|
2846
2913
|
}
|
2847
2914
|
try {
|
2915
|
+
console.log("5. Attempting to connect wallet...");
|
2916
|
+
setError(null);
|
2848
2917
|
log("Connecting wallet:", { walletType, network: selectedPaymentMethod.network });
|
2849
2918
|
const connection = yield connectWallet(walletType, selectedPaymentMethod.network);
|
2850
2919
|
setWalletConnection(connection);
|
2851
2920
|
setError(null);
|
2921
|
+
console.log("6. Connection successful:", connection);
|
2852
2922
|
log("Wallet connected successfully:", connection);
|
2853
2923
|
} catch (err) {
|
2924
|
+
console.error("7. Connection failed:", err);
|
2854
2925
|
log("Wallet connection error:", err);
|
2855
2926
|
setError(err.message || "Failed to connect wallet");
|
2856
2927
|
}
|
2928
|
+
console.log("=== END WALLET CONNECTION DEBUG ===");
|
2857
2929
|
});
|
2858
2930
|
const handlePayment = () => __async(void 0, null, function* () {
|
2859
2931
|
var _a, _b;
|