Reaperxxxx commited on
Commit
ee17cf6
·
verified ·
1 Parent(s): cd37f07

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +3 -3
server.js CHANGED
@@ -42,9 +42,9 @@ app.post("/disconnect", (req, res) => {
42
  */
43
  async function getWalletBalance(address) {
44
  try {
45
- // Using tonapi.io (no key needed for basic requests)
46
- const res = await axios.get(`https://tonapi.io/v1/account/getInfo?account=${address}`);
47
- return res.data.balance; // balance in nanotons
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;