@@ -16,6 +16,7 @@ struct ext_key;
1616#define WALLY_CA_PREFIX_LIQUID_REGTEST 0x04 /** Liquid v1 confidential address prefix for regtest */
1717#define WALLY_CA_PREFIX_LIQUID_TESTNET 0x17 /** Liquid v1 confidential address prefix for testnet */
1818
19+ /*** address-networks Address network constants */
1920#define WALLY_NETWORK_NONE 0x00 /** Used for miniscript parsing only */
2021#define WALLY_NETWORK_BITCOIN_MAINNET 0x01 /** Bitcoin mainnet */
2122#define WALLY_NETWORK_BITCOIN_REGTEST 0xff /** Bitcoin regtest: Behaves as testnet except for segwit */
@@ -28,6 +29,7 @@ struct ext_key;
2829#define WALLY_ADDRESS_TYPE_P2SH_P2WPKH 0x02 /** P2SH-P2WPKH wrapped SegWit address ("3...") */
2930#define WALLY_ADDRESS_TYPE_P2WPKH 0x04 /** P2WPKH native SegWit address ("bc1...)" */
3031
32+ /*** address-versions Address versions */
3133#define WALLY_ADDRESS_VERSION_P2PKH_MAINNET 0x00 /** P2PKH address on mainnet */
3234#define WALLY_ADDRESS_VERSION_P2PKH_TESTNET 0x6F /** P2PKH address on testnet */
3335#define WALLY_ADDRESS_VERSION_P2PKH_LIQUID 0x39 /** P2PKH address on liquid v1 */
@@ -51,11 +53,12 @@ struct ext_key;
5153 * Create a segwit native address from a v0 or later witness program.
5254 *
5355 * :param bytes: Witness program bytes, including the version and data push opcode.
54- * :param bytes_len: Length of ``bytes`` in bytes. Must be `` HASH160_LEN` `
55- *| or `` SHA256_LEN` ` for v0 witness programs.
56+ * :param bytes_len: Length of ``bytes`` in bytes. Must be `HASH160_LEN`
57+ *| or `SHA256_LEN` for v0 witness programs.
5658 * :param addr_family: Address family to generate, e.g. "bc" or "tb".
5759 * :param flags: For future use. Must be 0.
5860 * :param output: Destination for the resulting segwit native address string.
61+ *| The string returned should be freed using `wally_free_string`.
5962 */
6063WALLY_CORE_API int wally_addr_segwit_from_bytes (
6164 const unsigned char * bytes ,
@@ -130,10 +133,9 @@ WALLY_CORE_API int wally_addr_segwit_n_get_version(
130133 * Infer a scriptPubKey from an address.
131134 *
132135 * :param addr: Base58 encoded address to infer the scriptPubKey from.
133- *| For confidential Liquid addresses first call :c:func:`wally_confidential_addr_to_addr`
134- * :param network: One of ``WALLY_NETWORK_BITCOIN_MAINNET``, ``WALLY_NETWORK_BITCOIN_TESTNET``,
135- *| ``WALLY_NETWORK_LIQUID``, ``WALLY_NETWORK_LIQUID_REGTEST``.
136- * :param bytes_out: Destination for the resulting scriptPubKey
136+ *| For confidential Liquid addresses first call `wally_confidential_addr_to_addr`.
137+ * :param network: Network the address is for. One of the :ref:`address-networks`.
138+ * :param bytes_out: Destination for the resulting scriptPubKey.
137139 * MAX_SIZED_OUTPUT(len, bytes_out, WALLY_ADDRESS_PUBKEY_MAX_LEN)
138140 * :param written: Destination for the number of bytes written to ``bytes_out``.
139141 */
@@ -145,14 +147,16 @@ WALLY_CORE_API int wally_address_to_scriptpubkey(
145147 size_t * written );
146148
147149/**
148- * Infer address from a scriptPubKey. For SegWit addresses, use `wally_addr_segwit_from_bytes`
149- * instead. To find out if an address is SegWit, use `wally_scriptpubkey_get_type`.
150+ * Infer an address from a scriptPubKey.
150151 *
151152 * :param scriptpubkey: scriptPubKey bytes.
152153 * :param scriptpubkey_len: Length of ``scriptpubkey`` in bytes.
153- * :param network: One of ``WALLY_NETWORK_BITCOIN_MAINNET``, ``WALLY_NETWORK_BITCOIN_TESTNET``,
154- *| ``WALLY_NETWORK_LIQUID``, ``WALLY_NETWORK_LIQUID_REGTEST``.
154+ * :param network: Network to generate the address for. One of the :ref:`address-networks`.
155155 * :param output: Destination for the resulting Base58 encoded address string.
156+ *| The string returned should be freed using `wally_free_string`.
157+ *
158+ * For SegWit addresses, use `wally_addr_segwit_from_bytes` instead. To
159+ * determine if a scriptPubKey is SegWit, use `wally_scriptpubkey_get_type`.
156160 */
157161WALLY_CORE_API int wally_scriptpubkey_to_address (
158162 const unsigned char * scriptpubkey ,
@@ -164,12 +168,13 @@ WALLY_CORE_API int wally_scriptpubkey_to_address(
164168 * Convert a private key to Wallet Import Format.
165169 *
166170 * :param priv_key: Private key bytes.
167- * :param priv_key_len: The length of ``priv_key`` in bytes. Must be `` EC_PRIVATE_KEY_LEN` `.
168- * :param prefix: Expected prefix byte, e.g. `` WALLY_ADDRESS_VERSION_WIF_MAINNET` `
169- *| or `` WALLY_ADDRESS_VERSION_WIF_TESTNET` `.
170- * :param flags: Pass `` WALLY_WIF_FLAG_COMPRESSED` ` if the corresponding pubkey is compressed,
171- *| otherwise `` WALLY_WIF_FLAG_UNCOMPRESSED` `.
171+ * :param priv_key_len: The length of ``priv_key`` in bytes. Must be `EC_PRIVATE_KEY_LEN`.
172+ * :param prefix: Expected prefix byte, e.g. `WALLY_ADDRESS_VERSION_WIF_MAINNET`
173+ *| or `WALLY_ADDRESS_VERSION_WIF_TESTNET`.
174+ * :param flags: Pass `WALLY_WIF_FLAG_COMPRESSED` if the corresponding pubkey is compressed,
175+ *| otherwise `WALLY_WIF_FLAG_UNCOMPRESSED`.
172176 * :param output: Destination for the resulting Wallet Import Format string.
177+ *| The string returned should be freed using `wally_free_string`.
173178 */
174179WALLY_CORE_API int wally_wif_from_bytes (
175180 const unsigned char * priv_key ,
@@ -182,10 +187,10 @@ WALLY_CORE_API int wally_wif_from_bytes(
182187 * Convert a Wallet Import Format string to a private key.
183188 *
184189 * :param wif: Private key in Wallet Import Format.
185- * :param prefix: Prefix byte to use, e.g. `` WALLY_ADDRESS_VERSION_WIF_MAINNET` `
186- *| or `` WALLY_ADDRESS_VERSION_WIF_TESTNET` `.
187- * :param flags: Pass `` WALLY_WIF_FLAG_COMPRESSED` ` if the corresponding pubkey is compressed,
188- *| otherwise `` WALLY_WIF_FLAG_UNCOMPRESSED` `.
190+ * :param prefix: Prefix byte to use, e.g. `WALLY_ADDRESS_VERSION_WIF_MAINNET`
191+ *| or `WALLY_ADDRESS_VERSION_WIF_TESTNET`.
192+ * :param flags: Pass `WALLY_WIF_FLAG_COMPRESSED` if the corresponding pubkey is compressed,
193+ *| otherwise `WALLY_WIF_FLAG_UNCOMPRESSED`.
189194 * :param bytes_out: Destination for the private key.
190195 * FIXED_SIZED_OUTPUT(len, bytes_out, EC_PRIVATE_KEY_LEN)
191196 */
@@ -210,7 +215,8 @@ WALLY_CORE_API int wally_wif_is_uncompressed(
210215 * Create a public key corresponding to a private key in Wallet Import Format.
211216 *
212217 * :param wif: Private key in Wallet Import Format.
213- * :param prefix: Prefix byte to use, e.g. 0x80, 0xef.
218+ * :param prefix: Expected prefix byte, e.g. `WALLY_ADDRESS_VERSION_WIF_MAINNET`
219+ *| or `WALLY_ADDRESS_VERSION_WIF_TESTNET`.
214220 * :param bytes_out: Destination for the resulting public key.
215221 * :param len: The length of ``bytes_out``.
216222 * :param written: Destination for the number of bytes written to ``bytes_out``.
@@ -226,11 +232,11 @@ WALLY_CORE_API int wally_wif_to_public_key(
226232 * Create a legacy or wrapped SegWit address corresponding to a BIP32 key.
227233 *
228234 * :param hdkey: The extended key to use.
229- * :param flags: `` WALLY_ADDRESS_TYPE_P2PKH`` for a legacy address, `` WALLY_ADDRESS_TYPE_P2SH_P2WPKH` `
235+ * :param flags: `WALLY_ADDRESS_TYPE_P2PKH` for a legacy address, `WALLY_ADDRESS_TYPE_P2SH_P2WPKH`
230236 *| for P2SH-wrapped SegWit.
231- * :param version: Version byte to generate address, e.g. with Bitcoin: ``WALLY_ADDRESS_VERSION_P2PKH_MAINNET``,
232- *| ``WALLY_ADDRESS_VERSION_P2PKH_TESTNET``, ``WALLY_ADDRESS_VERSION_P2SH_MAINNET`` and ``WALLY_ADDRESS_VERSION_P2SH_TESTNET``.
237+ * :param version: Address version to generate. One of the :ref:`address-versions`.
233238 * :param output: Destination for the resulting address string.
239+ *| The string returned should be freed using `wally_free_string`.
234240 */
235241WALLY_CORE_API int wally_bip32_key_to_address (
236242 const struct ext_key * hdkey ,
@@ -245,6 +251,7 @@ WALLY_CORE_API int wally_bip32_key_to_address(
245251 * :param addr_family: Address family to generate, e.g. "bc" or "tb".
246252 * :param flags: For future use. Must be 0.
247253 * :param output: Destination for the resulting segwit native address string.
254+ *| The string returned should be freed using `wally_free_string`.
248255 */
249256WALLY_CORE_API int wally_bip32_key_to_addr_segwit (
250257 const struct ext_key * hdkey ,
@@ -257,8 +264,9 @@ WALLY_CORE_API int wally_bip32_key_to_addr_segwit(
257264 *
258265 * :param wif: Private key in Wallet Import Format.
259266 * :param prefix: Prefix byte to use, e.g. 0x80, 0xef.
260- * :param version: Version byte to generate address, e.g. ``WALLY_ADDRESS_VERSION_P2PKH_MAINNET``, ``WALLY_ADDRESS_VERSION_P2PKH_TESTNET` `.
267+ * :param version: Address version to generate. One of the :ref:`address-versions `.
261268 * :param output: Destination for the resulting address string.
269+ *| The string returned should be freed using `wally_free_string`.
262270 */
263271WALLY_CORE_API int wally_wif_to_address (
264272 const char * wif ,
@@ -271,8 +279,9 @@ WALLY_CORE_API int wally_wif_to_address(
271279 * Extract the address from a confidential address.
272280 *
273281 * :param address: The base58 encoded confidential address to extract the address from.
274- * :param prefix: The confidential address prefix byte, e.g. `` WALLY_CA_PREFIX_LIQUID` `.
282+ * :param prefix: The confidential address prefix byte, e.g. `WALLY_CA_PREFIX_LIQUID`.
275283 * :param output: Destination for the resulting address string.
284+ *| The string returned should be freed using `wally_free_string`.
276285 */
277286WALLY_CORE_API int wally_confidential_addr_to_addr (
278287 const char * address ,
@@ -283,7 +292,7 @@ WALLY_CORE_API int wally_confidential_addr_to_addr(
283292 * Extract the blinding public key from a confidential address.
284293 *
285294 * :param address: The base58 encoded confidential address to extract the public key from.
286- * :param prefix: The confidential address prefix byte, e.g. `` WALLY_CA_PREFIX_LIQUID` `.
295+ * :param prefix: The confidential address prefix byte, e.g. `WALLY_CA_PREFIX_LIQUID`.
287296 * :param bytes_out: Destination for the public key.
288297 * FIXED_SIZED_OUTPUT(len, bytes_out, EC_PUBLIC_KEY_LEN)
289298 */
@@ -297,10 +306,11 @@ WALLY_CORE_API int wally_confidential_addr_to_ec_public_key(
297306 * Create a confidential address from an address and blinding public key.
298307 *
299308 * :param address: The base58 encoded address to make confidential.
300- * :param prefix: The confidential address prefix byte, e.g. `` WALLY_CA_PREFIX_LIQUID` `.
309+ * :param prefix: The confidential address prefix byte, e.g. `WALLY_CA_PREFIX_LIQUID`.
301310 * :param pub_key: The blinding public key to associate with ``address``.
302- * :param pub_key_len: The length of ``pub_key`` in bytes. Must be `` EC_PUBLIC_KEY_LEN` `.
311+ * :param pub_key_len: The length of ``pub_key`` in bytes. Must be `EC_PUBLIC_KEY_LEN`.
303312 * :param output: Destination for the resulting address string.
313+ *| The string returned should be freed using `wally_free_string`.
304314 */
305315WALLY_CORE_API int wally_confidential_addr_from_addr (
306316 const char * address ,
@@ -345,7 +355,7 @@ WALLY_CORE_API int wally_confidential_addr_segwit_to_ec_public_key(
345355 * :param addr_family: The address family to generate.
346356 * :param confidential_addr_family: The confidential address family to generate.
347357 * :param pub_key: The blinding public key to associate with ``address``.
348- * :param pub_key_len: The length of ``pub_key`` in bytes. Must be `` EC_PUBLIC_KEY_LEN` `.
358+ * :param pub_key_len: The length of ``pub_key`` in bytes. Must be `EC_PUBLIC_KEY_LEN`.
349359 * :param output: Destination for the resulting address string.
350360 *| The string returned should be freed using `wally_free_string`.
351361 */
0 commit comments