Star and TON Balance & Transactions
Main Walkthrough 21 of 22
Clients can check their Telegram Star balance, TON balance, and transaction history.
Getting the Star Balance
Use getStarBalance with "me" to get the current account’s Star balance.
const balance = await client.getStarBalance("me");
console.log(balance.amount, balance.nanos);
Listing Star Transactions
Use getStarTransactions to get the current account’s Star transactions.
const { transactions } = await client.getStarTransactions("me", {
limit: 10,
});
for (const transaction of transactions) {
console.log(transaction.id, transaction.amount.amount);
}
Getting the TON Balance
Use getTonBalance to get the current account’s TON balance.
const tonBalance = await client.getTonBalance("me");
console.log(tonBalance);
Listing TON Transactions
Use getTonTransactions to get the current account’s TON transactions.
const { transactions } = await client.getTonTransactions("me", {
limit: 10,
});
for (const transaction of transactions) {
console.log(transaction.id, transaction.amount);
}