@cmdcode/psbt2
v0.1.2
Published
A simple PSBT v2 library written in typescript.
Downloads
75
Readme
PSBT2
A very simple PSBT encoder / decoder written in typescript.
This project is under heavy development. More documentation coming soon!
API Interface
Here is a rough outline of the PSBT Tool API:
import PSBT2 from '@cmdcode/psbt2'
const PSBT2 = {
create : create_psbt,
encode : encode_psbt,
decode : decode_psbt,
finalize : finalize_psbt,
parse : parse_psbt,
upgrade : upgrade_psbt,
version : get_version,
extract : {
global : {
txdata : Extract.extract_txdata
},
input : {
prevout : Extract.extract_input_prevout,
sighash : Extract.extract_input_sighash,
sigflag : Extract.extract_input_sigflag,
witness : {
segwit : Extract.extract_input_segwit_data,
taproot : Extract.extract_input_taproot_data
}
}
},
record : {
global : {
collect : Record.collect_global_record,
find : Record.find_global_record,
get : Record.get_global_record,
has : Record.has_global_record,
remove : Record.remove_global_record,
update : Record.update_global_record
},
input : {
collect : Record.collect_input_record,
find : Record.find_input_record,
get : Record.get_input_record,
has : Record.has_input_record,
remove : Record.remove_input_record,
update : Record.update_input_record
},
output : {
collect : Record.collect_input_record,
find : Record.find_output_record,
get : Record.get_output_record,
has : Record.has_output_record,
remove : Record.remove_output_record,
update : Record.update_output_record
}
},
update : {
records : {
global : update_psbt_global,
input : update_psbt_input,
output : update_psbt_output
},
tx : {
data : update_txdata,
input : update_txin,
output : update_txout
}
}
}
Resources
Developer Resources for PSBT
https://bitcoincoredocs.com/psbt.html
Optech Resources for PSBT
https://bitcoinops.org/en/topics/psbt
BIP 174 Proposal for PSBTv1
https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
BIP 370 Proposal for PSBTv2
https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki