1 %module wallycore
2 %{
3 #include "../include/wally_core.h"
4 #include "../include/wally_address.h"
5 #include "../include/wally_anti_exfil.h"
6 #include "../include/wally_bip32.h"
7 #include "bip32_int.h"
8 #include "../include/wally_bip38.h"
9 #include "../include/wally_bip39.h"
10 #include "../include/wally_crypto.h"
11 #include "../include/wally_psbt.h"
12 #include "psbt_int.h"
13 #include "../include/wally_script.h"
14 #include "../include/wally_symmetric.h"
15 #include "../include/wally_transaction.h"
16 #include "transaction_int.h"
17 #include "../include/wally_elements.h"
18 #include "../internal.h"
19 #include <limits.h>
20 
21 
check_result(JNIEnv * jenv,int result)22 static int check_result(JNIEnv *jenv, int result)
23 {
24     switch (result) {
25     case WALLY_OK:
26         break;
27     case WALLY_EINVAL:
28         SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "Invalid argument");
29         break;
30     case WALLY_ENOMEM:
31         SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "Out of memory");
32         break;
33     default: /* WALLY_ERROR */
34         SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed");
35         break;
36     }
37     return result;
38 }
39 
int_cast(JNIEnv * jenv,size_t value)40 static int int_cast(JNIEnv *jenv, size_t value) {
41     if (value > UINT_MAX)
42         SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Invalid length");
43     return (int)value;
44 }
45 
uint32_cast(JNIEnv * jenv,jlong value)46 static uint32_t uint32_cast(JNIEnv *jenv, jlong value) {
47     if (value < 0 || value > UINT_MAX)
48         SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Invalid uint32_t");
49     return (uint32_t)value;
50 }
51 
52 /* Use a static class to hold our opaque pointers */
53 #define OBJ_CLASS "com/blockstream/libwally/Wally$Obj"
54 
55 /* Create and return a java object to hold an opaque pointer */
create_obj(JNIEnv * jenv,void * p,int id)56 static jobject create_obj(JNIEnv *jenv, void *p, int id) {
57     jclass clazz;
58     jmethodID ctor;
59 
60     if (!(clazz = (*jenv)->FindClass(jenv, OBJ_CLASS)))
61         return NULL;
62     if (!(ctor = (*jenv)->GetMethodID(jenv, clazz, "<init>", "(JI)V")))
63         return NULL;
64     return (*jenv)->NewObject(jenv, clazz, ctor, (jlong)(uintptr_t)p, id);
65 }
66 
67 /* Fetch an opaque pointer from a java object */
get_obj(JNIEnv * jenv,jobject obj,int id)68 static void *get_obj(JNIEnv *jenv, jobject obj, int id) {
69     jclass clazz;
70     jmethodID getter;
71     void *ret;
72 
73     if (!obj || !(clazz = (*jenv)->GetObjectClass(jenv, obj)))
74         return NULL;
75     getter = (*jenv)->GetMethodID(jenv, clazz, "get_id", "()I");
76     if (!getter || (*jenv)->CallIntMethod(jenv, obj, getter) != id ||
77         (*jenv)->ExceptionOccurred(jenv))
78         return NULL;
79     getter = (*jenv)->GetMethodID(jenv, clazz, "get", "()J");
80     if (!getter)
81         return NULL;
82     ret = (void *)(uintptr_t)((*jenv)->CallLongMethod(jenv, obj, getter));
83     return (*jenv)->ExceptionOccurred(jenv) ? NULL : ret;
84 }
85 
get_obj_or_throw(JNIEnv * jenv,jobject obj,int id,const char * name)86 static void* get_obj_or_throw(JNIEnv *jenv, jobject obj, int id, const char *name) {
87     void *ret = get_obj(jenv, obj, id);
88     if (!ret)
89         SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, name);
90     return ret;
91 }
92 
malloc_or_throw(JNIEnv * jenv,size_t len)93 static unsigned char* malloc_or_throw(JNIEnv *jenv, size_t len) {
94     unsigned char *p = (unsigned char *)wally_malloc(len);
95     if (!p)
96         SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "Out of memory");
97     return p;
98 }
99 
create_array(JNIEnv * jenv,const unsigned char * p,size_t len)100 static jbyteArray create_array(JNIEnv *jenv, const unsigned char* p, size_t len) {
101     jbyteArray ret = (*jenv)->NewByteArray(jenv, len);
102     if (ret)
103         (*jenv)->SetByteArrayRegion(jenv, ret, 0, len, (const jbyte*)p);
104     return ret;
105 }
106 
107 #define member_size(struct_, member) sizeof(((struct struct_ *)0)->member)
108 %}
109 
110 %javaconst(1);
111 %ignore wally_free_string;
112 %ignore wally_bzero;
113 
114 %pragma(java) jniclasscode=%{
loadLibrary()115     private static boolean loadLibrary() {
116         try {
117             System.loadLibrary("wallycore");
118             return true;
119         } catch (final UnsatisfiedLinkError e) {
120             System.err.println("Native code library failed to load.\n" + e);
121             return false;
122         }
123     }
124 
125     private static final boolean enabled = loadLibrary();
isEnabled()126     public static boolean isEnabled() {
127         return enabled;
128     }
129 
130     static final class Obj {
131         private final transient long ptr;
132         private final int id;
Obj(final long ptr,final int id)133         private Obj(final long ptr, final int id) { this.ptr = ptr; this.id = id; }
get()134         private long get() { return ptr; }
get_id()135         private int get_id() { return id; }
136     }
137 %}
138 
139 /* Raise an exception whenever a function fails */
140 %exception {
141     if (!(*jenv)->ExceptionOccurred(jenv)) {
142         $action
143         check_result(jenv, result);
144     }
145 }
146 
147 /* Don't use our int return value except for exception checking */
148 %typemap(out) int %{
149 %}
150 
151 /* Output parameters indicating how many bytes were written/sizes are
152  * converted into return values. */
153 %typemap(in,noblock=1,numinputs=0) size_t *written(size_t sz) {
154     sz = 0; $1 = ($1_ltype)&sz;
155 }
156 %typemap(in,noblock=1,numinputs=0) size_t *output(size_t sz) {
157     sz = 0; $1 = ($1_ltype)&sz;
158 }
159 %typemap(argout,noblock=1) size_t* {
160     $result = int_cast(jenv, *$1);
161 }
162 
163 /* Output strings are converted to native Java strings and returned */
164 %typemap(in,noblock=1,numinputs=0) char **output(char *temp = 0) {
165     $1 = &temp;
166 }
167 %typemap(argout,noblock=1) (char **output) {
168     $result = NULL;
169     if ($1 && *$1) {
170         if (!(*jenv)->ExceptionOccurred(jenv))
171             $result = (*jenv)->NewStringUTF(jenv, *$1);
172         wally_free_string(*$1);
173     }
174 }
175 
176 /* uint32_t input arguments are taken as longs and cast with range checking */
177 %typemap(in) uint32_t {
178     $1 = uint32_cast(jenv, $input);
179 }
180 
181 /* uint64_t input arguments are taken as longs and cast unchecked. This means
182  * callers need to take care with treating negative values correctly */
183 %typemap(in) uint64_t {
184     $1 = (uint64_t)($input);
185 }
186 
187 /* Treat uint32_t/uint64_t arrays like strings of ints */
188 %define %java_int_array(INTTYPE, JNITYPE, JTYPE, GETFN, RELEASEFN)
189 %typemap(jni)     (INTTYPE *STRING, size_t LENGTH) "JNITYPE"
190 %typemap(jtype)   (INTTYPE *STRING, size_t LENGTH) "JTYPE[]"
191 %typemap(jstype)  (INTTYPE *STRING, size_t LENGTH) "JTYPE[]"
192 %typemap(javain)  (INTTYPE *STRING, size_t LENGTH) "$javainput"
193 %typemap(freearg) (INTTYPE *STRING, size_t LENGTH) ""
194 %typemap(in)      (INTTYPE *STRING, size_t LENGTH) {
195     if (!(*jenv)->ExceptionOccurred(jenv)) {
196         $1 = $input ? (INTTYPE *) JCALL2(GETFN, jenv, $input, 0) : 0;
197         $2 = $input ? (size_t) JCALL1(GetArrayLength, jenv, $input) : 0;
198     } else {
199         $1 = 0;
200         $2 = 0;
201     }
202 }
203 %typemap(argout)  (INTTYPE *STRING, size_t LENGTH) {
204   if ($input) JCALL3(RELEASEFN, jenv, $input, (j##JTYPE *)$1, 0);
205 }
206 %enddef
207 
208 %java_int_array(uint32_t, jintArray, int, GetIntArrayElements, ReleaseIntArrayElements)
209 %java_int_array(uint64_t, jlongArray, long, GetLongArrayElements, ReleaseLongArrayElements)
210 
211 /* BEGIN AUTOGENERATED */
212 %apply(char *STRING, size_t LENGTH) { (const unsigned char* abf, size_t abf_len) };
213 %apply(char *STRING, size_t LENGTH) { (const unsigned char* asset, size_t asset_len) };
214 %apply(char *STRING, size_t LENGTH) { (const unsigned char* bytes, size_t bytes_len) };
215 %apply(char *STRING, size_t LENGTH) { (const unsigned char* chain_code, size_t chain_code_len) };
216 %apply(char *STRING, size_t LENGTH) { (const unsigned char* commitment, size_t commitment_len) };
217 %apply(char *STRING, size_t LENGTH) { (const unsigned char* contract_hash, size_t contract_hash_len) };
218 %apply(char *STRING, size_t LENGTH) { (const unsigned char* entropy, size_t entropy_len) };
219 %apply(char *STRING, size_t LENGTH) { (const unsigned char* extra, size_t extra_len) };
220 %apply(char *STRING, size_t LENGTH) { (const unsigned char* final_scriptsig, size_t final_scriptsig_len) };
221 %apply(char *STRING, size_t LENGTH) { (const unsigned char* fingerprint, size_t fingerprint_len) };
222 %apply(char *STRING, size_t LENGTH) { (const unsigned char* generator, size_t generator_len) };
223 %apply(char *STRING, size_t LENGTH) { (const unsigned char* genesis_blockhash, size_t genesis_blockhash_len) };
224 %apply(char *STRING, size_t LENGTH) { (const unsigned char* hash160, size_t hash160_len) };
225 %apply(char *STRING, size_t LENGTH) { (const unsigned char* inflation_keys, size_t inflation_keys_len) };
226 %apply(char *STRING, size_t LENGTH) { (const unsigned char* inflation_keys_rangeproof, size_t inflation_keys_rangeproof_len) };
227 %apply(char *STRING, size_t LENGTH) { (const unsigned char* issuance_amount, size_t issuance_amount_len) };
228 %apply(char *STRING, size_t LENGTH) { (const unsigned char* issuance_amount_rangeproof, size_t issuance_amount_rangeproof_len) };
229 %apply(char *STRING, size_t LENGTH) { (const unsigned char* iv, size_t iv_len) };
230 %apply(char *STRING, size_t LENGTH) { (const unsigned char* key, size_t key_len) };
231 %apply(char *STRING, size_t LENGTH) { (const unsigned char* label, size_t label_len) };
232 %apply(char *STRING, size_t LENGTH) { (const unsigned char* mainchain_script, size_t mainchain_script_len) };
233 %apply(char *STRING, size_t LENGTH) { (const unsigned char* nonce, size_t nonce_len) };
234 %apply(char *STRING, size_t LENGTH) { (const unsigned char* nonce_hash, size_t nonce_hash_len) };
235 %apply(char *STRING, size_t LENGTH) { (const unsigned char* offline_keys, size_t offline_keys_len) };
236 %apply(char *STRING, size_t LENGTH) { (const unsigned char* online_keys, size_t online_keys_len) };
237 %apply(char *STRING, size_t LENGTH) { (const unsigned char* online_priv_key, size_t online_priv_key_len) };
238 %apply(char *STRING, size_t LENGTH) { (const unsigned char* output_abf, size_t output_abf_len) };
239 %apply(char *STRING, size_t LENGTH) { (const unsigned char* output_asset, size_t output_asset_len) };
240 %apply(char *STRING, size_t LENGTH) { (const unsigned char* output_generator, size_t output_generator_len) };
241 %apply(char *STRING, size_t LENGTH) { (const unsigned char* parent160, size_t parent160_len) };
242 %apply(char *STRING, size_t LENGTH) { (const unsigned char* pass, size_t pass_len) };
243 %apply(char *STRING, size_t LENGTH) { (const unsigned char* priv_key, size_t priv_key_len) };
244 %apply(char *STRING, size_t LENGTH) { (const unsigned char* proof, size_t proof_len) };
245 %apply(char *STRING, size_t LENGTH) { (const unsigned char* pub_key, size_t pub_key_len) };
246 %apply(char *STRING, size_t LENGTH) { (const unsigned char* rangeproof, size_t rangeproof_len) };
247 %apply(char *STRING, size_t LENGTH) { (const unsigned char* redeem_script, size_t redeem_script_len) };
248 %apply(char *STRING, size_t LENGTH) { (const unsigned char* s2c_data, size_t s2c_data_len) };
249 %apply(char *STRING, size_t LENGTH) { (const unsigned char* s2c_opening, size_t s2c_opening_len) };
250 %apply(char *STRING, size_t LENGTH) { (const unsigned char* salt, size_t salt_len) };
251 %apply(char *STRING, size_t LENGTH) { (const unsigned char* script, size_t script_len) };
252 %apply(char *STRING, size_t LENGTH) { (const unsigned char* scriptpubkey, size_t scriptpubkey_len) };
253 %apply(char *STRING, size_t LENGTH) { (const unsigned char* sig, size_t sig_len) };
254 %apply(char *STRING, size_t LENGTH) { (const unsigned char* sub_pubkey, size_t sub_pubkey_len) };
255 %apply(char *STRING, size_t LENGTH) { (const unsigned char* summed_key, size_t summed_key_len) };
256 %apply(char *STRING, size_t LENGTH) { (const unsigned char* surjectionproof, size_t surjectionproof_len) };
257 %apply(char *STRING, size_t LENGTH) { (const unsigned char* txhash, size_t txhash_len) };
258 %apply(char *STRING, size_t LENGTH) { (const unsigned char* value, size_t value_len) };
259 %apply(char *STRING, size_t LENGTH) { (const unsigned char* vbf, size_t vbf_len) };
260 %apply(char *STRING, size_t LENGTH) { (const unsigned char* whitelistproof, size_t whitelistproof_len) };
261 %apply(char *STRING, size_t LENGTH) { (const unsigned char* witness, size_t witness_len) };
262 %apply(char *STRING, size_t LENGTH) { (unsigned char* abf_out, size_t abf_out_len) };
263 %apply(char *STRING, size_t LENGTH) { (unsigned char* asset_out, size_t asset_out_len) };
264 %apply(char *STRING, size_t LENGTH) { (unsigned char* bytes_out, size_t len) };
265 %apply(char *STRING, size_t LENGTH) { (unsigned char* s2c_opening_out, size_t s2c_opening_out_len) };
266 %apply(char *STRING, size_t LENGTH) { (unsigned char* vbf_out, size_t vbf_out_len) };
267 /* END AUTOGENERATED */
268 
269 %apply(uint32_t *STRING, size_t LENGTH) { (const uint32_t *child_path, size_t child_path_len) }
270 %apply(uint32_t *STRING, size_t LENGTH) { (const uint32_t *sighash, size_t sighash_len) }
271 %apply(uint64_t *STRING, size_t LENGTH) { (const uint64_t *values, size_t values_len) }
272 
273 %typemap(in, numinputs=0) uint32_t *value_out (uint32_t val) {
274    val = 0; $1 = ($1_ltype)&val;
275 }
276 %typemap(argout) uint32_t* value_out{
277    $result = (jlong)*$1;
278 }
279 
280 %typemap(in, numinputs=0) uint64_t *value_out (uint64_t val) {
281    val = 0; $1 = ($1_ltype)&val;
282 }
283 %typemap(argout) uint64_t* value_out{
284    $result = (jlong)*$1;
285 }
286 
287 /* Opaque types are converted to/from an internal object holder class */
288 %define %java_opaque_struct(NAME, ID)
289 %typemap(in, numinputs=0) struct NAME **output (struct NAME * w) {
290     w = 0; $1 = ($1_ltype)&w;
291 }
292 %typemap(argout) struct NAME ** {
293     if (*$1)
294         $result = create_obj(jenv, *$1, ID);
295 }
296 %typemap (in) const struct NAME * {
297     if (strcmp("NAME", "wally_tx_witness_stack") == 0)
298         $1 = (struct NAME *)get_obj(jenv, $input, ID);
299     else {
300         $1 = (struct NAME *)get_obj_or_throw(jenv, $input, ID, "NAME");
301         if (!$1)
302           return $null;
303     }
304 }
305 %typemap(jtype) const struct NAME * "Object"
306 %typemap(jni) const struct NAME * "jobject"
307 %typemap (in) struct NAME * {
308     $1 = (struct NAME *)get_obj_or_throw(jenv, $input, ID, "NAME");
309     if (!$1)
310         return $null;
311 }
312 %typemap(jtype) struct NAME * "Object"
313 %typemap(jni) struct NAME * "jobject"
314 
315 %enddef
316 
317 /* Change a functions return type to match its output type mapping */
318 %define %return_decls(FUNC, JTYPE, JNITYPE)
319 %typemap(jstype) int FUNC "JTYPE"
320 %typemap(jtype) int FUNC "JTYPE"
321 %typemap(jni) int FUNC "JNITYPE"
322 %rename("%(strip:[wally_])s") FUNC;
323 %enddef
324 
325 %define %returns_void__(FUNC)
326 %return_decls(FUNC, void, void)
327 %enddef
328 %define %returns_size_t(FUNC)
329 %return_decls(FUNC, int, jint)
330 %enddef
331 %define %returns_uint64(FUNC)
332 %return_decls(FUNC, long, jlong)
333 %enddef
334 %define %returns_string(FUNC)
335 %return_decls(FUNC, String, jstring)
336 %enddef
337 %define %returns_struct(FUNC, STRUCT)
338 %return_decls(FUNC, Object, jobject)
339 %enddef
340 %define %returns_array_(FUNC, ARRAYARG, LENARG, LEN)
341 %return_decls(FUNC, byte[], jbyteArray)
342 %exception FUNC {
343     int skip = 0;
344     jresult = NULL;
345     if (!jarg ## ARRAYARG) {
346         arg ## LENARG = LEN;
347         arg ## ARRAYARG = malloc_or_throw(jenv, LEN);
348         if (!arg ## ARRAYARG)
349             skip = 1; /* Exception set by malloc_or_throw */
350     }
351     if (!skip && !(*jenv)->ExceptionOccurred(jenv)) {
352         $action
353         if (check_result(jenv, result) == WALLY_OK && !jarg ## ARRAYARG)
354            jresult = create_array(jenv, arg ## ARRAYARG, LEN);
355     }
356     if (!jarg ## ARRAYARG)
357         clear_and_free(arg ## ARRAYARG, LEN);
358 }
359 %enddef
360 %define %returns_array_check_flag(FUNC, ARRAYARG, LENARG, FLAGSARG, FLAG, LEN_SET, LEN_UNSET)
361 %returns_array_(FUNC, ARRAYARG, LENARG, (FLAGSARG & FLAG) ? LEN_SET : LEN_UNSET)
362 %enddef
363 
364 /* Our wrapped opaque types */
365 %java_opaque_struct(words, 1)
366 %java_opaque_struct(ext_key, 2)
367 %java_opaque_struct(wally_tx_witness_stack, 3);
368 %java_opaque_struct(wally_tx_input, 4);
369 %java_opaque_struct(wally_tx_output, 5);
370 %java_opaque_struct(wally_tx, 6);
371 %java_opaque_struct(wally_map, 7);
372 %java_opaque_struct(wally_psbt, 8);
373 
374 /* Our wrapped functions return types */
375 %returns_void__(bip32_key_free);
376 %returns_struct(bip32_key_from_base58_alloc, ext_key);
377 %rename("bip32_key_from_base58") bip32_key_from_base58_alloc;
378 %returns_struct(bip32_key_from_parent_alloc, ext_key);
379 %rename("bip32_key_from_parent") bip32_key_from_parent_alloc;
380 %returns_struct(bip32_key_from_parent_path_alloc, ext_key);
381 %rename("bip32_key_from_parent_path") bip32_key_from_parent_path_alloc;
382 %returns_struct(bip32_key_from_seed_alloc, ext_key);
383 %rename("bip32_key_from_seed") bip32_key_from_seed_alloc;
384 %returns_array_(bip32_key_get_chain_code, 2, 3, member_size(ext_key, chain_code));
385 %returns_size_t(bip32_key_get_child_num);
386 %returns_size_t(bip32_key_get_depth);
387 %returns_array_(bip32_key_get_fingerprint, 2, 3, BIP32_KEY_FINGERPRINT_LEN);
388 %returns_array_(bip32_key_get_hash160, 2, 3, member_size(ext_key, hash160));
389 %returns_array_(bip32_key_get_parent160, 2, 3, member_size(ext_key, parent160));
390 %returns_array_(bip32_key_get_priv_key, 2, 3, member_size(ext_key, priv_key) - 1);
391 %returns_array_(bip32_key_get_pub_key, 2, 3, member_size(ext_key, pub_key));
392 %returns_array_(bip32_key_get_pub_key_tweak_sum, 2, 3, member_size(ext_key, pub_key_tweak_sum));
393 %returns_size_t(bip32_key_get_version);
394 %returns_struct(bip32_key_init_alloc, ext_key);
395 %rename("bip32_key_init") bip32_key_init_alloc;
396 %returns_array_(bip32_key_serialize, 3, 4, BIP32_SERIALIZED_LEN);
397 %returns_void__(bip32_key_strip_private_key);
398 %returns_string(bip32_key_to_base58);
399 %returns_struct(bip32_key_unserialize_alloc, ext_key);
400 %rename("bip32_key_unserialize") bip32_key_unserialize_alloc;
401 %returns_struct(bip32_key_with_tweak_from_parent_path_alloc, ext_key);
402 %rename("bip32_key_with_tweak_from_parent_path") bip32_key_with_tweak_from_parent_path_alloc;
403 %returns_array_(bip38_raw_from_private_key, 6, 7, BIP38_SERIALIZED_LEN);
404 %returns_string(bip38_from_private_key);
405 %returns_array_(bip38_raw_to_private_key, 6, 7, 32);
406 %returns_array_(bip38_to_private_key, 5, 6, 32);
407 %returns_size_t(bip38_raw_get_flags);
408 %returns_size_t(bip38_get_flags);
409 %returns_string(bip39_get_languages);
410 %returns_struct(bip39_get_wordlist, words);
411 %returns_string(bip39_get_word);
412 %returns_string(bip39_mnemonic_from_bytes);
413 %returns_size_t(bip39_mnemonic_to_bytes);
414 %returns_void__(bip39_mnemonic_validate);
415 %returns_size_t(bip39_mnemonic_to_seed);
416 %returns_string(wally_addr_segwit_from_bytes);
417 %returns_size_t(wally_addr_segwit_to_bytes);
418 %returns_size_t(wally_address_to_scriptpubkey);
419 %returns_array_(wally_aes, 6, 7, AES_BLOCK_LEN);
420 %returns_size_t(wally_aes_cbc);
421 %returns_array_(wally_asset_final_vbf, 8, 9, ASSET_TAG_LEN);
422 %returns_array_(wally_asset_generator_from_bytes, 5, 6, ASSET_GENERATOR_LEN);
423 %returns_size_t(wally_asset_rangeproof_with_nonce);
424 %returns_size_t(wally_asset_rangeproof);
425 %returns_size_t(wally_asset_surjectionproof_size);
426 %returns_size_t(wally_asset_surjectionproof);
427 %returns_uint64(wally_asset_unblind_with_nonce);
428 %returns_uint64(wally_asset_unblind);
429 %returns_array_(wally_asset_blinding_key_from_seed, 3, 4, HMAC_SHA512_LEN);
430 %returns_array_(wally_asset_blinding_key_to_ec_private_key, 5, 6, EC_PRIVATE_KEY_LEN);
431 %returns_array_(wally_asset_value_commitment, 6, 7, ASSET_COMMITMENT_LEN);
432 %returns_string(wally_base58_from_bytes);
433 %returns_size_t(wally_base58_to_bytes);
434 %returns_size_t(wally_base58_get_length);
435 %returns_string(wally_base64_from_bytes);
436 %returns_size_t(wally_base64_to_bytes);
437 %returns_size_t(wally_base64_get_maximum_length);
438 %returns_string(wally_bip32_key_to_address);
439 %returns_string(wally_bip32_key_to_addr_segwit);
440 %returns_string(wally_confidential_addr_to_addr);
441 %returns_array_(wally_confidential_addr_to_ec_public_key, 3, 4, EC_PUBLIC_KEY_LEN);
442 %returns_string(wally_confidential_addr_from_addr);
443 %returns_string(wally_confidential_addr_to_addr_segwit);
444 %returns_array_(wally_confidential_addr_segwit_to_ec_public_key, 3, 4, EC_PUBLIC_KEY_LEN);
445 %returns_string(wally_confidential_addr_from_addr_segwit);
446 %returns_void__(wally_ec_private_key_verify);
447 %returns_void__(wally_ec_public_key_verify);
448 %returns_array_(wally_ec_public_key_decompress, 3, 4, EC_PUBLIC_KEY_UNCOMPRESSED_LEN);
449 %returns_array_(wally_ec_public_key_negate, 3, 4, EC_PUBLIC_KEY_LEN);
450 %returns_array_(wally_ec_public_key_from_private_key, 3, 4, EC_PUBLIC_KEY_LEN);
451 %returns_array_check_flag(wally_ec_sig_from_bytes, 6, 7, jarg5, 8, EC_SIGNATURE_RECOVERABLE_LEN, EC_SIGNATURE_LEN);
452 %returns_array_(wally_ec_sig_normalize, 3, 4, EC_SIGNATURE_LEN);
453 %returns_array_(wally_ec_sig_from_der, 3, 4, EC_SIGNATURE_LEN);
454 %returns_size_t(wally_ec_sig_to_der);
455 %returns_array_(wally_ec_sig_to_public_key, 5, 6, EC_PUBLIC_KEY_LEN);
456 %returns_void__(wally_ec_sig_verify);
457 %returns_array_(wally_ecdh, 5, 6, SHA256_LEN);
458 %returns_size_t(wally_format_bitcoin_message);
459 %returns_array_(wally_hash160, 3, 4, HASH160_LEN);
460 %returns_string(wally_hex_from_bytes);
461 %returns_size_t(wally_hex_to_bytes);
462 %returns_array_(wally_hmac_sha256, 5, 6, HMAC_SHA256_LEN);
463 %returns_array_(wally_hmac_sha512, 5, 6, HMAC_SHA512_LEN);
464 %returns_void__(wally_init);
465 %rename("_is_elements_build") wally_is_elements_build;
466 %returns_size_t(_is_elements_build);
467 %returns_void__(wally_map_add);
468 %returns_void__(wally_map_add_keypath_item);
469 %returns_size_t(wally_map_find);
470 %returns_void__(wally_map_free)
471 %returns_struct(wally_map_init_alloc, wally_map);
472 %rename("map_init") wally_map_init_alloc;
473 %returns_void__(wally_map_sort);
474 %returns_array_(wally_pbkdf2_hmac_sha256, 7, 8, PBKDF2_HMAC_SHA256_LEN);
475 %returns_array_(wally_pbkdf2_hmac_sha512, 7, 8, PBKDF2_HMAC_SHA512_LEN);
476 %returns_void__(wally_psbt_add_input_at);
477 %returns_void__(wally_psbt_add_output_at);
478 %returns_void__(wally_psbt_clear_input_value);
479 %returns_struct(wally_psbt_clone_alloc, wally_psbt);
480 %rename("psbt_clone") wally_psbt_clone_alloc;
481 %returns_void__(wally_psbt_combine);
482 %returns_struct(wally_psbt_elements_init_alloc, wally_psbt);
483 %rename("psbt_elements_init") wally_psbt_elements_init_alloc;
484 %returns_struct(wally_psbt_extract, wally_tx);
485 %returns_void__(wally_psbt_finalize);
486 %returns_size_t(wally_psbt_find_input_keypath);
487 %returns_size_t(wally_psbt_find_input_signature);
488 %returns_size_t(wally_psbt_find_input_unknown);
489 %returns_size_t(wally_psbt_find_output_keypath);
490 %returns_size_t(wally_psbt_find_output_unknown);
491 %returns_void__(wally_psbt_free)
492 %returns_struct(wally_psbt_from_base64, wally_psbt);
493 %returns_struct(wally_psbt_from_bytes, wally_psbt);
494 %returns_struct(wally_psbt_get_global_tx_alloc, wally_tx);
495 %rename("psbt_get_global_tx") wally_psbt_get_global_tx_alloc;
496 %returns_size_t(wally_psbt_get_input_abf);
497 %returns_size_t(wally_psbt_get_input_abf_len);
498 %returns_size_t(wally_psbt_get_input_asset);
499 %returns_size_t(wally_psbt_get_input_asset_len);
500 %returns_size_t(wally_psbt_get_input_redeem_script);
501 %returns_size_t(wally_psbt_get_input_redeem_script_len);
502 %returns_size_t(wally_psbt_get_input_claim_script);
503 %returns_size_t(wally_psbt_get_input_claim_script_len);
504 %returns_size_t(wally_psbt_get_input_final_scriptsig);
505 %returns_size_t(wally_psbt_get_input_final_scriptsig_len);
506 %returns_struct(wally_psbt_get_input_final_witness_alloc, wally_tx_witness_stack);
507 %rename("psbt_get_input_final_witness") wally_psbt_get_input_final_witness_alloc;
508 %returns_size_t(wally_psbt_get_input_genesis_blockhash);
509 %returns_size_t(wally_psbt_get_input_genesis_blockhash_len);
510 %returns_size_t(wally_psbt_get_input_keypaths_size);
511 %returns_size_t(wally_psbt_get_input_keypath);
512 %returns_size_t(wally_psbt_get_input_keypath_len);
513 %returns_struct(wally_psbt_get_input_pegin_tx_alloc, wally_tx);
514 %returns_size_t(wally_psbt_get_input_signatures_size);
515 %returns_size_t(wally_psbt_get_input_signature);
516 %returns_size_t(wally_psbt_get_input_signature_len);
517 %returns_size_t(wally_psbt_get_input_sighash);
518 %rename("psbt_get_input_pegin_tx") wally_psbt_get_input_pegin_tx_alloc;
519 %returns_size_t(wally_psbt_get_input_txoutproof);
520 %returns_size_t(wally_psbt_get_input_txoutproof_len);
521 %returns_size_t(wally_psbt_get_input_unknown);
522 %returns_size_t(wally_psbt_get_input_unknown_len);
523 %returns_size_t(wally_psbt_get_input_unknowns_size);
524 %returns_struct(wally_psbt_get_input_utxo_alloc, wally_tx);
525 %rename("psbt_get_input_utxo") wally_psbt_get_input_utxo_alloc;
526 %returns_uint64(wally_psbt_get_input_value);
527 %returns_size_t(wally_psbt_get_input_vbf);
528 %returns_size_t(wally_psbt_get_input_vbf_len);
529 %returns_size_t(wally_psbt_get_input_witness_script);
530 %returns_size_t(wally_psbt_get_input_witness_script_len);
531 %returns_struct(wally_psbt_get_input_witness_utxo_alloc, wally_tx_output);
532 %rename("psbt_get_input_witness_utxo") wally_psbt_get_input_witness_utxo_alloc;
533 %returns_size_t(wally_psbt_get_length);
534 %returns_size_t(wally_psbt_get_num_inputs);
535 %returns_size_t(wally_psbt_get_num_outputs);
536 %returns_size_t(wally_psbt_get_output_abf);
537 %returns_size_t(wally_psbt_get_output_abf_len);
538 %returns_size_t(wally_psbt_get_output_asset_commitment);
539 %returns_size_t(wally_psbt_get_output_asset_commitment_len);
540 %returns_size_t(wally_psbt_get_output_blinding_pubkey);
541 %returns_size_t(wally_psbt_get_output_blinding_pubkey_len);
542 %returns_size_t(wally_psbt_get_output_keypaths_size);
543 %returns_size_t(wally_psbt_get_output_keypath);
544 %returns_size_t(wally_psbt_get_output_keypath_len);
545 %returns_size_t(wally_psbt_get_output_nonce);
546 %returns_size_t(wally_psbt_get_output_nonce_len);
547 %returns_size_t(wally_psbt_get_output_rangeproof);
548 %returns_size_t(wally_psbt_get_output_rangeproof_len);
549 %returns_size_t(wally_psbt_get_output_redeem_script);
550 %returns_size_t(wally_psbt_get_output_redeem_script_len);
551 %returns_size_t(wally_psbt_get_output_surjectionproof);
552 %returns_size_t(wally_psbt_get_output_surjectionproof_len);
553 %returns_size_t(wally_psbt_get_output_unknown);
554 %returns_size_t(wally_psbt_get_output_unknown_len);
555 %returns_size_t(wally_psbt_get_output_unknowns_size);
556 %returns_size_t(wally_psbt_get_output_value_commitment);
557 %returns_size_t(wally_psbt_get_output_value_commitment_len);
558 %returns_size_t(wally_psbt_get_output_vbf);
559 %returns_size_t(wally_psbt_get_output_vbf_len);
560 %returns_size_t(wally_psbt_get_output_witness_script);
561 %returns_size_t(wally_psbt_get_output_witness_script_len);
562 %returns_size_t(wally_psbt_get_version);
563 %returns_size_t(wally_psbt_has_input_value);
564 %returns_struct(wally_psbt_init_alloc, wally_psbt);
565 %rename("psbt_init") wally_psbt_init_alloc;
566 %returns_size_t(wally_psbt_is_elements);
567 %returns_size_t(wally_psbt_is_finalized);
568 %returns_void__(wally_psbt_remove_input);
569 %returns_void__(wally_psbt_remove_output);
570 %returns_void__(wally_psbt_set_global_tx);
571 %returns_void__(wally_psbt_set_input_abf);
572 %returns_void__(wally_psbt_set_input_asset);
573 %returns_void__(wally_psbt_set_input_claim_script);
574 %returns_void__(wally_psbt_set_input_final_scriptsig);
575 %returns_void__(wally_psbt_set_input_final_witness);
576 %returns_void__(wally_psbt_set_input_genesis_blockhash);
577 %returns_void__(wally_psbt_set_input_keypaths);
578 %returns_void__(wally_psbt_set_input_pegin_tx);
579 %returns_void__(wally_psbt_set_input_redeem_script);
580 %returns_void__(wally_psbt_set_input_sighash);
581 %returns_void__(wally_psbt_set_input_signatures);
582 %returns_void__(wally_psbt_set_input_txoutproof);
583 %returns_void__(wally_psbt_set_input_unknowns);
584 %returns_void__(wally_psbt_set_input_utxo);
585 %returns_void__(wally_psbt_set_input_value);
586 %returns_void__(wally_psbt_set_input_vbf);
587 %returns_void__(wally_psbt_set_input_witness_script);
588 %returns_void__(wally_psbt_set_input_witness_utxo);
589 %returns_void__(wally_psbt_set_output_abf);
590 %returns_void__(wally_psbt_set_output_asset_commitment);
591 %returns_void__(wally_psbt_set_output_blinding_pubkey);
592 %returns_void__(wally_psbt_set_output_keypaths);
593 %returns_void__(wally_psbt_set_output_nonce);
594 %returns_void__(wally_psbt_set_output_rangeproof);
595 %returns_void__(wally_psbt_set_output_redeem_script);
596 %returns_void__(wally_psbt_set_output_surjectionproof);
597 %returns_void__(wally_psbt_set_output_unknowns);
598 %returns_void__(wally_psbt_set_output_value_commitment);
599 %returns_void__(wally_psbt_set_output_vbf);
600 %returns_void__(wally_psbt_set_output_witness_script);
601 %returns_void__(wally_psbt_sign);
602 %returns_string(wally_psbt_to_base64);
603 %returns_size_t(wally_psbt_to_bytes);
604 %returns_size_t(wally_script_push_from_bytes);
605 %returns_size_t(wally_scriptpubkey_csv_2of2_then_1_from_bytes);
606 %returns_size_t(wally_scriptpubkey_csv_2of2_then_1_from_bytes_opt);
607 %returns_size_t(wally_scriptpubkey_csv_2of3_then_2_from_bytes);
608 %returns_size_t(wally_scriptpubkey_get_type);
609 %returns_size_t(wally_scriptpubkey_op_return_from_bytes);
610 %returns_size_t(wally_scriptpubkey_p2pkh_from_bytes);
611 %returns_size_t(wally_scriptpubkey_p2sh_from_bytes);
612 %returns_size_t(wally_scriptpubkey_multisig_from_bytes);
613 %returns_size_t(wally_scriptsig_p2pkh_from_sig);
614 %returns_size_t(wally_scriptsig_p2pkh_from_der);
615 %returns_size_t(wally_scriptsig_multisig_from_bytes);
616 %returns_struct(wally_witness_p2wpkh_from_sig, wally_tx_witness_stack);
617 %returns_struct(wally_witness_p2wpkh_from_der, wally_tx_witness_stack);
618 %returns_struct(wally_witness_multisig_from_bytes, wally_tx_witness_stack);
619 %returns_size_t(wally_elements_pegout_script_size);
620 %returns_size_t(wally_elements_pegout_script_from_bytes);
621 %returns_size_t(wally_elements_pegin_contract_script_from_bytes);
622 %returns_void__(wally_scrypt);
623 %returns_void__(wally_secp_randomize);
624 %returns_array_(wally_sha256, 3, 4, SHA256_LEN);
625 %returns_array_(wally_sha256d, 3, 4, SHA256_LEN);
626 %returns_array_(wally_sha256_midstate, 3, 4, SHA256_LEN);
627 %returns_array_(wally_sha512, 3, 4, SHA512_LEN);
628 %returns_void__(wally_tx_add_elements_raw_input);
629 %returns_void__(wally_tx_add_elements_raw_input_at);
630 %returns_void__(wally_tx_add_elements_raw_output);
631 %returns_void__(wally_tx_add_elements_raw_output_at);
632 %returns_void__(wally_tx_add_input);
633 %returns_void__(wally_tx_add_input_at);
634 %returns_void__(wally_tx_add_raw_input);
635 %returns_void__(wally_tx_add_raw_input_at);
636 %returns_void__(wally_tx_add_output);
637 %returns_void__(wally_tx_add_output_at);
638 %returns_void__(wally_tx_add_raw_output);
639 %returns_void__(wally_tx_add_raw_output_at);
640 %returns_array_(wally_tx_confidential_value_from_satoshi, 2, 3, WALLY_TX_ASSET_CT_VALUE_UNBLIND_LEN);
641 %returns_uint64(wally_tx_confidential_value_to_satoshi);
642 %returns_struct(wally_tx_elements_input_init_alloc, wally_tx_input);
643 %rename("tx_elements_input_init") wally_tx_elements_input_init_alloc;
644 %rename("_tx_elements_input_is_pegin") wally_tx_elements_input_is_pegin;
645 %returns_size_t(_tx_elements_input_is_pegin);
646 %returns_void__(wally_tx_elements_input_issuance_set);
647 %returns_void__(wally_tx_elements_input_issuance_free);
648 %returns_array_(wally_tx_elements_issuance_calculate_asset, 3, 4, SHA256_LEN);
649 %returns_array_(wally_tx_elements_issuance_calculate_reissuance_token, 4, 5, SHA256_LEN);
650 %returns_array_(wally_tx_elements_issuance_generate_entropy, 6, 7, SHA256_LEN);
651 %returns_struct(wally_tx_elements_output_init_alloc, wally_tx_output);
652 %rename("tx_elements_output_init") wally_tx_elements_output_init_alloc;
653 %returns_void__(wally_tx_free);
654 %returns_struct(wally_tx_from_bytes, wally_tx);
655 %returns_struct(wally_tx_from_hex, wally_tx);
656 %returns_array_(wally_tx_get_btc_signature_hash, 8, 9, SHA256_LEN);
657 %returns_array_(wally_tx_get_elements_signature_hash, 9, 10, SHA256_LEN);
658 %returns_array_(wally_tx_get_input_blinding_nonce, 3, 4, SHA256_LEN);
659 %returns_array_(wally_tx_get_input_entropy, 3, 4, SHA256_LEN);
660 %rename("_tx_get_input_issuance_amount") wally_tx_get_input_issuance_amount;
661 %returns_size_t(_tx_get_input_issuance_amount);
662 %returns_size_t(wally_tx_get_input_issuance_amount_len);
663 %rename("_tx_get_input_issuance_amount_rangeproof") wally_tx_get_input_issuance_amount_rangeproof;
664 %returns_size_t(_tx_get_input_issuance_amount_rangeproof);
665 %returns_size_t(wally_tx_get_input_issuance_amount_rangeproof_len);
666 %returns_size_t(wally_tx_get_input_index);
667 %rename("_tx_get_input_inflation_keys") wally_tx_get_input_inflation_keys;
668 %returns_size_t(_tx_get_input_inflation_keys);
669 %returns_size_t(wally_tx_get_input_inflation_keys_len);
670 %rename("_tx_get_input_inflation_keys_rangeproof") wally_tx_get_input_inflation_keys_rangeproof;
671 %returns_size_t(_tx_get_input_inflation_keys_rangeproof);
672 %returns_size_t(wally_tx_get_input_inflation_keys_rangeproof_len);
673 %rename("_tx_get_input_script") wally_tx_get_input_script;
674 %returns_size_t(_tx_get_input_script);
675 %returns_size_t(wally_tx_get_input_script_len);
676 %rename("_tx_get_input_sequence") wally_tx_get_input_sequence;
677 %returns_size_t(_tx_get_input_sequence);
678 %returns_array_(wally_tx_get_input_txhash, 3, 4, SHA256_LEN);
679 %rename("_tx_get_input_witness") wally_tx_get_input_witness;
680 %returns_size_t(_tx_get_input_witness);
681 %returns_size_t(wally_tx_get_input_witness_len);
682 %returns_size_t(wally_tx_get_length);
683 %returns_size_t(wally_tx_get_locktime);
684 %returns_size_t(wally_tx_get_num_inputs);
685 %returns_size_t(wally_tx_get_num_outputs);
686 %returns_array_(wally_tx_get_output_asset, 3, 4, WALLY_TX_ASSET_CT_ASSET_LEN);
687 %returns_array_(wally_tx_get_output_nonce, 3, 4, WALLY_TX_ASSET_CT_NONCE_LEN);
688 %rename("_tx_get_output_rangeproof") wally_tx_get_output_rangeproof;
689 %returns_size_t(_tx_get_output_rangeproof);
690 %returns_size_t(wally_tx_get_output_rangeproof_len);
691 %returns_uint64(wally_tx_get_output_satoshi);
692 %rename("_tx_get_output_script") wally_tx_get_output_script;
693 %returns_size_t(_tx_get_output_script);
694 %returns_size_t(wally_tx_get_output_script_len);
695 %rename("_tx_get_output_surjectionproof") wally_tx_get_output_surjectionproof;
696 %returns_size_t(_tx_get_output_surjectionproof);
697 %returns_size_t(wally_tx_get_output_surjectionproof_len);
698 %rename("_tx_get_output_value") wally_tx_get_output_value;
699 %returns_size_t(_tx_get_output_value);
700 %returns_size_t(wally_tx_get_output_value_len);
701 %returns_array_(wally_tx_get_signature_hash, 12, 13, SHA256_LEN);
702 %returns_uint64(wally_tx_get_total_output_satoshi);
703 %returns_array_(wally_tx_get_txid, 2, 3, WALLY_TXHASH_LEN);
704 %returns_size_t(wally_tx_get_version);
705 %returns_size_t(wally_tx_get_vsize);
706 %returns_size_t(wally_tx_get_weight);
707 %returns_size_t(wally_tx_get_witness_count);
708 %returns_struct(wally_tx_init_alloc, wally_tx);
709 %rename("tx_init") wally_tx_init_alloc;
710 %returns_struct(wally_tx_clone_alloc, wally_tx);
711 %rename("tx_clone") wally_tx_clone_alloc;
712 %returns_void__(wally_tx_input_free);
713 %returns_array_(wally_tx_input_get_blinding_nonce, 2, 3, SHA256_LEN);
714 %returns_array_(wally_tx_input_get_entropy, 2, 3, SHA256_LEN);
715 %rename("_tx_input_get_issuance_amount") wally_tx_input_get_issuance_amount;
716 %returns_size_t(_tx_input_get_issuance_amount);
717 %returns_size_t(wally_tx_input_get_issuance_amount_len);
718 %returns_size_t(wally_tx_input_get_index);
719 %rename("_tx_input_get_inflation_keys") wally_tx_input_get_inflation_keys;
720 %returns_size_t(_tx_input_get_inflation_keys);
721 %returns_size_t(wally_tx_input_get_inflation_keys_len);
722 %rename("_tx_input_get_issuance_amount_rangeproof") wally_tx_input_get_issuance_amount_rangeproof;
723 %returns_size_t(_tx_input_get_issuance_amount_rangeproof);
724 %returns_size_t(wally_tx_input_get_issuance_amount_rangeproof_len);
725 %rename("_tx_input_get_inflation_keys_rangeproof") wally_tx_input_get_inflation_keys_rangeproof;
726 %returns_size_t(_tx_input_get_inflation_keys_rangeproof);
727 %returns_size_t(wally_tx_input_get_inflation_keys_rangeproof_len);
728 %rename("_tx_input_get_script") wally_tx_input_get_script;
729 %returns_size_t(_tx_input_get_script);
730 %returns_size_t(wally_tx_input_get_script_len);
731 %rename("_tx_input_get_sequence") wally_tx_input_get_sequence;
732 %returns_size_t(_tx_input_get_sequence);
733 %returns_array_(wally_tx_input_get_txhash, 2, 3, WALLY_TXHASH_LEN);
734 %rename("_tx_input_get_witness") wally_tx_input_get_witness;
735 %returns_size_t(_tx_input_get_witness);
736 %returns_size_t(wally_tx_input_get_witness_len);
737 %returns_struct(wally_tx_input_init_alloc, wally_tx_input);
738 %rename("tx_input_init") wally_tx_input_init_alloc;
739 %returns_void__(wally_tx_input_set_index);
740 %returns_void__(wally_tx_input_set_sequence);
741 %returns_void__(wally_tx_input_set_script);
742 %returns_void__(wally_tx_input_set_txhash);
743 %returns_void__(wally_tx_input_set_witness);
744 %returns_void__(wally_tx_input_set_blinding_nonce);
745 %returns_void__(wally_tx_input_set_entropy);
746 %returns_void__(wally_tx_input_set_inflation_keys);
747 %returns_void__(wally_tx_input_set_inflation_keys_rangeproof);
748 %returns_void__(wally_tx_input_set_issuance_amount);
749 %returns_void__(wally_tx_input_set_issuance_amount_rangeproof);
750 %rename("_tx_is_coinbase") wally_tx_is_coinbase;
751 %returns_size_t(_tx_is_coinbase);
752 %rename("_tx_is_elements") wally_tx_is_elements;
753 %returns_size_t(_tx_is_elements);
754 %returns_void__(wally_tx_elements_output_commitment_set);
755 %returns_void__(wally_tx_elements_output_commitment_free);
756 %returns_void__(wally_tx_output_free);
757 %rename("_tx_output_get_asset") wally_tx_output_get_asset;
758 %returns_size_t(_tx_output_get_asset);
759 %returns_size_t(wally_tx_output_get_asset_len);
760 %rename("_tx_output_get_nonce") wally_tx_output_get_nonce;
761 %returns_size_t(_tx_output_get_nonce);
762 %returns_size_t(wally_tx_output_get_nonce_len);
763 %rename("_tx_output_get_rangeproof") wally_tx_output_get_rangeproof;
764 %returns_size_t(_tx_output_get_rangeproof);
765 %returns_size_t(wally_tx_output_get_rangeproof_len);
766 %returns_uint64(wally_tx_output_get_satoshi);
767 %rename("_tx_output_get_script") wally_tx_output_get_script;
768 %returns_size_t(_tx_output_get_script);
769 %returns_size_t(wally_tx_output_get_script_len);
770 %rename("_tx_output_get_surjectionproof") wally_tx_output_get_surjectionproof;
771 %returns_size_t(_tx_output_get_surjectionproof);
772 %returns_size_t(wally_tx_output_get_surjectionproof_len);
773 %rename("_tx_output_get_value") wally_tx_output_get_value;
774 %returns_size_t(_tx_output_get_value);
775 %returns_size_t(wally_tx_output_get_value_len);
776 %returns_struct(wally_tx_output_init_alloc, wally_tx_output);
777 %rename("tx_output_init") wally_tx_output_init_alloc;
778 %returns_struct(wally_tx_output_clone_alloc, wally_tx_output_clone);
779 %rename("tx_output_clone") wally_tx_output_clone_alloc;
780 %returns_void__(wally_tx_output_set_satoshi);
781 %returns_void__(wally_tx_output_set_script);
782 %returns_void__(wally_tx_output_set_asset);
783 %returns_void__(wally_tx_output_set_value);
784 %returns_void__(wally_tx_output_set_nonce);
785 %returns_void__(wally_tx_output_set_surjectionproof);
786 %returns_void__(wally_tx_output_set_rangeproof);
787 %returns_void__(wally_tx_remove_input);
788 %returns_void__(wally_tx_remove_output);
789 %returns_void__(wally_tx_set_input_index);
790 %returns_void__(wally_tx_set_input_sequence);
791 %returns_void__(wally_tx_set_input_script);
792 %returns_void__(wally_tx_set_input_txhash);
793 %returns_void__(wally_tx_set_input_witness);
794 %returns_void__(wally_tx_set_input_blinding_nonce);
795 %returns_void__(wally_tx_set_input_entropy);
796 %returns_void__(wally_tx_set_input_inflation_keys);
797 %returns_void__(wally_tx_set_input_inflation_keys_rangeproof);
798 %returns_void__(wally_tx_set_input_issuance_amount);
799 %returns_void__(wally_tx_set_input_issuance_amount_rangeproof);
800 %returns_void__(wally_tx_set_output_satoshi);
801 %returns_void__(wally_tx_set_output_script);
802 %returns_void__(wally_tx_set_output_value);
803 %returns_void__(wally_tx_set_output_asset);
804 %returns_void__(wally_tx_set_output_nonce);
805 %returns_void__(wally_tx_set_output_surjectionproof);
806 %returns_void__(wally_tx_set_output_rangeproof);
807 %returns_size_t(wally_tx_to_bytes);
808 %returns_string(wally_tx_to_hex);
809 %returns_size_t(wally_tx_vsize_from_weight);
810 %returns_void__(wally_tx_witness_stack_add);
811 %returns_void__(wally_tx_witness_stack_add_dummy);
812 %returns_void__(wally_tx_witness_stack_free);
813 %returns_struct(wally_tx_witness_stack_init_alloc, wally_tx_witness_stack);
814 %rename("tx_witness_stack_init") wally_tx_witness_stack_init_alloc;
815 %returns_struct(wally_tx_witness_stack_clone_alloc, wally_tx_witness_stack);
816 %rename("tx_witness_stack_clone") wally_tx_witness_stack_clone_alloc;
817 %returns_void__(wally_tx_witness_stack_set);
818 %returns_void__(wally_tx_witness_stack_set_dummy);
819 %returns_size_t(wally_varbuff_get_length);
820 %returns_size_t(wally_varbuff_to_bytes);
821 %returns_size_t(wally_varint_get_length);
822 %returns_size_t(wally_varint_to_bytes);
823 %returns_string(wally_wif_from_bytes);
824 %returns_size_t(wally_wif_to_bytes);
825 %rename("_wif_is_uncompressed") wally_wif_is_uncompressed;
826 %returns_size_t(_wif_is_uncompressed);
827 %returns_size_t(wally_wif_to_public_key);
828 %returns_string(wally_wif_to_address);
829 %returns_string(wally_scriptpubkey_to_address);
830 %returns_size_t(wally_witness_program_from_bytes);
831 %returns_array_(wally_symmetric_key_from_seed, 3, 4, HMAC_SHA512_LEN);
832 %returns_array_(wally_symmetric_key_from_parent, 6, 7, HMAC_SHA512_LEN);
833 %returns_size_t(wally_asset_pak_whitelistproof_size);
834 %returns_size_t(wally_asset_pak_whitelistproof);
835 %returns_array_(wally_s2c_sig_from_bytes, 10, 11, EC_SIGNATURE_LEN);
836 %returns_void__(wally_s2c_commitment_verify);
837 %returns_array_(wally_ae_host_commit_from_bytes, 4, 5, WALLY_HOST_COMMITMENT_LEN);
838 %returns_array_(wally_ae_signer_commit_from_bytes, 8, 9, WALLY_S2C_OPENING_LEN);
839 %returns_array_(wally_ae_sig_from_bytes, 8, 9, EC_SIGNATURE_LEN);
840 %returns_void__(wally_ae_verify);
841 
842 %rename("_cleanup") wally_cleanup;
843 %returns_void__(_cleanup)
844 
845 %include "../include/wally_core.h"
846 %include "../include/wally_address.h"
847 %include "../include/wally_anti_exfil.h"
848 %include "../include/wally_bip32.h"
849 %include "bip32_int.h"
850 %include "../include/wally_bip38.h"
851 %include "../include/wally_bip39.h"
852 %include "../include/wally_crypto.h"
853 %include "../include/wally_psbt.h"
854 %include "psbt_int.h"
855 %include "../include/wally_script.h"
856 %include "../include/wally_symmetric.h"
857 %include "../include/wally_transaction.h"
858 %include "transaction_int.h"
859 %include "../include/wally_elements.h"
860