[#wallet-WalletContext] = xref:wallet.adoc[wallet]::WalletContext :relfileprefix: ../ :mrdocs: WalletContext struct containing references to state shared between CWallet instances, like the reference to the chain interface, and the list of opened wallets. == Synopsis Declared in `<wallet/context.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct WalletContext; ---- == Description Future shared state can be added here as an alternative to adding global variables. The struct isn't intended to have any member functions. It should just be a collection of state pointers that doesn't pull in dependencies or implement behavior. == Member Functions [cols="1,4"] |=== | Name| Description | xref:wallet/WalletContext/2constructor.adoc[`WalletContext`] [.small]#[constructor]# | Declare default constructor and destructor that are not inline, so code instantiating the WalletContext struct doesn't need to #include class definitions for smart pointer and container members. | xref:wallet/WalletContext/2destructor.adoc[`~WalletContext`] [.small]#[destructor]# | Destroys the wallet context. |=== == Data Members [cols="1,4"] |=== | Name| Description | xref:wallet/WalletContext/args.adoc[`args`] | Command‐line and configuration arguments. | xref:wallet/WalletContext/chain.adoc[`chain`] | Interface to the blockchain, shared by all wallets. | xref:wallet/WalletContext/scheduler.adoc[`scheduler`] | Scheduler used to run periodic wallet tasks. | xref:wallet/WalletContext/wallet_load_fns.adoc[`wallet_load_fns`] | Callbacks invoked when a wallet is loaded. | xref:wallet/WalletContext/wallets.adoc[`wallets`] | The currently opened wallets. | xref:wallet/WalletContext/wallets_mutex.adoc[`wallets_mutex`] | Guards the list of opened wallets and load callbacks. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:wallet/AddWallet.adoc[`AddWallet`] | Register a loaded wallet with the wallet context. | xref:wallet/CreateWallet.adoc[`CreateWallet`] | Create a new wallet and load it into the context. | xref:wallet/EnsureWalletContext.adoc[`EnsureWalletContext`] | Retrieves the WalletContext stored in an RPC context, throwing if absent. | xref:wallet/GetDefaultWallet.adoc[`GetDefaultWallet`] | Return the default wallet and report how many wallets are loaded. | xref:wallet/GetWallet.adoc[`GetWallet`] | Look up a loaded wallet by name. | xref:wallet/GetWallets.adoc[`GetWallets`] | Return all wallets currently loaded in the context. | xref:wallet/HandleLoadWallet.adoc[`HandleLoadWallet`] | Register a callback invoked whenever a wallet is loaded. | xref:wallet/LoadWallet.adoc[`LoadWallet`] | Load an existing wallet from disk into the context. | xref:wallet/LoadWallets.adoc[`LoadWallets`] | Load wallet databases. | xref:wallet/MaybeResendWalletTxs.adoc[`MaybeResendWalletTxs`] | Called periodically by the schedule thread. Prompts individual wallets to resend their transactions. Actual rebroadcast schedule is managed by the wallets themselves. | xref:wallet/NotifyWalletLoaded.adoc[`NotifyWalletLoaded`] | Fire the load‐wallet callbacks for a newly loaded wallet. | xref:wallet/RemoveWallet-01.adoc[`RemoveWallet`] | Remove a wallet from the wallet context and optionally update its load‐on‐startup setting. | xref:wallet/RemoveWallet-05.adoc[`RemoveWallet`] | Remove a wallet from the wallet context and optionally update its load‐on‐startup setting. | xref:wallet/RestoreWallet.adoc[`RestoreWallet`] | Restore a wallet from a backup file. | xref:wallet/StartWallets.adoc[`StartWallets`] | Complete startup of wallets. | xref:wallet/UnloadWallets.adoc[`UnloadWallets`] | Stop and unload all wallets held by the context. | xref:wallet/VerifyWallets.adoc[`VerifyWallets`] | Responsible for reading and validating the ‐wallet arguments and verifying the wallet database. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#