Update server.js
Browse files
server.js
CHANGED
|
@@ -42,9 +42,9 @@ app.post("/disconnect", (req, res) => {
|
|
| 42 |
*/
|
| 43 |
async function getWalletBalance(address) {
|
| 44 |
try {
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
return res.data.balance;
|
| 48 |
} catch (err) {
|
| 49 |
console.error("❌ Error fetching balance:", err.response?.data || err.message);
|
| 50 |
return null;
|
|
|
|
| 42 |
*/
|
| 43 |
async function getWalletBalance(address) {
|
| 44 |
try {
|
| 45 |
+
const res = await axios.get(`https://tonapi.io/v2/accounts/${address}`);
|
| 46 |
+
// The balance is usually in res.data.account.balance
|
| 47 |
+
return res.data.account.balance;
|
| 48 |
} catch (err) {
|
| 49 |
console.error("❌ Error fetching balance:", err.response?.data || err.message);
|
| 50 |
return null;
|