Skip to content

Commit

Permalink
Fixed issue with no rex balance breaking the staking page
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox committed Feb 24, 2025
1 parent e7704df commit 8f58f89
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/state/client/account.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class AccountState {
public delegations = $derived(getDelegations(this.sources));

public resources = $derived.by(() => getResources(this.sources, this.network));
public rex = $derived(SystemContract.Types.rex_balance.from(this.sources.rexbal));
public rex = $derived.by(() => getRex(this.sources));
public permissions = $derived(API.v1.AccountObject.from(this.sources.get_account).permissions);
public proposals = $derived.by(() => this.sources.proposals);
public refundRequest = $derived.by(() => this.sources.refund_request);
Expand Down Expand Up @@ -150,6 +150,13 @@ export class AccountState {
}
}

export function getRex(sources: AccountDataSources) {
if (!sources.rexbal) {
return defaultAccountDataSources.rexbal;
}
return SystemContract.Types.rex_balance.from(sources.rexbal);
}

export function getResources(
sources: AccountDataSources,
network?: NetworkState
Expand Down

0 comments on commit 8f58f89

Please sign in to comment.