coinley-checkout 0.8.3 → 0.8.5
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.
@@ -18329,11 +18329,7 @@ const WALLET_TYPES = {
|
|
18329
18329
|
METAMASK: "metamask",
|
18330
18330
|
TRONLINK: "tronlink",
|
18331
18331
|
TRUST_WALLET: "trustwallet",
|
18332
|
-
LUTE: "lute"
|
18333
|
-
PERA: "pera",
|
18334
|
-
ALGOSIGNER: "algosigner",
|
18335
|
-
DEFLY: "defly",
|
18336
|
-
EXODUS: "exodus"
|
18332
|
+
LUTE: "lute"
|
18337
18333
|
};
|
18338
18334
|
const NETWORK_TYPES = {
|
18339
18335
|
ETHEREUM: "ethereum",
|
@@ -18451,59 +18447,59 @@ const NETWORK_WALLET_MAP = {
|
|
18451
18447
|
[NETWORK_TYPES.ETHEREUM]: [WALLET_TYPES.METAMASK, WALLET_TYPES.TRUST_WALLET],
|
18452
18448
|
[NETWORK_TYPES.BSC]: [WALLET_TYPES.METAMASK, WALLET_TYPES.TRUST_WALLET],
|
18453
18449
|
[NETWORK_TYPES.TRON]: [WALLET_TYPES.TRONLINK],
|
18454
|
-
[NETWORK_TYPES.ALGORAND]: [WALLET_TYPES.
|
18450
|
+
[NETWORK_TYPES.ALGORAND]: [WALLET_TYPES.LUTE]
|
18455
18451
|
};
|
18456
18452
|
const getWalletInstallUrl = (walletType) => {
|
18457
18453
|
const urls = {
|
18458
18454
|
[WALLET_TYPES.METAMASK]: "https://metamask.io/download/",
|
18459
18455
|
[WALLET_TYPES.TRONLINK]: "https://www.tronlink.org/download/",
|
18460
18456
|
[WALLET_TYPES.TRUST_WALLET]: "https://trustwallet.com/download/",
|
18461
|
-
[WALLET_TYPES.LUTE]: "https://lute.app/download/"
|
18462
|
-
[WALLET_TYPES.PERA]: "https://perawallet.app/",
|
18463
|
-
[WALLET_TYPES.ALGOSIGNER]: "https://chrome.google.com/webstore/detail/algosigner/kmmolakhbgdlpkjkcjkebenjheonagdm",
|
18464
|
-
[WALLET_TYPES.DEFLY]: "https://defly.app/",
|
18465
|
-
[WALLET_TYPES.EXODUS]: "https://www.exodus.com/download/"
|
18457
|
+
[WALLET_TYPES.LUTE]: "https://lute.app/download/"
|
18466
18458
|
};
|
18467
18459
|
return urls[walletType] || "";
|
18468
18460
|
};
|
18469
|
-
const
|
18470
|
-
var _a2, _b, _c, _d, _e, _f;
|
18461
|
+
const detectLuteWallet = () => {
|
18471
18462
|
if (typeof window === "undefined")
|
18472
|
-
return
|
18473
|
-
const
|
18474
|
-
|
18475
|
-
|
18476
|
-
|
18477
|
-
|
18478
|
-
|
18479
|
-
|
18480
|
-
|
18481
|
-
|
18482
|
-
|
18483
|
-
|
18484
|
-
|
18485
|
-
(
|
18486
|
-
|
18487
|
-
|
18488
|
-
|
18489
|
-
|
18490
|
-
|
18491
|
-
|
18492
|
-
|
18493
|
-
|
18494
|
-
|
18495
|
-
console.log("Exodus Algorand:", Boolean((_f = window.exodus) == null ? void 0 : _f.algorand));
|
18496
|
-
console.log("Final detection results:", algorandWallets);
|
18497
|
-
console.log("=== END ALGORAND DETECTION ===");
|
18498
|
-
return algorandWallets;
|
18463
|
+
return false;
|
18464
|
+
const luteDetectionMethods = [
|
18465
|
+
// Check for window.lute
|
18466
|
+
() => window.lute !== void 0,
|
18467
|
+
// Check for window.algorand (some Algorand wallets use this)
|
18468
|
+
() => window.algorand !== void 0,
|
18469
|
+
// Check for AlgoSigner (alternative Algorand wallet)
|
18470
|
+
() => window.AlgoSigner !== void 0,
|
18471
|
+
// Check for specific Lute wallet identifiers
|
18472
|
+
() => window.luteWallet !== void 0,
|
18473
|
+
// Check for wallet extension in DOM
|
18474
|
+
() => document.querySelector('[data-wallet="lute"]') !== null,
|
18475
|
+
// Check if Lute is injected via content script
|
18476
|
+
() => window.postMessage && document.documentElement.getAttribute("data-lute-extension") === "true"
|
18477
|
+
];
|
18478
|
+
return luteDetectionMethods.some((method) => {
|
18479
|
+
try {
|
18480
|
+
return method();
|
18481
|
+
} catch (error) {
|
18482
|
+
console.warn("Lute detection method failed:", error);
|
18483
|
+
return false;
|
18484
|
+
}
|
18485
|
+
});
|
18499
18486
|
};
|
18500
18487
|
const detectWallets = () => {
|
18501
|
-
const
|
18502
|
-
const availableWallets = __spreadValues({
|
18488
|
+
const availableWallets = {
|
18503
18489
|
[WALLET_TYPES.METAMASK]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isMetaMask,
|
18504
18490
|
[WALLET_TYPES.TRONLINK]: typeof window !== "undefined" && window.tronWeb !== void 0,
|
18505
|
-
[WALLET_TYPES.TRUST_WALLET]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isTrust === true
|
18506
|
-
|
18491
|
+
[WALLET_TYPES.TRUST_WALLET]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isTrust === true,
|
18492
|
+
[WALLET_TYPES.LUTE]: detectLuteWallet()
|
18493
|
+
};
|
18494
|
+
if (typeof window !== "undefined") {
|
18495
|
+
console.log("=== LUTE WALLET DETECTION DEBUG ===");
|
18496
|
+
console.log("window.lute:", Boolean(window.lute));
|
18497
|
+
console.log("window.algorand:", Boolean(window.algorand));
|
18498
|
+
console.log("window.AlgoSigner:", Boolean(window.AlgoSigner));
|
18499
|
+
console.log("window.luteWallet:", Boolean(window.luteWallet));
|
18500
|
+
console.log("Lute detected overall:", availableWallets[WALLET_TYPES.LUTE]);
|
18501
|
+
console.log("=== END LUTE DETECTION DEBUG ===");
|
18502
|
+
}
|
18507
18503
|
return availableWallets;
|
18508
18504
|
};
|
18509
18505
|
const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0, null, function* () {
|
@@ -18512,7 +18508,6 @@ const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0,
|
|
18512
18508
|
while (retries < maxRetries) {
|
18513
18509
|
wallets = detectWallets();
|
18514
18510
|
const hasAnyWallet = Object.values(wallets).some((v) => v === true);
|
18515
|
-
[WALLET_TYPES.PERA, WALLET_TYPES.ALGOSIGNER, WALLET_TYPES.DEFLY, WALLET_TYPES.LUTE, WALLET_TYPES.EXODUS].some((wallet) => wallets[wallet]);
|
18516
18511
|
if (hasAnyWallet || retries >= maxRetries - 1) {
|
18517
18512
|
break;
|
18518
18513
|
}
|
@@ -18521,19 +18516,16 @@ const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0,
|
|
18521
18516
|
yield new Promise((resolve) => setTimeout(resolve, delay));
|
18522
18517
|
retries++;
|
18523
18518
|
}
|
18524
|
-
if (!
|
18525
|
-
console.log("Performing extended
|
18519
|
+
if (!wallets[WALLET_TYPES.LUTE]) {
|
18520
|
+
console.log("Performing extended Lute wallet detection...");
|
18526
18521
|
if (typeof window !== "undefined") {
|
18527
18522
|
try {
|
18528
|
-
const
|
18529
|
-
|
18530
|
-
|
18531
|
-
|
18532
|
-
});
|
18533
|
-
yield new Promise((resolve) => setTimeout(resolve, 1e3));
|
18534
|
-
wallets = detectWallets();
|
18523
|
+
const event = new CustomEvent("lute-wallet-detect", { detail: { source: "coinley-sdk" } });
|
18524
|
+
window.dispatchEvent(event);
|
18525
|
+
yield new Promise((resolve) => setTimeout(resolve, 500));
|
18526
|
+
wallets[WALLET_TYPES.LUTE] = detectLuteWallet();
|
18535
18527
|
} catch (error) {
|
18536
|
-
console.warn("Extended
|
18528
|
+
console.warn("Extended Lute detection failed:", error);
|
18537
18529
|
}
|
18538
18530
|
}
|
18539
18531
|
}
|
@@ -18541,17 +18533,13 @@ const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0,
|
|
18541
18533
|
return wallets;
|
18542
18534
|
});
|
18543
18535
|
const debugWalletEnvironment = () => {
|
18544
|
-
var _a2
|
18536
|
+
var _a2;
|
18545
18537
|
console.log("=== WALLET ENVIRONMENT DEBUG ===");
|
18546
18538
|
console.log("ethereum:", typeof window !== "undefined" ? Boolean(window.ethereum) : "Not in browser");
|
18547
18539
|
console.log("tronWeb:", typeof window !== "undefined" ? Boolean(window.tronWeb) : "Not in browser");
|
18548
|
-
console.log("=== ALGORAND WALLETS ===");
|
18549
|
-
console.log("PeraWallet:", typeof window !== "undefined" ? Boolean(window.PeraWallet) : "Not in browser");
|
18550
|
-
console.log("AlgoSigner:", typeof window !== "undefined" ? Boolean(window.AlgoSigner) : "Not in browser");
|
18551
|
-
console.log("DeflyWallet:", typeof window !== "undefined" ? Boolean(window.DeflyWallet) : "Not in browser");
|
18552
18540
|
console.log("lute:", typeof window !== "undefined" ? Boolean(window.lute) : "Not in browser");
|
18553
|
-
console.log("exodus.algorand:", typeof window !== "undefined" ? Boolean((_a2 = window.exodus) == null ? void 0 : _a2.algorand) : "Not in browser");
|
18554
18541
|
console.log("algorand:", typeof window !== "undefined" ? Boolean(window.algorand) : "Not in browser");
|
18542
|
+
console.log("AlgoSigner:", typeof window !== "undefined" ? Boolean(window.AlgoSigner) : "Not in browser");
|
18555
18543
|
if (typeof window !== "undefined" && window.ethereum) {
|
18556
18544
|
console.log("ethereum details:", {
|
18557
18545
|
isTrust: window.ethereum.isTrust,
|
@@ -18562,14 +18550,14 @@ const debugWalletEnvironment = () => {
|
|
18562
18550
|
if (typeof window !== "undefined" && window.tronWeb) {
|
18563
18551
|
console.log("tronWeb details:", {
|
18564
18552
|
ready: window.tronWeb.ready,
|
18565
|
-
fullNode: (
|
18553
|
+
fullNode: (_a2 = window.tronWeb.fullNode) == null ? void 0 : _a2.host,
|
18566
18554
|
defaultAddress: window.tronWeb.defaultAddress
|
18567
18555
|
});
|
18568
18556
|
}
|
18569
18557
|
if (typeof window !== "undefined") {
|
18570
18558
|
console.log("All window wallet properties:");
|
18571
18559
|
const walletProps = Object.keys(window).filter(
|
18572
|
-
(key) => key.toLowerCase().includes("lute") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("
|
18560
|
+
(key) => key.toLowerCase().includes("lute") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("wallet")
|
18573
18561
|
);
|
18574
18562
|
console.log("Potential wallet properties:", walletProps);
|
18575
18563
|
}
|
@@ -18695,117 +18683,58 @@ const connectTronlinkWallet = () => __async(void 0, null, function* () {
|
|
18695
18683
|
throw error;
|
18696
18684
|
}
|
18697
18685
|
});
|
18698
|
-
const
|
18699
|
-
var _a2
|
18700
|
-
console.log(
|
18686
|
+
const connectLuteWallet = () => __async(void 0, null, function* () {
|
18687
|
+
var _a2;
|
18688
|
+
console.log("Connecting to Lute wallet...");
|
18701
18689
|
let walletProvider = null;
|
18702
18690
|
let walletName = "";
|
18703
|
-
|
18704
|
-
|
18705
|
-
|
18706
|
-
|
18707
|
-
|
18708
|
-
|
18709
|
-
|
18710
|
-
|
18711
|
-
|
18712
|
-
|
18713
|
-
|
18714
|
-
|
18715
|
-
break;
|
18716
|
-
case WALLET_TYPES.ALGOSIGNER:
|
18717
|
-
if (window.AlgoSigner) {
|
18718
|
-
walletProvider = window.AlgoSigner;
|
18719
|
-
walletName = "AlgoSigner";
|
18720
|
-
}
|
18721
|
-
break;
|
18722
|
-
case WALLET_TYPES.DEFLY:
|
18723
|
-
if (window.DeflyWallet) {
|
18724
|
-
walletProvider = window.DeflyWallet;
|
18725
|
-
walletName = "Defly Wallet";
|
18726
|
-
} else if (window.defly) {
|
18727
|
-
walletProvider = window.defly;
|
18728
|
-
walletName = "Defly Wallet (window.defly)";
|
18729
|
-
} else if ((_b = window.algorand) == null ? void 0 : _b.defly) {
|
18730
|
-
walletProvider = window.algorand.defly;
|
18731
|
-
walletName = "Defly Wallet (algorand.defly)";
|
18732
|
-
}
|
18733
|
-
break;
|
18734
|
-
case WALLET_TYPES.LUTE:
|
18735
|
-
if (window.lute) {
|
18736
|
-
walletProvider = window.lute;
|
18737
|
-
walletName = "Lute Wallet";
|
18738
|
-
} else if (window.luteWallet) {
|
18739
|
-
walletProvider = window.luteWallet;
|
18740
|
-
walletName = "Lute Wallet (luteWallet)";
|
18741
|
-
} else if ((_c = window.algorand) == null ? void 0 : _c.lute) {
|
18742
|
-
walletProvider = window.algorand.lute;
|
18743
|
-
walletName = "Lute Wallet (algorand.lute)";
|
18744
|
-
}
|
18745
|
-
break;
|
18746
|
-
case WALLET_TYPES.EXODUS:
|
18747
|
-
if ((_d = window.exodus) == null ? void 0 : _d.algorand) {
|
18748
|
-
walletProvider = window.exodus.algorand;
|
18749
|
-
walletName = "Exodus Wallet";
|
18750
|
-
}
|
18751
|
-
break;
|
18691
|
+
if (window.lute) {
|
18692
|
+
walletProvider = window.lute;
|
18693
|
+
walletName = "Lute";
|
18694
|
+
} else if (window.algorand) {
|
18695
|
+
walletProvider = window.algorand;
|
18696
|
+
walletName = "Algorand Provider";
|
18697
|
+
} else if (window.AlgoSigner) {
|
18698
|
+
walletProvider = window.AlgoSigner;
|
18699
|
+
walletName = "AlgoSigner";
|
18700
|
+
} else if (window.luteWallet) {
|
18701
|
+
walletProvider = window.luteWallet;
|
18702
|
+
walletName = "Lute Wallet";
|
18752
18703
|
}
|
18753
18704
|
if (!walletProvider) {
|
18754
|
-
console.error(
|
18705
|
+
console.error("No Algorand wallet detected.");
|
18755
18706
|
console.log("Available window properties:", Object.keys(window).filter(
|
18756
|
-
(key) => key.toLowerCase().includes("
|
18707
|
+
(key) => key.toLowerCase().includes("lute") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("wallet")
|
18757
18708
|
));
|
18758
|
-
throw new Error(
|
18709
|
+
throw new Error("Lute wallet not detected. Please install Lute extension or another Algorand wallet.");
|
18759
18710
|
}
|
18760
18711
|
console.log(`Found ${walletName} wallet provider:`, walletProvider);
|
18761
18712
|
try {
|
18762
18713
|
let address = null;
|
18763
|
-
if (
|
18764
|
-
|
18765
|
-
|
18766
|
-
|
18767
|
-
|
18768
|
-
|
18769
|
-
|
18770
|
-
|
18771
|
-
} else if (
|
18714
|
+
if (walletProvider.connect) {
|
18715
|
+
console.log("Using connect() method...");
|
18716
|
+
const result = yield walletProvider.connect();
|
18717
|
+
address = result.address || result;
|
18718
|
+
} else if (walletProvider.enable) {
|
18719
|
+
console.log("Using enable() method...");
|
18720
|
+
const accounts = yield walletProvider.enable();
|
18721
|
+
address = accounts[0] || accounts;
|
18722
|
+
} else if (walletProvider.requestAccounts) {
|
18723
|
+
console.log("Using requestAccounts() method...");
|
18724
|
+
const accounts = yield walletProvider.requestAccounts();
|
18725
|
+
address = accounts[0];
|
18726
|
+
} else if (walletProvider.connect && walletName === "AlgoSigner") {
|
18727
|
+
console.log("Using AlgoSigner connect...");
|
18772
18728
|
yield walletProvider.connect();
|
18773
18729
|
const accounts = yield walletProvider.accounts({ ledger: "MainNet" });
|
18774
|
-
address = (
|
18775
|
-
} else if (walletType === WALLET_TYPES.DEFLY) {
|
18776
|
-
if (walletProvider.connect) {
|
18777
|
-
const result = yield walletProvider.connect();
|
18778
|
-
address = result.address || result[0] || result;
|
18779
|
-
} else if (walletProvider.enable) {
|
18780
|
-
const accounts = yield walletProvider.enable();
|
18781
|
-
address = accounts[0] || accounts;
|
18782
|
-
}
|
18783
|
-
} else if (walletType === WALLET_TYPES.EXODUS) {
|
18784
|
-
if (walletProvider.connect) {
|
18785
|
-
const result = yield walletProvider.connect();
|
18786
|
-
address = result.address || result[0] || result;
|
18787
|
-
} else if (walletProvider.enable) {
|
18788
|
-
const accounts = yield walletProvider.enable();
|
18789
|
-
address = accounts[0] || accounts;
|
18790
|
-
}
|
18791
|
-
} else {
|
18792
|
-
if (walletProvider.connect) {
|
18793
|
-
const result = yield walletProvider.connect();
|
18794
|
-
address = result.address || result[0] || result;
|
18795
|
-
} else if (walletProvider.enable) {
|
18796
|
-
const accounts = yield walletProvider.enable();
|
18797
|
-
address = accounts[0] || accounts;
|
18798
|
-
} else if (walletProvider.requestAccounts) {
|
18799
|
-
const accounts = yield walletProvider.requestAccounts();
|
18800
|
-
address = accounts[0];
|
18801
|
-
}
|
18730
|
+
address = (_a2 = accounts[0]) == null ? void 0 : _a2.address;
|
18802
18731
|
}
|
18803
18732
|
if (!address) {
|
18804
18733
|
throw new Error(`No address returned from ${walletName}. Please unlock your wallet and try again.`);
|
18805
18734
|
}
|
18806
18735
|
console.log(`Connected to ${walletName} wallet:`, address);
|
18807
18736
|
return {
|
18808
|
-
walletType,
|
18737
|
+
walletType: WALLET_TYPES.LUTE,
|
18809
18738
|
address,
|
18810
18739
|
provider: walletProvider,
|
18811
18740
|
network: NETWORK_TYPES.ALGORAND,
|
@@ -18832,12 +18761,8 @@ const connectWallet = (walletType) => __async(void 0, null, function* () {
|
|
18832
18761
|
return connectTronlinkWallet();
|
18833
18762
|
case WALLET_TYPES.TRUST_WALLET:
|
18834
18763
|
return connectTrustWallet();
|
18835
|
-
case WALLET_TYPES.PERA:
|
18836
|
-
case WALLET_TYPES.ALGOSIGNER:
|
18837
|
-
case WALLET_TYPES.DEFLY:
|
18838
18764
|
case WALLET_TYPES.LUTE:
|
18839
|
-
|
18840
|
-
return connectAlgorandWallet(walletType);
|
18765
|
+
return connectLuteWallet();
|
18841
18766
|
default:
|
18842
18767
|
throw new Error(`Unsupported wallet type: ${walletType}`);
|
18843
18768
|
}
|
@@ -18975,11 +18900,7 @@ const sendTokenTransaction = (walletConnection, tokenConfig, toAddress, amount)
|
|
18975
18900
|
switch (walletConnection.walletType) {
|
18976
18901
|
case WALLET_TYPES.TRONLINK:
|
18977
18902
|
return sendTRC20Transaction(walletConnection, tokenConfig, toAddress, amount);
|
18978
|
-
case WALLET_TYPES.PERA:
|
18979
|
-
case WALLET_TYPES.ALGOSIGNER:
|
18980
|
-
case WALLET_TYPES.DEFLY:
|
18981
18903
|
case WALLET_TYPES.LUTE:
|
18982
|
-
case WALLET_TYPES.EXODUS:
|
18983
18904
|
return sendAlgorandAssetTransaction(walletConnection, tokenConfig, toAddress, amount);
|
18984
18905
|
default:
|
18985
18906
|
return sendERC20Transaction(walletConnection, tokenConfig, toAddress, amount);
|
@@ -21830,65 +21751,56 @@ const CoinleyCheckout = forwardRef(({
|
|
21830
21751
|
}
|
21831
21752
|
};
|
21832
21753
|
}, [checkingInterval]);
|
21833
|
-
|
21834
|
-
|
21835
|
-
|
21836
|
-
|
21837
|
-
|
21838
|
-
|
21839
|
-
|
21840
|
-
|
21841
|
-
|
21842
|
-
|
21843
|
-
|
21844
|
-
|
21845
|
-
|
21846
|
-
// Just check status, don't process again
|
21847
|
-
});
|
21848
|
-
if (processResponse.status === "success") {
|
21849
|
-
log("Payment confirmed by backend!");
|
21850
|
-
clearInterval(interval);
|
21851
|
-
setCheckingInterval(null);
|
21852
|
-
setPendingBackendConfirmation(false);
|
21853
|
-
setPaymentStatus("success");
|
21854
|
-
}
|
21855
|
-
} catch (err) {
|
21856
|
-
log("Error checking payment status:", err);
|
21857
|
-
}
|
21858
|
-
}), 1e4);
|
21859
|
-
setCheckingInterval(interval);
|
21860
|
-
return () => {
|
21861
|
-
clearInterval(interval);
|
21862
|
-
};
|
21863
|
-
}
|
21864
|
-
}, [transactionHash, pendingBackendConfirmation, paymentStatus, payment, selectedPaymentMethod, walletConnection, confirmations]);
|
21865
|
-
const processBackendConfirmation = () => __async(void 0, null, function* () {
|
21866
|
-
if (!payment || !selectedPaymentMethod || !transactionHash) {
|
21754
|
+
const processBackendConfirmationWithDebug = (txHash) => __async(void 0, null, function* () {
|
21755
|
+
var _a2;
|
21756
|
+
console.log("🔍 processBackendConfirmationWithDebug called with:", txHash);
|
21757
|
+
console.log("📊 State check:");
|
21758
|
+
console.log(" - payment ID:", payment == null ? void 0 : payment.id);
|
21759
|
+
console.log(" - selectedPaymentMethod:", selectedPaymentMethod);
|
21760
|
+
console.log(" - walletConnection:", walletConnection);
|
21761
|
+
if (!payment || !selectedPaymentMethod || !txHash) {
|
21762
|
+
console.error("❌ Missing required data for backend confirmation:", {
|
21763
|
+
hasPayment: !!payment,
|
21764
|
+
hasPaymentMethod: !!selectedPaymentMethod,
|
21765
|
+
hasTransactionHash: !!txHash
|
21766
|
+
});
|
21867
21767
|
return;
|
21868
21768
|
}
|
21869
21769
|
try {
|
21870
|
-
log("
|
21770
|
+
console.log("📡 Making API call to processPayment...");
|
21771
|
+
console.log("📨 Request data:", {
|
21772
|
+
paymentId: payment.id,
|
21773
|
+
transactionHash: txHash,
|
21774
|
+
network: selectedPaymentMethod.network,
|
21775
|
+
senderAddress: walletConnection == null ? void 0 : walletConnection.address
|
21776
|
+
});
|
21871
21777
|
const processResponse = yield processPayment({
|
21872
21778
|
paymentId: payment.id,
|
21873
|
-
transactionHash,
|
21779
|
+
transactionHash: txHash,
|
21874
21780
|
network: selectedPaymentMethod.network,
|
21875
|
-
|
21876
|
-
senderAddress: walletConnection == null ? void 0 : walletConnection.address,
|
21877
|
-
confirmations
|
21781
|
+
senderAddress: walletConnection == null ? void 0 : walletConnection.address
|
21878
21782
|
});
|
21879
|
-
log("Payment processed successfully:", processResponse);
|
21783
|
+
console.log("✅ Payment processed successfully with backend:", processResponse);
|
21880
21784
|
setPendingBackendConfirmation(false);
|
21785
|
+
setPaymentStatus("success");
|
21881
21786
|
if (onSuccess) {
|
21882
|
-
log("Calling onSuccess callback...");
|
21883
|
-
onSuccess(payment.id,
|
21787
|
+
console.log("📞 Calling onSuccess callback...");
|
21788
|
+
onSuccess(payment.id, txHash, {
|
21884
21789
|
network: selectedPaymentMethod.network,
|
21885
21790
|
currency: selectedPaymentMethod.currency,
|
21886
|
-
amount: payment.totalAmount || payment.amount
|
21791
|
+
amount: payment.totalAmount || payment.amount,
|
21792
|
+
processResponse
|
21887
21793
|
});
|
21888
21794
|
}
|
21889
21795
|
} catch (processError) {
|
21890
|
-
|
21796
|
+
console.error("❌ Payment processing failed:", processError);
|
21797
|
+
console.error("❌ Error details:", processError.message);
|
21798
|
+
console.error("❌ Error response:", (_a2 = processError.response) == null ? void 0 : _a2.data);
|
21891
21799
|
setPendingBackendConfirmation(true);
|
21800
|
+
setTimeout(() => {
|
21801
|
+
console.log("🔄 Retrying processBackendConfirmation...");
|
21802
|
+
processBackendConfirmationWithDebug(txHash);
|
21803
|
+
}, 1e4);
|
21892
21804
|
}
|
21893
21805
|
});
|
21894
21806
|
useImperativeHandle(ref, () => ({
|
@@ -22051,10 +21963,23 @@ const CoinleyCheckout = forwardRef(({
|
|
22051
21963
|
network: selectedPaymentMethod.network
|
22052
21964
|
});
|
22053
21965
|
}
|
22054
|
-
log("
|
21966
|
+
console.log("🎉 TRANSACTION HASH OBTAINED:", txHash);
|
21967
|
+
console.log("💾 Setting transaction hash in state...");
|
22055
21968
|
setTransactionHash(txHash);
|
21969
|
+
console.log("📺 Setting step to success...");
|
22056
21970
|
setStep("success");
|
22057
|
-
|
21971
|
+
setPaymentStatus("success");
|
21972
|
+
console.log("🔄 About to call processBackendConfirmation...");
|
21973
|
+
console.log("📋 Current state check:");
|
21974
|
+
console.log(" - payment:", payment == null ? void 0 : payment.id);
|
21975
|
+
console.log(" - selectedPaymentMethod:", selectedPaymentMethod == null ? void 0 : selectedPaymentMethod.network);
|
21976
|
+
console.log(" - txHash:", txHash);
|
21977
|
+
try {
|
21978
|
+
console.log("🚀 CALLING processBackendConfirmation...");
|
21979
|
+
yield processBackendConfirmationWithDebug(txHash);
|
21980
|
+
} catch (processError) {
|
21981
|
+
console.error("❌ processBackendConfirmation failed:", processError);
|
21982
|
+
}
|
22058
21983
|
} catch (err) {
|
22059
21984
|
log("Payment error:", err);
|
22060
21985
|
setError(err.message || "Failed to process payment");
|