def test_make_decred_tx(self): riemann.select_network('decred_main') helper_witness = helpers.DCR['ser']['witnesses'][0] outpoint = tb.make_outpoint( tx_id_le=helpers.DCR['ser']['ins'][0]['hash'], index=0, tree=0) tx_in, witness = tb.make_witness_input_and_witness( outpoint=outpoint, sequence=helpers.DCR['human']['ins'][0]['sequence'], value=helper_witness['value'], height=helper_witness['height'], index=helper_witness['index'], stack_script=helper_witness['stack_script'], redeem_script=helper_witness['redeem_script']) tx_out = tb._make_output( value=helpers.DCR['ser']['outs'][0]['value'], output_script=helpers.DCR['ser']['outs'][0]['pk_script'], version=helpers.DCR['ser']['outs'][0]['version']) self.assertEqual( tb.make_tx(version=1, tx_ins=[tx_in], tx_outs=[tx_out], lock_time=helpers.DCR['human']['locktime'], expiry=helpers.DCR['human']['expiry'], tx_witnesses=witness), helpers.DCR['ser']['tx']['p2sh_2_p2pkh'])
def output(value: int, address: str) -> tx.TxOut: ''' int, str -> TxOut accepts base58 or bech32 addresses ''' script = addr.to_output_script(address) value_bytes = utils.i2le_padded(value, 8) return tb._make_output(value_bytes, script)
def test_make_decred_output(self): riemann.select_network('decred_main') self.assertEqual( tb._make_output( value=helpers.DCR['ser']['outs'][0]['value'], output_script=helpers.DCR['ser']['outs'][0]['pk_script'], version=helpers.DCR['ser']['outs'][0]['version']), helpers.DCR['ser']['outs'][0]['output'])