Contents

importDb#

Import a wallet database dump, replacing the current database contents.

Request:

The request arguments must be an ImportDbRequest object.

Response:

On success, the result is an empty object.

Side effects:

Replaces the entire contents of the wallet database with the imported dump.

Expected errors:

The caller can handle the following errors inline: WALLET_DB_BACKEND_UNSUPPORTED, WALLET_CORE_API_BAD_REQUEST, WALLET_CORE_REQUEST_CANCELLED.

Details:

The format of dump (JSON or SQLite) is detected automatically. A dump that does not look like a valid wallet database dump is rejected with WALLET_CORE_API_BAD_REQUEST; if the active database backend cannot import the dump’s format, the request fails with WALLET_DB_BACKEND_UNSUPPORTED. When progressToken is set, progress is reported via notifications and the import can be cancelled with cancelProgressToken; a cancelled import fails with WALLET_CORE_REQUEST_CANCELLED. After a successful import, all in-memory caches (exchange, denomination and refresh-cost data) are cleared, and the imported records are used to recompute the derived transaction view.

interface ImportDbRequest {
  dump?: any;

  // Correlates progress notifications and allows cancellation.
  progressToken?: string;
}