Skip to content

Commit 8eabf65

Browse files
authored
Merge pull request #2658 from pyth-network/sui-balance-tracker
fix: balance retrieval in SuiBalanceTracker
2 parents 966dfa4 + e96e693 commit 8eabf65

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

apps/price_pusher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/price-pusher",
3-
"version": "9.3.2",
3+
"version": "9.3.3",
44
"description": "Pyth Price Pusher",
55
"homepage": "https://pyth.network",
66
"main": "lib/index.js",

apps/price_pusher/src/sui/balance-tracker.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,12 @@ export class SuiBalanceTracker extends BaseBalanceTracker {
3636
*/
3737
protected async updateBalance(): Promise<void> {
3838
try {
39-
// Get all coins owned by the address
40-
const { data: coins } = await this.client.getCoins({
39+
const balance = await this.client.getBalance({
4140
owner: this.address,
4241
});
4342

44-
// Sum up all coin balances
45-
const totalBalance = coins.reduce((acc, coin) => {
46-
return acc + BigInt(coin.balance);
47-
}, BigInt(0));
48-
4943
// Convert to a normalized number for reporting (SUI has 9 decimals)
50-
const normalizedBalance = Number(totalBalance) / 1e9;
44+
const normalizedBalance = Number(balance.totalBalance) / 1e9;
5145

5246
this.metrics.updateWalletBalance(
5347
this.address,

0 commit comments

Comments
 (0)