Skip to content

Commit

Permalink
use utils
Browse files Browse the repository at this point in the history
  • Loading branch information
PiVortex committed Sep 2, 2024
1 parent f760840 commit 6d6e692
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/src/wallets/near.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// near api js
import { providers } from 'near-api-js';
import { providers, utils } from 'near-api-js';

// wallet selector
import { distinctUntilChanged, map } from 'rxjs';
Expand Down Expand Up @@ -156,8 +156,11 @@ export class Wallet {
finality: 'final',
});

const amountString = utils.format.formatNearAmount(account.amount);
const amount = Number(amountString.replace(/,/g, "").trim());

// Return amount in NEAR
return account.amount ? account.amount / (10**24) : 0;
return account.amount ? amount : 0;
};

/**
Expand Down

0 comments on commit 6d6e692

Please sign in to comment.