coinley-checkout 0.7.6 → 0.7.8
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.
@@ -20557,18 +20557,7 @@ const QRCode = ({
|
|
20557
20557
|
let paymentData;
|
20558
20558
|
switch (network) {
|
20559
20559
|
case "algorand":
|
20560
|
-
|
20561
|
-
const microAlgos = Math.floor(parseFloat(amount) * 1e6);
|
20562
|
-
paymentData = `algorand://${walletAddress}?amount=${microAlgos}¬e=Payment`;
|
20563
|
-
} else {
|
20564
|
-
const tokenConfig = getTokenConfigForCurrency(currency, "algorand");
|
20565
|
-
if (tokenConfig && tokenConfig.assetId) {
|
20566
|
-
const assetAmount = Math.floor(parseFloat(amount) * Math.pow(10, tokenConfig.decimals));
|
20567
|
-
paymentData = `algorand://${walletAddress}?asset=${tokenConfig.assetId}&amount=${assetAmount}¬e=Payment`;
|
20568
|
-
} else {
|
20569
|
-
paymentData = walletAddress;
|
20570
|
-
}
|
20571
|
-
}
|
20560
|
+
paymentData = generateAlgorandQR(walletAddress, amount, currency);
|
20572
20561
|
break;
|
20573
20562
|
case "tron":
|
20574
20563
|
if (currency === "TRX") {
|
@@ -20610,6 +20599,40 @@ const QRCode = ({
|
|
20610
20599
|
setQrError("Error generating payment QR code");
|
20611
20600
|
}
|
20612
20601
|
}, [walletAddress, amount, currency, network]);
|
20602
|
+
const generateAlgorandQR = (address, amount2, currency2) => {
|
20603
|
+
try {
|
20604
|
+
const amountFloat = parseFloat(amount2);
|
20605
|
+
if (currency2 === "ALGO") {
|
20606
|
+
const microAlgos = Math.floor(amountFloat * 1e6);
|
20607
|
+
const peraPayment = {
|
20608
|
+
receiver: address,
|
20609
|
+
amount: microAlgos,
|
20610
|
+
note: btoa("Payment via Coinley")
|
20611
|
+
// Base64 encoded note
|
20612
|
+
};
|
20613
|
+
return `algorand://pay?receiver=${peraPayment.receiver}&amount=${peraPayment.amount}¬e=${peraPayment.note}`;
|
20614
|
+
} else {
|
20615
|
+
const tokenConfig = getTokenConfigForCurrency(currency2, "algorand");
|
20616
|
+
if (tokenConfig && tokenConfig.assetId) {
|
20617
|
+
const assetAmount = Math.floor(amountFloat * Math.pow(10, tokenConfig.decimals));
|
20618
|
+
const peraAssetPayment = {
|
20619
|
+
receiver: address,
|
20620
|
+
amount: assetAmount,
|
20621
|
+
assetId: tokenConfig.assetId,
|
20622
|
+
note: btoa(`${currency2} Payment via Coinley`)
|
20623
|
+
// Base64 encoded note
|
20624
|
+
};
|
20625
|
+
return `algorand://pay?receiver=${peraAssetPayment.receiver}&amount=${peraAssetPayment.amount}&asset=${peraAssetPayment.assetId}¬e=${peraAssetPayment.note}`;
|
20626
|
+
} else {
|
20627
|
+
console.warn(`Token config not found for ${currency2} on Algorand`);
|
20628
|
+
return address;
|
20629
|
+
}
|
20630
|
+
}
|
20631
|
+
} catch (error) {
|
20632
|
+
console.error("Error generating Algorand QR:", error);
|
20633
|
+
return address;
|
20634
|
+
}
|
20635
|
+
};
|
20613
20636
|
const getTokenConfigForCurrency = (currency2, network2) => {
|
20614
20637
|
var _a2;
|
20615
20638
|
const tokenConfigs = {
|
@@ -21435,7 +21458,7 @@ const CoinleyModal = ({
|
|
21435
21458
|
formatAmount(payment.totalAmount || payment.amount)
|
21436
21459
|
] }),
|
21437
21460
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600 mt-4", children: "Payment to:" }),
|
21438
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "coinley-merchant-name text-base font-semibold mt-1 flex gap-2 items-center", children: [
|
21461
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "coinley-merchant-name text-base font-semibold mt-1 flex gap-2 items-center justify-center", children: [
|
21439
21462
|
/* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M15.3 7.50065L15.8 10.0007H4.2L4.7 7.50065H15.3ZM16.6667 3.33398H3.33333V5.00065H16.6667V3.33398ZM16.6667 5.83398H3.33333L2.5 10.0007V11.6673H3.33333V16.6673H11.6667V11.6673H15V16.6673H16.6667V11.6673H17.5V10.0007L16.6667 5.83398ZM5 15.0007V11.6673H10V15.0007H5Z", fill: "#7042D2" }) }),
|
21440
21463
|
merchantName
|
21441
21464
|
] })
|