import-db.rst (1466B)
1 .. ts:op:: importDb 2 3 Import a wallet database dump, replacing the current database 4 contents. 5 6 **Request:** 7 8 The request arguments must be an `ImportDbRequest` object. 9 10 **Response:** 11 12 On success, the result is an empty object. 13 14 **Side effects:** 15 16 Replaces the entire contents of the wallet database with the 17 imported dump. 18 19 **Expected errors:** 20 21 The caller can handle the following errors inline: 22 ``WALLET_DB_BACKEND_UNSUPPORTED``, ``WALLET_CORE_API_BAD_REQUEST``, 23 ``WALLET_CORE_REQUEST_CANCELLED``. 24 25 **Details:** 26 27 The format of ``dump`` (JSON or SQLite) is detected automatically. 28 A ``dump`` that does not look like a valid wallet database dump is 29 rejected with ``WALLET_CORE_API_BAD_REQUEST``; if the active 30 database backend cannot import the dump's format, the request 31 fails with ``WALLET_DB_BACKEND_UNSUPPORTED``. When 32 ``progressToken`` is set, progress is reported via notifications 33 and the import can be cancelled with :ts:op:`cancelProgressToken`; 34 a cancelled import fails with ``WALLET_CORE_REQUEST_CANCELLED``. 35 After a successful import, all in-memory caches (exchange, 36 denomination and refresh-cost data) are cleared, and the imported 37 records are used to recompute the derived transaction view. 38 39 .. ts:def:: ImportDbRequest 40 41 interface ImportDbRequest { 42 dump?: any; 43 44 // Correlates progress notifications and allows cancellation. 45 progressToken?: string; 46 }