coinley-checkout 0.8.1 → 0.8.3
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,7 +18329,11 @@ const WALLET_TYPES = {
|
|
18329
18329
|
METAMASK: "metamask",
|
18330
18330
|
TRONLINK: "tronlink",
|
18331
18331
|
TRUST_WALLET: "trustwallet",
|
18332
|
-
LUTE: "lute"
|
18332
|
+
LUTE: "lute",
|
18333
|
+
PERA: "pera",
|
18334
|
+
ALGOSIGNER: "algosigner",
|
18335
|
+
DEFLY: "defly",
|
18336
|
+
EXODUS: "exodus"
|
18333
18337
|
};
|
18334
18338
|
const NETWORK_TYPES = {
|
18335
18339
|
ETHEREUM: "ethereum",
|
@@ -18447,59 +18451,59 @@ const NETWORK_WALLET_MAP = {
|
|
18447
18451
|
[NETWORK_TYPES.ETHEREUM]: [WALLET_TYPES.METAMASK, WALLET_TYPES.TRUST_WALLET],
|
18448
18452
|
[NETWORK_TYPES.BSC]: [WALLET_TYPES.METAMASK, WALLET_TYPES.TRUST_WALLET],
|
18449
18453
|
[NETWORK_TYPES.TRON]: [WALLET_TYPES.TRONLINK],
|
18450
|
-
[NETWORK_TYPES.ALGORAND]: [WALLET_TYPES.LUTE]
|
18454
|
+
[NETWORK_TYPES.ALGORAND]: [WALLET_TYPES.PERA, WALLET_TYPES.ALGOSIGNER, WALLET_TYPES.DEFLY, WALLET_TYPES.LUTE, WALLET_TYPES.EXODUS]
|
18451
18455
|
};
|
18452
18456
|
const getWalletInstallUrl = (walletType) => {
|
18453
18457
|
const urls = {
|
18454
18458
|
[WALLET_TYPES.METAMASK]: "https://metamask.io/download/",
|
18455
18459
|
[WALLET_TYPES.TRONLINK]: "https://www.tronlink.org/download/",
|
18456
18460
|
[WALLET_TYPES.TRUST_WALLET]: "https://trustwallet.com/download/",
|
18457
|
-
[WALLET_TYPES.LUTE]: "https://lute.app/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/"
|
18458
18466
|
};
|
18459
18467
|
return urls[walletType] || "";
|
18460
18468
|
};
|
18461
|
-
const
|
18469
|
+
const detectAlgorandWallets = () => {
|
18470
|
+
var _a2, _b, _c, _d, _e, _f;
|
18462
18471
|
if (typeof window === "undefined")
|
18463
|
-
return
|
18464
|
-
const
|
18465
|
-
|
18466
|
-
(
|
18467
|
-
|
18468
|
-
|
18469
|
-
|
18470
|
-
(
|
18471
|
-
|
18472
|
-
|
18473
|
-
|
18474
|
-
|
18475
|
-
|
18476
|
-
()
|
18477
|
-
|
18478
|
-
|
18479
|
-
|
18480
|
-
|
18481
|
-
|
18482
|
-
|
18483
|
-
|
18484
|
-
|
18485
|
-
|
18472
|
+
return {};
|
18473
|
+
const algorandWallets = {};
|
18474
|
+
algorandWallets[WALLET_TYPES.PERA] = Boolean(
|
18475
|
+
window.PeraWallet || ((_a2 = window.algorand) == null ? void 0 : _a2.pera) || window.pera || document.querySelector('[data-wallet="pera"]')
|
18476
|
+
);
|
18477
|
+
algorandWallets[WALLET_TYPES.ALGOSIGNER] = Boolean(window.AlgoSigner);
|
18478
|
+
algorandWallets[WALLET_TYPES.DEFLY] = Boolean(
|
18479
|
+
window.DeflyWallet || window.defly || ((_b = window.algorand) == null ? void 0 : _b.defly)
|
18480
|
+
);
|
18481
|
+
algorandWallets[WALLET_TYPES.LUTE] = Boolean(
|
18482
|
+
window.lute || window.luteWallet || ((_c = window.algorand) == null ? void 0 : _c.lute)
|
18483
|
+
);
|
18484
|
+
algorandWallets[WALLET_TYPES.EXODUS] = Boolean(
|
18485
|
+
((_d = window.exodus) == null ? void 0 : _d.algorand) || window.exodus && window.exodus.algorand
|
18486
|
+
);
|
18487
|
+
console.log("=== ALGORAND WALLETS DETECTION ===");
|
18488
|
+
console.log("Pera (PeraWallet):", Boolean(window.PeraWallet));
|
18489
|
+
console.log("Pera (algorand.pera):", Boolean((_e = window.algorand) == null ? void 0 : _e.pera));
|
18490
|
+
console.log("Pera (window.pera):", Boolean(window.pera));
|
18491
|
+
console.log("AlgoSigner:", Boolean(window.AlgoSigner));
|
18492
|
+
console.log("Defly (DeflyWallet):", Boolean(window.DeflyWallet));
|
18493
|
+
console.log("Defly (window.defly):", Boolean(window.defly));
|
18494
|
+
console.log("Lute (window.lute):", Boolean(window.lute));
|
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;
|
18486
18499
|
};
|
18487
18500
|
const detectWallets = () => {
|
18488
|
-
const
|
18501
|
+
const algorandWallets = detectAlgorandWallets();
|
18502
|
+
const availableWallets = __spreadValues({
|
18489
18503
|
[WALLET_TYPES.METAMASK]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isMetaMask,
|
18490
18504
|
[WALLET_TYPES.TRONLINK]: typeof window !== "undefined" && window.tronWeb !== void 0,
|
18491
|
-
[WALLET_TYPES.TRUST_WALLET]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isTrust === true
|
18492
|
-
|
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
|
-
}
|
18505
|
+
[WALLET_TYPES.TRUST_WALLET]: typeof window !== "undefined" && window.ethereum !== void 0 && window.ethereum.isTrust === true
|
18506
|
+
}, algorandWallets);
|
18503
18507
|
return availableWallets;
|
18504
18508
|
};
|
18505
18509
|
const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0, null, function* () {
|
@@ -18508,6 +18512,7 @@ const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0,
|
|
18508
18512
|
while (retries < maxRetries) {
|
18509
18513
|
wallets = detectWallets();
|
18510
18514
|
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]);
|
18511
18516
|
if (hasAnyWallet || retries >= maxRetries - 1) {
|
18512
18517
|
break;
|
18513
18518
|
}
|
@@ -18516,16 +18521,19 @@ const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0,
|
|
18516
18521
|
yield new Promise((resolve) => setTimeout(resolve, delay));
|
18517
18522
|
retries++;
|
18518
18523
|
}
|
18519
|
-
if (!wallets
|
18520
|
-
console.log("Performing extended
|
18524
|
+
if (!Object.values(wallets).some((v) => v === true)) {
|
18525
|
+
console.log("Performing extended Algorand wallet detection...");
|
18521
18526
|
if (typeof window !== "undefined") {
|
18522
18527
|
try {
|
18523
|
-
const
|
18524
|
-
|
18525
|
-
|
18526
|
-
|
18528
|
+
const events = ["algorand-wallet-detect", "pera-wallet-detect", "defly-wallet-detect"];
|
18529
|
+
events.forEach((eventName) => {
|
18530
|
+
const event = new CustomEvent(eventName, { detail: { source: "coinley-sdk" } });
|
18531
|
+
window.dispatchEvent(event);
|
18532
|
+
});
|
18533
|
+
yield new Promise((resolve) => setTimeout(resolve, 1e3));
|
18534
|
+
wallets = detectWallets();
|
18527
18535
|
} catch (error) {
|
18528
|
-
console.warn("Extended
|
18536
|
+
console.warn("Extended Algorand detection failed:", error);
|
18529
18537
|
}
|
18530
18538
|
}
|
18531
18539
|
}
|
@@ -18533,13 +18541,17 @@ const detectWalletsWithRetry = (maxRetries = 5, delay = 1e3) => __async(void 0,
|
|
18533
18541
|
return wallets;
|
18534
18542
|
});
|
18535
18543
|
const debugWalletEnvironment = () => {
|
18536
|
-
var _a2;
|
18544
|
+
var _a2, _b;
|
18537
18545
|
console.log("=== WALLET ENVIRONMENT DEBUG ===");
|
18538
18546
|
console.log("ethereum:", typeof window !== "undefined" ? Boolean(window.ethereum) : "Not in browser");
|
18539
18547
|
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");
|
18540
18552
|
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");
|
18541
18554
|
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");
|
18543
18555
|
if (typeof window !== "undefined" && window.ethereum) {
|
18544
18556
|
console.log("ethereum details:", {
|
18545
18557
|
isTrust: window.ethereum.isTrust,
|
@@ -18550,14 +18562,14 @@ const debugWalletEnvironment = () => {
|
|
18550
18562
|
if (typeof window !== "undefined" && window.tronWeb) {
|
18551
18563
|
console.log("tronWeb details:", {
|
18552
18564
|
ready: window.tronWeb.ready,
|
18553
|
-
fullNode: (
|
18565
|
+
fullNode: (_b = window.tronWeb.fullNode) == null ? void 0 : _b.host,
|
18554
18566
|
defaultAddress: window.tronWeb.defaultAddress
|
18555
18567
|
});
|
18556
18568
|
}
|
18557
18569
|
if (typeof window !== "undefined") {
|
18558
18570
|
console.log("All window wallet properties:");
|
18559
18571
|
const walletProps = Object.keys(window).filter(
|
18560
|
-
(key) => key.toLowerCase().includes("lute") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("wallet")
|
18572
|
+
(key) => key.toLowerCase().includes("lute") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("pera") || key.toLowerCase().includes("defly") || key.toLowerCase().includes("wallet")
|
18561
18573
|
);
|
18562
18574
|
console.log("Potential wallet properties:", walletProps);
|
18563
18575
|
}
|
@@ -18683,58 +18695,117 @@ const connectTronlinkWallet = () => __async(void 0, null, function* () {
|
|
18683
18695
|
throw error;
|
18684
18696
|
}
|
18685
18697
|
});
|
18686
|
-
const
|
18687
|
-
var _a2;
|
18688
|
-
console.log(
|
18698
|
+
const connectAlgorandWallet = (walletType) => __async(void 0, null, function* () {
|
18699
|
+
var _a2, _b, _c, _d, _e;
|
18700
|
+
console.log(`Connecting to ${walletType} wallet...`);
|
18689
18701
|
let walletProvider = null;
|
18690
18702
|
let walletName = "";
|
18691
|
-
|
18692
|
-
|
18693
|
-
|
18694
|
-
|
18695
|
-
|
18696
|
-
|
18697
|
-
|
18698
|
-
|
18699
|
-
|
18700
|
-
|
18701
|
-
|
18702
|
-
|
18703
|
+
switch (walletType) {
|
18704
|
+
case WALLET_TYPES.PERA:
|
18705
|
+
if (window.PeraWallet) {
|
18706
|
+
walletProvider = window.PeraWallet;
|
18707
|
+
walletName = "Pera Wallet";
|
18708
|
+
} else if ((_a2 = window.algorand) == null ? void 0 : _a2.pera) {
|
18709
|
+
walletProvider = window.algorand.pera;
|
18710
|
+
walletName = "Pera Wallet (algorand.pera)";
|
18711
|
+
} else if (window.pera) {
|
18712
|
+
walletProvider = window.pera;
|
18713
|
+
walletName = "Pera Wallet (window.pera)";
|
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;
|
18703
18752
|
}
|
18704
18753
|
if (!walletProvider) {
|
18705
|
-
console.error(
|
18754
|
+
console.error(`${walletType} wallet not detected.`);
|
18706
18755
|
console.log("Available window properties:", Object.keys(window).filter(
|
18707
|
-
(key) => key.toLowerCase().includes("
|
18756
|
+
(key) => key.toLowerCase().includes("pera") || key.toLowerCase().includes("algo") || key.toLowerCase().includes("defly") || key.toLowerCase().includes("lute") || key.toLowerCase().includes("exodus")
|
18708
18757
|
));
|
18709
|
-
throw new Error(
|
18758
|
+
throw new Error(`${walletType} wallet not detected. Please install ${walletName || walletType} or try another Algorand wallet.`);
|
18710
18759
|
}
|
18711
18760
|
console.log(`Found ${walletName} wallet provider:`, walletProvider);
|
18712
18761
|
try {
|
18713
18762
|
let address = null;
|
18714
|
-
if (
|
18715
|
-
|
18716
|
-
|
18717
|
-
|
18718
|
-
|
18719
|
-
|
18720
|
-
|
18721
|
-
|
18722
|
-
} else if (
|
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...");
|
18763
|
+
if (walletType === WALLET_TYPES.PERA) {
|
18764
|
+
if (walletProvider.connect) {
|
18765
|
+
const result = yield walletProvider.connect();
|
18766
|
+
address = result.address || result[0] || result;
|
18767
|
+
} else if (walletProvider.enable) {
|
18768
|
+
const accounts = yield walletProvider.enable();
|
18769
|
+
address = accounts[0] || accounts;
|
18770
|
+
}
|
18771
|
+
} else if (walletType === WALLET_TYPES.ALGOSIGNER) {
|
18728
18772
|
yield walletProvider.connect();
|
18729
18773
|
const accounts = yield walletProvider.accounts({ ledger: "MainNet" });
|
18730
|
-
address = (
|
18774
|
+
address = (_e = accounts[0]) == null ? void 0 : _e.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
|
+
}
|
18731
18802
|
}
|
18732
18803
|
if (!address) {
|
18733
18804
|
throw new Error(`No address returned from ${walletName}. Please unlock your wallet and try again.`);
|
18734
18805
|
}
|
18735
18806
|
console.log(`Connected to ${walletName} wallet:`, address);
|
18736
18807
|
return {
|
18737
|
-
walletType
|
18808
|
+
walletType,
|
18738
18809
|
address,
|
18739
18810
|
provider: walletProvider,
|
18740
18811
|
network: NETWORK_TYPES.ALGORAND,
|
@@ -18761,8 +18832,12 @@ const connectWallet = (walletType) => __async(void 0, null, function* () {
|
|
18761
18832
|
return connectTronlinkWallet();
|
18762
18833
|
case WALLET_TYPES.TRUST_WALLET:
|
18763
18834
|
return connectTrustWallet();
|
18835
|
+
case WALLET_TYPES.PERA:
|
18836
|
+
case WALLET_TYPES.ALGOSIGNER:
|
18837
|
+
case WALLET_TYPES.DEFLY:
|
18764
18838
|
case WALLET_TYPES.LUTE:
|
18765
|
-
|
18839
|
+
case WALLET_TYPES.EXODUS:
|
18840
|
+
return connectAlgorandWallet(walletType);
|
18766
18841
|
default:
|
18767
18842
|
throw new Error(`Unsupported wallet type: ${walletType}`);
|
18768
18843
|
}
|
@@ -18900,7 +18975,11 @@ const sendTokenTransaction = (walletConnection, tokenConfig, toAddress, amount)
|
|
18900
18975
|
switch (walletConnection.walletType) {
|
18901
18976
|
case WALLET_TYPES.TRONLINK:
|
18902
18977
|
return sendTRC20Transaction(walletConnection, tokenConfig, toAddress, amount);
|
18978
|
+
case WALLET_TYPES.PERA:
|
18979
|
+
case WALLET_TYPES.ALGOSIGNER:
|
18980
|
+
case WALLET_TYPES.DEFLY:
|
18903
18981
|
case WALLET_TYPES.LUTE:
|
18982
|
+
case WALLET_TYPES.EXODUS:
|
18904
18983
|
return sendAlgorandAssetTransaction(walletConnection, tokenConfig, toAddress, amount);
|
18905
18984
|
default:
|
18906
18985
|
return sendERC20Transaction(walletConnection, tokenConfig, toAddress, amount);
|
@@ -20557,7 +20636,20 @@ const QRCode = ({
|
|
20557
20636
|
let paymentData;
|
20558
20637
|
switch (network) {
|
20559
20638
|
case "algorand":
|
20560
|
-
|
20639
|
+
const merchantAddress = "5OY4UMMWLFQWB7SZZ4YZCANFSESHAURQGEJWJFV2SRLGUDSSBOWXJOEPDM";
|
20640
|
+
const amountFloat = parseFloat(amount);
|
20641
|
+
if (currency === "ALGO") {
|
20642
|
+
const microAlgos = Math.floor(amountFloat * 1e6);
|
20643
|
+
paymentData = `algorand://${merchantAddress}?amount=${microAlgos}`;
|
20644
|
+
} else {
|
20645
|
+
const tokenConfig = getTokenConfigForCurrency2(currency, "algorand");
|
20646
|
+
if (tokenConfig && tokenConfig.assetId) {
|
20647
|
+
const assetAmount = Math.floor(amountFloat * Math.pow(10, tokenConfig.decimals));
|
20648
|
+
paymentData = `algorand://${merchantAddress}?amount=${assetAmount}&asset=${tokenConfig.assetId}`;
|
20649
|
+
} else {
|
20650
|
+
paymentData = `algorand://${merchantAddress}`;
|
20651
|
+
}
|
20652
|
+
}
|
20561
20653
|
break;
|
20562
20654
|
case "tron":
|
20563
20655
|
if (currency === "TRX") {
|
@@ -20607,27 +20699,6 @@ const QRCode = ({
|
|
20607
20699
|
setQrError("Error generating payment QR code");
|
20608
20700
|
}
|
20609
20701
|
}, [walletAddress, amount, currency, network]);
|
20610
|
-
const generateAlgorandQR2 = (address, amount2, currency2) => {
|
20611
|
-
try {
|
20612
|
-
const demoAddress = "5OY4UMMWLFQWB7SZZ4YZCANFSESHAURQGEJWJFV2SRLGUDSSBOWXJOEPDM";
|
20613
|
-
const amountFloat = parseFloat(amount2);
|
20614
|
-
if (currency2 === "ALGO") {
|
20615
|
-
const microAlgos = Math.floor(amountFloat * 1e6);
|
20616
|
-
return `https://perawallet.app/qr-code-generator/?receiver=${demoAddress}&amount=${microAlgos}¬e=Demo%20Payment`;
|
20617
|
-
} else {
|
20618
|
-
const tokenConfig = getTokenConfigForCurrency2(currency2, "algorand");
|
20619
|
-
if (tokenConfig && tokenConfig.assetId) {
|
20620
|
-
const assetAmount = Math.floor(amountFloat * Math.pow(10, tokenConfig.decimals));
|
20621
|
-
return `https://perawallet.app/qr-code-generator/?receiver=${demoAddress}&amount=${assetAmount}&asset=${tokenConfig.assetId}¬e=${currency2}%20Demo%20Payment`;
|
20622
|
-
} else {
|
20623
|
-
return demoAddress;
|
20624
|
-
}
|
20625
|
-
}
|
20626
|
-
} catch (error) {
|
20627
|
-
console.error("Error generating demo Algorand QR:", error);
|
20628
|
-
return "5OY4UMMWLFQWB7SZZ4YZCANFSESHAURQGEJWJFV2SRLGUDSSBOWXJOEPDM";
|
20629
|
-
}
|
20630
|
-
};
|
20631
20702
|
const getTokenConfigForCurrency2 = (currency2, network2) => {
|
20632
20703
|
var _a2;
|
20633
20704
|
const tokenConfigs = {
|