Firaenix / bsv-wasm

BSV stdlib written in Rust and runs in WASM environments
MIT License
70 stars 19 forks source link

Js Txin Ergonomics #54

Open breavyn opened 2 years ago

breavyn commented 2 years ago

The TxIn constructor requires a script, however when a transaction input is first created, its script is typically not yet known. Therefore providing a script should be optional.


How I'm currently adding an input

const txin = TxIn.default();
txin.setPrevTxId(prevTxid);
txin.setVOut(prevVOut);
tx.addInput(txin);

How I'd like to add an input

const txin = new TxIn(prevTxid, prevVOut);
tx.addInput(txin);