@exodus/application

中文文档
4.0.1发布于 2026/10/10MITTypeScriptES Module近 30 天下载 1.1万

Feature that manages the Exodus SDK application lifecycle.

原始使用文档
文档目录6 节
  1. Table of Contents
  2. How it works
  3. Usage
  4. Lifecycle Hooks
  5. Available hooks
  6. Visual representation

@exodus/application

The application package represents the high-level application that uses the Exodus SDK.

Table of Contents

How it works

It orchestrates the creation, importation, deletion, and restoration of wallets, handles security aspects like locking and passphrase management, and provides a flexible hook system for other components to respond to lifecycle events.

Usage

This feature is available as part of @exodus/headless, there is no need to install it separately.

For examples on using this feature in both the API and UI side, please refer to the related SDK playground page.

Lifecycle Hooks

While using the Exodus SDK, the application can subscribe to several lifecycle hooks, which are triggered in application package.

Hooks subscriptions are handled by registering a plugin node against the IoC container. The plugin can export several different hooks, which are invoked when the corresponding lifecycle event happens.

For instance, if you want to run some code when the application is started, you can create a plugin like this:

const plugin = () => {
  const onStart = ({ isBackedUp }) => {
    // Run some code when the application starts
  }

  return {
    onStart,
  }
}

const myPluginDefinition = {
  id: 'myPlugin', // unique id
  type: 'plugin', // type of the node
  factory: plugin, // factory function
}

Available hooks

Some hooks receive parameters, if so, they are documented below.

  • onStart: Triggered when the application starts. Called with { walletExists, hasPassphraseSet, isLocked, isBackedUp, isRestoring }.
  • onRestart: Triggered when the application restarts. Called with { reason } and other parameters (varies depending on the reason).
  • onStop: Triggered when the application stops.
  • onLoad: Do NOT use this hook. Its sole purpose is a hack to support the browser extension, where the UI might die and be recreated while the background process is long-lived. In that scenario, onLoad is triggered when a new UI is recreated and connects to the background process. Called with the same parameters as onStart.
  • onUnload: Triggered when the application is unloaded, i.e., the app is closed.
  • onCreate: Triggered when a new wallet is created. Called with { walletExists, hasPassphraseSet, isLocked, isBackedUp, isRestoring, seedId, createResult }.
  • onImport: Triggered when a wallet is imported. Called with { seedId, compatibilityMode, backupType, importResult }.
  • onDelete: Triggered when a wallet is deleted.
  • onRestore: Triggered when a wallet (primary seed) restore process starts. Called with { backupType }.
  • onRestoreCompleted: Triggered when a wallet seed restore process completes. Called with { backupType }.
  • onAssetsSynced: Triggered when the assets are synced.
  • onChangePassphrase: Triggered when the passphrase is changed.
  • onLock: Triggered when the application is locked.
  • onUnlock: Triggered when the application is unlocked.
  • onClear: Triggered when the application is cleared, i.e., after the current wallet is deleted. Hook functions are executed concurrently.

Visual representation

Below you can find a state diagram that visualize what hooks are triggered between state transitions:

stateDiagram-v2
    direction LR
    [*] --> Starting

    state Starting {
        direction LR

        state "Needs clear storage?*" as NeedsClear
        state "Is importing?" as IsImporting

        NeedsClear --> Clearing : CLEAR
        Clearing --> IsImporting
        IsImporting --> Importing : IMPORT
    }

    Starting --> Started : START

    state Started {
        direction LR

        state "Has seed?" as HasSeed

        HasSeed --> Empty : No
        HasSeed --> Locked : Yes

        Empty --> Locked : CREATE \n---or---\nIMPORT

        Locked --> Migrating : MIGRATE
        Migrating --> Unlocked : UNLOCK
        Unlocked --> Locked : LOCK

        Unlocked --> Restarting : DELETE


    }

    Restarting --> [*] : RESTART

    Started --> Started : LOAD

    classDef conditional fill:#ededed,stroke:#c2c2c2,color:#a6a6a6,stroke-width:2;

    class NeedsClear conditional
    class IsImporting conditional
    class HasSeed conditional

* Wallet needs to clear storage if seed is not present or is restoring a new wallet

版本与发布记录

@exodus/application 共发布 47 个版本,首次发布于 2024/05/31;过去 12 个月发布了 10 个版本。

版本发布日期距今
4.0.1latest2026/10/101 个月前
4.0.02026/07/213 个月前
3.0.12026/06/174 个月前
3.0.02026/06/035 个月前
2.15.42026/04/246 个月前
2.15.32026/04/246 个月前

关于 @exodus/application 的常见问题

@exodus/application 是什么?

Feature that manages the Exodus SDK application lifecycle.

如何安装 @exodus/application?

在项目目录运行 npm install @exodus/application,或使用 pnpm add / yarn add / bun add。

@exodus/application 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@exodus/application 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@exodus/application 可以商用吗?

@exodus/application 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@exodus/application 的下载量有多少?

根据 npm 官方下载统计,@exodus/application 在 2026/10/14 – 2026/11/12 这 30 天内被下载 10,980 次,日均约 366 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@exodus/application 还在维护吗?

最新版本 4.0.1 发布于 2026/10/10(1 个月前);至今共发布 47 个版本,其中过去 12 个月发布了 10 个;首次发布于 2024/05/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。