minor whitespace, variable renames

This commit is contained in:
The MMGen Project 2025-06-04 14:15:43 +03:00
commit 5ea4884c65
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 16 additions and 10 deletions

View file

@ -163,7 +163,13 @@ class CoinAmt(Decimal, Hilite, InitErrors): # abstract class
def is_coin_amt(proto, num, *, from_unit=None, from_decimal=False):
assert proto.coin_amt, 'proto.coin_amt is None! Did you call init_proto() with ‘need_amt’?'
return get_obj(proto.coin_amt, num=num, from_unit=from_unit, from_decimal=from_decimal, silent=True, return_bool=True)
return get_obj(
proto.coin_amt,
num = num,
from_unit = from_unit,
from_decimal = from_decimal,
silent = True,
return_bool = True)
class BTCAmt(CoinAmt):
coin = 'BTC'

View file

@ -43,7 +43,7 @@ class mainnet(CoinProtocol.Secp256k1):
decode_wif = btc_mainnet.decode_wif
rpc_remote_params = {'server_domain': Hostname('ninerealms.com')}
rpc_remote_http_params = {'host': Hostname('thornode.ninerealms.com')}
rpc_remote_rest_params = {'host': Hostname('thornode.ninerealms.com')}
rpc_remote_rpc_params = {'host': Hostname('rpc.ninerealms.com')}
def decode_addr(self, addr):
@ -63,15 +63,15 @@ class mainnet(CoinProtocol.Secp256k1):
class testnet(mainnet): # testnet is stagenet
bech32_hrp = 'sthor'
rpc_remote_http_params = {'host': Hostname('stagenet-thornode.ninerealms.com')}
rpc_remote_rest_params = {'host': Hostname('stagenet-thornode.ninerealms.com')}
rpc_remote_rpc_params = {'host': Hostname('stagenet-rpc.ninerealms.com')}
class regtest(testnet): # regtest is deprecated testnet
bech32_hrp = 'tthor'
rpc_remote_params = {
'server_domain': Hostname('localhost')}
rpc_remote_http_params = {
rpc_remote_rest_params = {
'proto': 'http',
'host': Hostname('localhost:18800'),
'verify': False}
rpc_remote_rpc_params = rpc_remote_http_params
rpc_remote_rpc_params = rpc_remote_rest_params

View file

@ -17,13 +17,13 @@ import json
from ....http import HTTPClient
from ....rpc.remote import RemoteRPCClient
class ThornodeRemoteHTTPClient(HTTPClient):
class ThornodeRemoteRESTClient(HTTPClient):
http_hdrs = {'Content-Type': 'application/json'}
timeout = 5
def __init__(self, cfg, *, proto=None, host=None):
for k, v in cfg._proto.rpc_remote_http_params.items():
for k, v in cfg._proto.rpc_remote_rest_params.items():
setattr(self, k, v)
super().__init__(cfg, proto=proto, host=host)
@ -35,11 +35,11 @@ class THORChainRemoteRPCClient(RemoteRPCClient):
setattr(self, k, v)
super().__init__(cfg, proto)
self.caps = ('lbl_id',)
self.http = ThornodeRemoteHTTPClient(cfg)
self.rest_api = ThornodeRemoteRESTClient(cfg)
# throws exception on error
def get_balance(self, addr, *, block):
http_res = self.http.get(path=f'/bank/balances/{addr}')
http_res = self.rest_api.get(path=f'/bank/balances/{addr}')
data = json.loads(http_res)
if data['result'] is None:
from ....util import die

View file

@ -175,7 +175,7 @@ def Die(ev=0, s=''):
def pp_fmt(d):
import pprint
return pprint.PrettyPrinter(indent=4, compact=False).pformat(d)
return pprint.PrettyPrinter().pformat(d)
def pp_msg(d):
msg(pp_fmt(d))