Current account data.

Hierarchy (View Summary)

  • DataEntity<
        {
            balance: Balances;
            email?: string;
            network: null
            | SupernetType;
            networkStatus: "connected" | "disconnected" | "connecting" | "switching";
            subscription?: SubscriptionEntitlementSnapshot;
            username?: string;
            walletAddress?: string;
        },
    >
    • CurrentAccount

Constructors

  • Parameters

    • Optionaldata: {
          balance: Balances;
          email?: string;
          network: null | SupernetType;
          networkStatus: "connected" | "disconnected" | "connecting" | "switching";
          subscription?: SubscriptionEntitlementSnapshot;
          username?: string;
          walletAddress?: string;
      }
      • balance: Balances
      • Optionalemail?: string
      • network: null | SupernetType
      • networkStatus: "connected" | "disconnected" | "connecting" | "switching"

        Current network status:

        • connected - connected to the socket
        • disconnected - disconnected from the socket
        • connecting - connecting to the socket
        • switching - switching network type (fast/relaxed)
        'disconnected'
        
      • Optionalsubscription?: SubscriptionEntitlementSnapshot

        The most recently fetched subscription entitlement snapshot. undefined until the account receives a socket entitlement snapshot or AccountApi.getSubscriptionStatus / AccountApi.refreshSubscription has been called.

        Subscribe to the 'updated' event (inherited from DataEntity) to react to changes; the changedKeys array will include 'subscription' when this field is refreshed.

      • Optionalusername?: string
      • OptionalwalletAddress?: string

    Returns CurrentAccount

Properties

data: {
    balance: Balances;
    email?: string;
    network: null | SupernetType;
    networkStatus: "connected" | "disconnected" | "connecting" | "switching";
    subscription?: SubscriptionEntitlementSnapshot;
    username?: string;
    walletAddress?: string;
}

Type declaration

  • balance: Balances
  • Optionalemail?: string
  • network: null | SupernetType
  • networkStatus: "connected" | "disconnected" | "connecting" | "switching"

    Current network status:

    • connected - connected to the socket
    • disconnected - disconnected from the socket
    • connecting - connecting to the socket
    • switching - switching network type (fast/relaxed)
    'disconnected'
    
  • Optionalsubscription?: SubscriptionEntitlementSnapshot

    The most recently fetched subscription entitlement snapshot. undefined until the account receives a socket entitlement snapshot or AccountApi.getSubscriptionStatus / AccountApi.refreshSubscription has been called.

    Subscribe to the 'updated' event (inherited from DataEntity) to react to changes; the changedKeys array will include 'subscription' when this field is refreshed.

  • Optionalusername?: string
  • OptionalwalletAddress?: string
lastUpdated: Date = ...
listeners: { updated?: (data: string[]) => void[] } = {}

Accessors

  • get isUnlimited(): boolean

    Convenience getter - true when the account has an effective subscription entitlement on any Unlimited tier ("unlimited" or "unlimited_pro").

    Returns false when no entitlement snapshot has been fetched yet, when the server reports no active entitlement, or when the tier is not an Unlimited tier. Call AccountApi.refreshSubscription to force a REST refresh when no socket entitlement snapshot has been received yet.

    Returns boolean

  • get networkStatus(): "connected" | "disconnected" | "connecting" | "switching"

    Returns "connected" | "disconnected" | "connecting" | "switching"

Methods

  • Dispatch an event to all listeners

    Type Parameters

    • T extends "updated"

    Parameters

    • event: T
    • data: { updated: string[] }[T]

    Returns void

  • Remove an event listener

    Type Parameters

    • T extends "updated"

    Parameters

    • event: T
    • listener: (data: { updated: string[] }[T]) => void

    Returns void

  • Add an event listener, returns a function that can be called to remove the listener

    Type Parameters

    • T extends "updated"

    Parameters

    • event: T
    • listener: (data: { updated: string[] }[T]) => void

    Returns () => void

  • Add an event listener that will be called only once

    Type Parameters

    • T extends "updated"

    Parameters

    • event: T
    • listener: (data: { updated: string[] }[T]) => void

    Returns () => void

  • Get a copy of the entity's data

    Returns {
        balance: Balances;
        email?: string;
        network: null | SupernetType;
        networkStatus: "connected" | "disconnected" | "connecting" | "switching";
        subscription?: SubscriptionEntitlementSnapshot;
        username?: string;
        walletAddress?: string;
    }

    • balance: Balances
    • Optionalemail?: string
    • network: null | SupernetType
    • networkStatus: "connected" | "disconnected" | "connecting" | "switching"

      Current network status:

      • connected - connected to the socket
      • disconnected - disconnected from the socket
      • connecting - connecting to the socket
      • switching - switching network type (fast/relaxed)
      'disconnected'
      
    • Optionalsubscription?: SubscriptionEntitlementSnapshot

      The most recently fetched subscription entitlement snapshot. undefined until the account receives a socket entitlement snapshot or AccountApi.getSubscriptionStatus / AccountApi.refreshSubscription has been called.

      Subscribe to the 'updated' event (inherited from DataEntity) to react to changes; the changedKeys array will include 'subscription' when this field is refreshed.

    • Optionalusername?: string
    • OptionalwalletAddress?: string