Эх сурвалжийг харах

Merge pull request #2658 from pyth-network/sui-balance-tracker

fix: balance retrieval in SuiBalanceTracker
Daniel Chew 6 сар өмнө
parent
commit
8eabf650fd

+ 1 - 1
apps/price_pusher/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@pythnetwork/price-pusher",
-  "version": "9.3.2",
+  "version": "9.3.3",
   "description": "Pyth Price Pusher",
   "homepage": "https://pyth.network",
   "main": "lib/index.js",

+ 2 - 8
apps/price_pusher/src/sui/balance-tracker.ts

@@ -36,18 +36,12 @@ export class SuiBalanceTracker extends BaseBalanceTracker {
    */
   protected async updateBalance(): Promise<void> {
     try {
-      // Get all coins owned by the address
-      const { data: coins } = await this.client.getCoins({
+      const balance = await this.client.getBalance({
         owner: this.address,
       });
 
-      // Sum up all coin balances
-      const totalBalance = coins.reduce((acc, coin) => {
-        return acc + BigInt(coin.balance);
-      }, BigInt(0));
-
       // Convert to a normalized number for reporting (SUI has 9 decimals)
-      const normalizedBalance = Number(totalBalance) / 1e9;
+      const normalizedBalance = Number(balance.totalBalance) / 1e9;
 
       this.metrics.updateWalletBalance(
         this.address,