nchain-innovation / chain-gang

This library provides a both a Rust (chain-gang) and Python (tx-engine) interface for building BitcoinSV scripts and transactions.
MIT License
0 stars 2 forks source link

Add function for pushing integers to the stack #21

Open mducroux opened 2 months ago

mducroux commented 2 months ago

Would it be possible to add a function push_int that takes any bignum integer as argument and push it to the stack? Or to confirm if there is an easy way to push any integer to the stack

arthurggordon commented 2 months ago

We currently have insert_num(). It is defined in python/src/tx_engine/util.py. Example usage can be found in python/src/tests/test_op

script = Script(insert_num(-1) + insert_num(1000) + [OP_ADD] + insert_num(999) + [OP_EQUAL])  
mducroux commented 2 months ago

Is there any way to use insert_num() to append an int to a script in the same way as we can call append_pushdata()?