diff options
Diffstat (limited to 'src/walletcmd.h')
| -rw-r--r-- | src/walletcmd.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/walletcmd.h b/src/walletcmd.h new file mode 100644 index 0000000..89834d8 --- /dev/null +++ b/src/walletcmd.h | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | // Copyright (c) 2026 Bitflash developers | ||
| 2 | // Distributed under the MIT/X11 software license. | ||
| 3 | // | ||
| 4 | // Recovery-phrase commands. Both run against a loaded wallet and then exit; | ||
| 5 | // neither starts the node. | ||
| 6 | |||
| 7 | #ifndef BITFLASH_WALLETCMD_H | ||
| 8 | #define BITFLASH_WALLETCMD_H | ||
| 9 | |||
| 10 | #include <string> | ||
| 11 | |||
| 12 | // Create a phrase for a wallet that does not have one, install the seed, and | ||
| 13 | // show the words once. Refuses if a phrase already exists. Returns 0 on success. | ||
| 14 | int CmdNewPhrase(); | ||
| 15 | |||
| 16 | // Install the seed a phrase describes, derive forward looking for used | ||
| 17 | // addresses, and rescan the chain so their coins appear. Returns 0 on success. | ||
| 18 | int CmdRestorePhrase(const std::string& strMnemonic, int nMinDepth = 0); | ||
| 19 | |||
| 20 | // Called once per batch with how many addresses have been derived so far and | ||
| 21 | // how many transactions the wallet now holds. | ||
| 22 | typedef void (*RestoreProgressFn)(void* pArg, int nDerived, int nRecovered); | ||
| 23 | |||
| 24 | // The restore itself, shared by the command and the GUI so the two cannot | ||
| 25 | // drift apart. Returns false without touching the wallet if the chain is not | ||
| 26 | // loaded or the phrase is not valid. | ||
| 27 | bool RestoreFromPhrase(const std::string& strMnemonic, | ||
| 28 | int nMinDepth, | ||
| 29 | RestoreProgressFn fnProgress, | ||
| 30 | void* pArg, | ||
| 31 | std::string& strErrorRet, | ||
| 32 | int& nRecoveredRet, | ||
| 33 | int& nDerivedRet); | ||
| 34 | |||
| 35 | // Take the next address from the key pool and print it. With a recovery phrase | ||
| 36 | // installed the address is derived, so the phrase can bring back whatever is | ||
| 37 | // paid to it. | ||
| 38 | int CmdNewAddress(); | ||
| 39 | |||
| 40 | // Diagnostic: print the first nCount addresses this wallet's phrase derives. | ||
| 41 | int CmdShowDerived(int nCount); | ||
| 42 | |||
| 43 | #endif | ||