Skip to content

Commit

Permalink
Fix/balance (#20)
Browse files Browse the repository at this point in the history
* fix: balance issue

Signed-off-by: kulwindersingh-ant <[email protected]>

* fix: adds dyanmic ed value

Signed-off-by: kulwindersingh-ant <[email protected]>

* fix: nominator bond

Signed-off-by: kulwindersingh-ant <[email protected]>

* fix: ed value

Signed-off-by: kulwindersingh-ant <[email protected]>

* fix: style

Signed-off-by: kulwindersingh-ant <[email protected]>

* fix: removed extra fee

Signed-off-by: kulwindersingh-ant <[email protected]>

* fix: useEffect warning

Signed-off-by: kulwindersingh-ant <[email protected]>

* fix: useEffect warning

Signed-off-by: kulwindersingh-ant <[email protected]>

* fix: adds extra

Signed-off-by: kulwindersingh-ant <[email protected]>

* fix: remove extra networks

Signed-off-by: kulwindersingh-ant <[email protected]>

* fix: free balance

Signed-off-by: kulwindersingh-ant <[email protected]>

---------

Signed-off-by: kulwindersingh-ant <[email protected]>
Signed-off-by: kulwindersingh-ant <[email protected]>
  • Loading branch information
kulwindersingh-ant authored May 13, 2024
1 parent 1023931 commit ff8d908
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/Constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export const CONNECTION_NAME = "5IRE_EXT";
export const PORT_NAME = "WEBEXT_REDUX_TEST";
export const UI_CONNECTION_NAME = "5IRE_EXT_UI";
export const RESTRICTED_FOR_CONTENT_SCRIPT = "chrome-extension://";

export const EXTRA_FEE = 0;
export const EXTRA_FEE = 0.0001;
export const WINDOW_WIDTH = 400;
export const DECIMALS = 10 ** 18;
export const WINDOW_HEIGHT = 620;
Expand Down
14 changes: 3 additions & 11 deletions src/Scripts/initbackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -2124,19 +2124,11 @@ export class GeneralWalletRPC {

// Evm Balance
const w3balance = await evmApi?.eth?.getBalance(account.evmAddress);

// //Native Balance
// if (RpcRequestProcessor.isHttp) {
// let balance_ = await nativeApi?._query.system.account(account.nativeAddress);
// nbalance = parseFloat(`${balance_.data.free}`) - parseFloat(`${balance_.data.miscFrozen}`);
// } else {
// let balance_ = await nativeApi?.derive.balances.all(account.nativeAddress);
// nbalance = balance_.availableBalance;
// }

let balances = await nativeApi?.query.system.account(account.nativeAddress);
const balance1 = balances.toHuman();
nbalance = +balance1?.data?.free?.replaceAll(",", "");
const total = +balance1?.data?.free?.replaceAll(",", "");
const frozen = +balance1?.data?.frozen?.replaceAll(",", "");
nbalance = total - frozen;

let evmBalance = new BigNumber(w3balance).dividedBy(DECIMALS).toString();
let nativeBalance = new BigNumber(nbalance).dividedBy(DECIMALS).toString();
Expand Down

0 comments on commit ff8d908

Please sign in to comment.