coinley-checkout 0.7.4 → 0.7.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.
@@ -20556,6 +20556,20 @@ const QRCode = ({
|
|
20556
20556
|
try {
|
20557
20557
|
let paymentData;
|
20558
20558
|
switch (network) {
|
20559
|
+
case "algorand":
|
20560
|
+
if (currency === "ALGO") {
|
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
|
+
}
|
20572
|
+
break;
|
20559
20573
|
case "tron":
|
20560
20574
|
if (currency === "TRX") {
|
20561
20575
|
paymentData = `tronlink://transfer?to=${walletAddress}&amount=${amount}`;
|
@@ -20563,9 +20577,6 @@ const QRCode = ({
|
|
20563
20577
|
paymentData = walletAddress;
|
20564
20578
|
}
|
20565
20579
|
break;
|
20566
|
-
case "algorand":
|
20567
|
-
paymentData = `algorand://${walletAddress}?amount=${Math.floor(parseFloat(amount) * 1e6)}`;
|
20568
|
-
break;
|
20569
20580
|
case "bsc":
|
20570
20581
|
if (currency === "BNB") {
|
20571
20582
|
paymentData = `ethereum:${walletAddress}@56?value=${convertToWei(amount)}`;
|
@@ -20599,6 +20610,17 @@ const QRCode = ({
|
|
20599
20610
|
setQrError("Error generating payment QR code");
|
20600
20611
|
}
|
20601
20612
|
}, [walletAddress, amount, currency, network]);
|
20613
|
+
const getTokenConfigForCurrency = (currency2, network2) => {
|
20614
|
+
var _a2;
|
20615
|
+
const tokenConfigs = {
|
20616
|
+
algorand: {
|
20617
|
+
"USDC": { assetId: 31566704, decimals: 6 },
|
20618
|
+
"USDT": { assetId: 312769, decimals: 6 },
|
20619
|
+
"ALGO": { decimals: 6, isNative: true }
|
20620
|
+
}
|
20621
|
+
};
|
20622
|
+
return (_a2 = tokenConfigs[network2]) == null ? void 0 : _a2[currency2.toUpperCase()];
|
20623
|
+
};
|
20602
20624
|
const getTokenAddressForCurrency = (currency2, network2) => {
|
20603
20625
|
var _a2;
|
20604
20626
|
const tokenAddresses = {
|