README
Tx utils
Utility helpers for working with transactions on bsv network (testnet or mainnet)
const priv = new bsv.PrivateKey('....', 'testnet')
const txutils = require('txutils')
const utils = new txutils(/* network 'main' or 'test' defaults to 'main' */)
// ---
const utxos = await utils.getUtxos(priv)
const tx = utils.buildFundsTx({ utxos, priv, address: 'dest', sats: 1000, feeb: 1 })
const res = await utils.dispatch(tx)
console.log(res)
dispatch (tx)
broadcasts transactiongetScriptPubKey (pubkey)
returns scriptPubKey from public keygetUtxos (priv)
returns utxos for a private keysplitUtxos (priv, maxUtxo, minSats)
splits utxos evenly between maxUtxo count and minSats per utxobuildFundsTx ({utxos, priv, address, sats, feeb})
builds standard pay transactionbuildMetanetTx ({ priv, parentTx, subprotocol, metadata, data })
build metanet transactionreserveUtxos (utxos, limit)
remove utxos from an array until they fill a certain ammount of fundsgetTxUtxos (tx)
returns tx outputs in utxo formatrecycleUtxos (tx, address, utxoArray)
extracts utxos from tx to address and inserts into utxoArrayminigun (priv, limit)
dispatch chained transactions from private keyshotgun (priv, rounds)
dispatch multi chained transactions for each utxo of priv