|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import logging
|
|
|
|
|
import requests
|
|
|
|
|
from time import time
|
|
|
|
|
from tipbot.db import User
|
|
|
|
|
from tipbot.helpers.decorators import wallet_rpc_required, log_event, check_debug
|
|
|
|
|
from tipbot import wownero
|
|
|
|
@ -96,3 +97,19 @@ def price(update, context):
|
|
|
|
|
update.message.reply_text(f'{tgt}-{bse} is {sats:.8f} {tgt} on {mname} with {volbtc:.2f} {tgt} volume. Currently market cap rank #{mcap}.')
|
|
|
|
|
except:
|
|
|
|
|
update.message.reply_text('Something borked -_-')
|
|
|
|
|
|
|
|
|
|
@log_event
|
|
|
|
|
@check_debug
|
|
|
|
|
def lastblock(update, context):
|
|
|
|
|
try:
|
|
|
|
|
payload = {'jsonrpc':'2.0', 'id':'0', 'method':'get_last_block_header'}
|
|
|
|
|
headers = {'accept': 'application/json'}
|
|
|
|
|
r = requests.post(config.DAEMON_URI + '/json_rpc', json=payload, headers=headers, timeout=5)
|
|
|
|
|
r.raise_for_status()
|
|
|
|
|
j = r.json()
|
|
|
|
|
block = j['result']['block_header']
|
|
|
|
|
update.message.reply_text('Last block found {0:.2f} minutes ago with height {1} included {2} transactions'.format((
|
|
|
|
|
time() - float(block['timestamp']))/60, block['height'], block['num_txes']
|
|
|
|
|
))
|
|
|
|
|
except:
|
|
|
|
|
update.message.reply_text('Something borked -_-')
|
|
|
|
|