Skip to content

Commit cc93c03

Browse files
Easy op return (#103)
1 parent b99b04d commit cc93c03

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

blockcypher/api.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,9 +1400,17 @@ def create_unsigned_tx(inputs, outputs, change_address=None,
14001400
# no address required for null-data outputs
14011401
if output.get('script_type') == 'null-data':
14021402
assert output['value'] == 0
1403-
assert 'script' in output, output
1404-
clean_output['script_type'] = 'null-data'
1405-
clean_output['script'] = output['script']
1403+
if 'script' in output:
1404+
clean_output['script_type'] = 'null-data'
1405+
clean_output['script'] = output['script']
1406+
elif 'data_hex' in output:
1407+
clean_output['script_type'] = 'null-data'
1408+
clean_output['data_hex'] = output['data_hex']
1409+
elif 'data_string' in output:
1410+
clean_output['script_type'] = 'null-data'
1411+
clean_output['data_string'] = output['data_string']
1412+
else:
1413+
raise Exception('Invalid OP_RETURN')
14061414
# but note that API requires the singleton list 'addresses' which is
14071415
# intentionally hidden away from the user here
14081416
else:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
setup(name='blockcypher',
1515
long_description=long_description,
1616
long_description_content_type='text/markdown',
17-
version='1.0.91',
17+
version='1.0.92',
1818
description='BlockCypher Python Library',
1919
author='Michael Flaxman',
2020
author_email='mflaxman+blockcypher@gmail.com',

0 commit comments

Comments
 (0)