@@ -96,9 +96,10 @@ TWData* _Nonnull TWHDWalletEntropy(struct TWHDWallet* _Nonnull wallet);
9696/// \param wallet non-null TWHDWallet
9797/// \param curve a curve
9898/// \note Returned object needs to be deleted with \TWPrivateKeyDelete
99- /// \return Non-null corresponding private key
99+ /// \note Null is returned if the key cannot be derived (e.g. empty mnemonic entropy)
100+ /// \return Nullable corresponding private key
100101TW_EXPORT_METHOD
101- struct TWPrivateKey * _Nonnull TWHDWalletGetMasterKey (struct TWHDWallet * _Nonnull wallet , enum TWCurve curve );
102+ struct TWPrivateKey * _Nullable TWHDWalletGetMasterKey (struct TWHDWallet * _Nonnull wallet , enum TWCurve curve ) ;
102103
103104/// Generates the default private key for the specified coin, using default derivation.
104105///
@@ -107,28 +108,31 @@ struct TWPrivateKey* _Nonnull TWHDWalletGetMasterKey(struct TWHDWallet* _Nonnull
107108/// \param wallet non-null TWHDWallet
108109/// \param coin a coin type
109110/// \note Returned object needs to be deleted with \TWPrivateKeyDelete
110- /// \return return the default private key for the specified coin
111+ /// \note Null is returned if the key cannot be derived (e.g. empty mnemonic entropy)
112+ /// \return the default private key for the specified coin, or null on failure
111113TW_EXPORT_METHOD
112- struct TWPrivateKey * _Nonnull TWHDWalletGetKeyForCoin (struct TWHDWallet * _Nonnull wallet , enum TWCoinType coin );
114+ struct TWPrivateKey * _Nullable TWHDWalletGetKeyForCoin (struct TWHDWallet * _Nonnull wallet , enum TWCoinType coin ) ;
113115
114116/// Generates the default address for the specified coin (without exposing intermediary private key), default derivation.
115117///
116118/// \see TWHDWalletGetAddressDerivation
117119/// \param wallet non-null TWHDWallet
118120/// \param coin a coin type
119- /// \return return the default address for the specified coin as a non-null TWString
121+ /// \note Null is returned if the address cannot be derived (e.g. empty mnemonic entropy)
122+ /// \return the default address for the specified coin, or null on failure
120123TW_EXPORT_METHOD
121- TWString * _Nonnull TWHDWalletGetAddressForCoin (struct TWHDWallet * _Nonnull wallet , enum TWCoinType coin );
124+ TWString * _Nullable TWHDWalletGetAddressForCoin (struct TWHDWallet * _Nonnull wallet , enum TWCoinType coin );
122125
123126/// Generates the default address for the specified coin and derivation (without exposing intermediary private key).
124127///
125128/// \see TWHDWalletGetAddressForCoin
126129/// \param wallet non-null TWHDWallet
127130/// \param coin a coin type
128131/// \param derivation a (custom) derivation to use
129- /// \return return the default address for the specified coin as a non-null TWString
132+ /// \note Null is returned if the address cannot be derived (e.g. empty mnemonic entropy)
133+ /// \return the default address for the specified coin, or null on failure
130134TW_EXPORT_METHOD
131- TWString * _Nonnull TWHDWalletGetAddressDerivation (struct TWHDWallet * _Nonnull wallet , enum TWCoinType coin , enum TWDerivation derivation );
135+ TWString * _Nullable TWHDWalletGetAddressDerivation (struct TWHDWallet * _Nonnull wallet , enum TWCoinType coin , enum TWDerivation derivation );
132136
133137/// Generates the private key for the specified derivation path.
134138///
@@ -150,9 +154,10 @@ struct TWPrivateKey* _Nullable TWHDWalletGetKey(struct TWHDWallet* _Nonnull wall
150154/// \param coin a coin type
151155/// \param derivation a (custom) derivation to use
152156/// \note Returned object needs to be deleted with \TWPrivateKeyDelete
153- /// \return The private key for the specified derivation path/coin
157+ /// \note Null is returned if the key cannot be derived (e.g. empty mnemonic entropy)
158+ /// \return The private key for the specified derivation path/coin, or null on failure
154159TW_EXPORT_METHOD
155- struct TWPrivateKey * _Nonnull TWHDWalletGetKeyDerivation (struct TWHDWallet * _Nonnull wallet , enum TWCoinType coin , enum TWDerivation derivation );
160+ struct TWPrivateKey * _Nullable TWHDWalletGetKeyDerivation (struct TWHDWallet * _Nonnull wallet , enum TWCoinType coin , enum TWDerivation derivation ) ;
156161
157162/// Generates the private key for the specified derivation path and curve.
158163///
@@ -174,9 +179,10 @@ struct TWPrivateKey* _Nullable TWHDWalletGetKeyByCurve(struct TWHDWallet* _Nonnu
174179/// \param change valid bip44 change
175180/// \param address valid bip44 address
176181/// \note Returned object needs to be deleted with \TWPrivateKeyDelete
177- /// \return The private key for the specified bip44 parameters
182+ /// \note Null is returned if the key cannot be derived (e.g. empty mnemonic entropy)
183+ /// \return The private key for the specified bip44 parameters, or null on failure
178184TW_EXPORT_METHOD
179- struct TWPrivateKey * _Nonnull TWHDWalletGetDerivedKey (struct TWHDWallet * _Nonnull wallet , enum TWCoinType coin , uint32_t account , uint32_t change , uint32_t address );
185+ struct TWPrivateKey * _Nullable TWHDWalletGetDerivedKey (struct TWHDWallet * _Nonnull wallet , enum TWCoinType coin , uint32_t account , uint32_t change , uint32_t address ) ;
180186
181187/// Returns the extended private key (for default 0 account).
182188///
0 commit comments