FileWallet 文件钱包
/// Wallet information tracking all our outputs. Based on HD derivation and
/// avoids storing any key data, only storing output amounts and child index.
#[derive(Debug, Clone)]
pub struct FileWallet<K> {
/// Keychain
pub keychain: Option<K>,
/// Configuration
pub config: WalletConfig,
/// passphrase: TODO better ways of dealing with this other than storing
passphrase: String,
/// List of outputs
pub outputs: HashMap<String, OutputData>,
/// Details
pub details: WalletDetails,
/// Data file path
pub data_file_path: String,
/// Backup file path
pub backup_file_path: String,
/// lock file path
pub lock_file_path: String,
/// details file path
pub details_file_path: String,
/// Details backup file path
pub details_bak_path: String,
}
OutputData
/// Information about an output that's being tracked by the wallet. Must be
/// enough to reconstruct the commitment associated with the output when the
/// root private key is known.*/
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, PartialOrd, Eq, Ord)]
pub struct OutputData {
/// Root key_id that the key for this output is derived from
pub root_key_id: Identifier,
/// Derived key for this output
pub key_id: Identifier,
/// How many derivations down from the root key
pub n_child: u32,
/// Value of the output, necessary to rebuild the commitment
pub value: u64,
/// Current status of the output
pub status: OutputStatus,
/// Height of the output
pub height: u64,
/// Height we are locked until
pub lock_height: u64,
/// Is this a coinbase output? Is it subject to coinbase locktime?
pub is_coinbase: bool,
/// Hash of the block this output originated from.
pub block: Option<BlockIdentifier>,
/// Merkle proof
pub merkle_proof: Option<MerkleProofWrapper>,
}
Controller
OwnerAPIGetHandler
/// API Handler/Wrapper for owner functions
pub struct OwnerAPIGetHandler<T, K>
where
T: WalletBackend<K>,
K: Keychain,
{
/// Wallet instance
pub wallet: Arc<Mutex<T>>,
phantom: PhantomData<K>,
}
OwnerAPIPostHandler
pub struct OwnerAPIPostHandler<T, K>
where
T: WalletBackend<K>,
K: Keychain,
{
/// Wallet instance
pub wallet: Arc<Mutex<T>>,
phantom: PhantomData<K>,
}
OwnerAPIOptionsHandler
/// Options handler
pub struct OwnerAPIOptionsHandler {}
ForeignAPIHandler
/// API Handler/Wrapper for foreign functions
pub struct ForeignAPIHandler<T, K>
where
T: WalletBackend<K> + WalletClient,
K: Keychain,
{
/// Wallet instance
pub wallet: Arc<Mutex<T>>,
phantom: PhantomData<K>,
}