Class WalletManager<WalletMetadata, AccountMetadata>

Helper class for background scripts using wallet manager. Uses wallet and store factories to create wallets. Keeps track of created stores and reuses them when a wallet is reactivated.

Type Parameters

  • WalletMetadata extends {
        name: string;
    }

  • AccountMetadata extends {
        name: string;
    }

Hierarchy

  • WalletManager

Implements

Constructors

Properties

#activeWalletProps: null | WalletManagerActivateProps<string, unknown> = null
#logger: Logger
#managerStorage: StorageArea
#managerStorageKey: string
#signingCoordinatorApi: SigningCoordinatorSignApi<WalletMetadata, AccountMetadata>
#storesFactory: StoresFactory
#walletFactory: WalletFactory<WalletMetadata, AccountMetadata>
#walletRepository: WalletRepository<WalletMetadata, AccountMetadata>
#walletStores: Map<string, WalletStores> = ...
activeWallet$: BehaviorSubject<null | ActiveWallet> = ...
activeWalletId$: ReplaySubject<null | WalletManagerActivateProps<string, unknown>> = ...

Methods

  • Private

    Builds the witnesser for the given wallet.

    Parameters

    • wallet: AnyWallet<WalletMetadata, AccountMetadata>

      The wallet to build the witnesser for.

    • _walletId: string

      The wallet id to build the witnesser for.

    • chainId: ChainId

      The chain id to build the witnesser for.

    • Optional accountIndex: number

      The account index to build the witnesser for.

    Returns Witnesser

  • Create and activate a new ObservableWallet.

    Returns

    A Promise that resolves once the wallet has been successfully activated.

    Parameters

    • props: WalletManagerActivateProps<string, unknown>

      An object containing the necessary properties and configurations to activate the wallet.

    • Optional force: boolean

      Optional. A boolean flag that determines the activation behavior. If set to true, the wallet will be activated regardless of whether its properties have changed since the last activation. This is useful for scenarios where reinitialization is needed without changes to the properties. Defaults to false, meaning the wallet will only be activated if there have been changes in the props.

    Returns Promise<void>

Generated using TypeDoc