mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-29 19:08:12 +00:00
Add varying url to broadcast tx, depending on the api
This commit is contained in:
parent
28c9820b3d
commit
a8cd90c3ad
@ -552,7 +552,7 @@ def sign_tx(connect, coin):
|
|||||||
click.echo(binascii.hexlify(serialized_tx))
|
click.echo(binascii.hexlify(serialized_tx))
|
||||||
click.echo()
|
click.echo()
|
||||||
click.echo('Use the following form to broadcast it to the network:')
|
click.echo('Use the following form to broadcast it to the network:')
|
||||||
click.echo(txapi.url.replace('/api/', '/tx/send'))
|
click.echo(txapi.pushtx_url)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -31,6 +31,7 @@ class TxApi(object):
|
|||||||
def __init__(self, network, url):
|
def __init__(self, network, url):
|
||||||
self.network = network
|
self.network = network
|
||||||
self.url = url
|
self.url = url
|
||||||
|
self.pushtx_url = url
|
||||||
|
|
||||||
def get_url(self, resource, resourceid):
|
def get_url(self, resource, resourceid):
|
||||||
url = '%s%s/%s' % (self.url, resource, resourceid)
|
url = '%s%s/%s' % (self.url, resource, resourceid)
|
||||||
@ -68,6 +69,7 @@ class TxApiInsight(TxApi):
|
|||||||
def __init__(self, network, url, zcash=None):
|
def __init__(self, network, url, zcash=None):
|
||||||
super(TxApiInsight, self).__init__(network, url)
|
super(TxApiInsight, self).__init__(network, url)
|
||||||
self.zcash = zcash
|
self.zcash = zcash
|
||||||
|
self.pushtx_url = url.replace('/api/', '/tx/send')
|
||||||
|
|
||||||
def get_tx(self, txhash):
|
def get_tx(self, txhash):
|
||||||
|
|
||||||
@ -149,6 +151,10 @@ class TxApiSmartbit(TxApi):
|
|||||||
|
|
||||||
class TxApiBlockCypher(TxApi):
|
class TxApiBlockCypher(TxApi):
|
||||||
|
|
||||||
|
def __init__(self, network, url, zcash=None):
|
||||||
|
super(TxApiBlockCypher, self).__init__(network, url)
|
||||||
|
self.pushtx_url = url.replace('//api.', '//live.').replace('/v1/', '/').replace('/main/', '/pushtx/')
|
||||||
|
|
||||||
def get_tx(self, txhash):
|
def get_tx(self, txhash):
|
||||||
|
|
||||||
data = self.fetch_json('txs', txhash)
|
data = self.fetch_json('txs', txhash)
|
||||||
|
Loading…
Reference in New Issue
Block a user