Skip to content

Commit

Permalink
Detect if the account has a contract
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox committed Jan 30, 2025
1 parent 5a27100 commit 4ac904f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/state/client/account.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export class AccountState {
public account: Account | undefined = $state();
public name: Name | undefined = $state();
public last_update: Date = $state(new Date());
public contract: boolean = $derived(
Number(new Date(`${this.sources.get_account.last_code_update}z`)) > 0
);
public loaded: boolean = $state(false);

public balance = $derived.by(() =>
Expand Down Expand Up @@ -156,6 +159,7 @@ export class AccountState {
last_update: this.last_update,
value: this.value,
chain: this.network.chain,
contract: this.contract,
name: this.name,
balance: this.balance,
balances: this.balances,
Expand Down

0 comments on commit 4ac904f

Please sign in to comment.