From a94ddb5f015e2e41fbff53d246c381ed1f0beb12 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 2 Oct 2026 10:02:27 +0000 Subject: [PATCH] function/method renames --- mmgen/help/help_notes.py | 2 +- mmgen/main_txcreate.py | 2 +- mmgen/main_txdo.py | 2 +- mmgen/proto/rune/rpc/remote.py | 6 +++--- mmgen/proto/rune/tw/ctl.py | 2 +- mmgen/proto/rune/tx/new.py | 2 +- mmgen/proto/rune/tx/online.py | 2 +- mmgen/proto/rune/tx/status.py | 2 +- test/cmdtest_d/httpd/thornode/rpc.py | 12 ++++++------ test/modtest_d/rune.py | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mmgen/help/help_notes.py b/mmgen/help/help_notes.py index e23bd4d4..d5668376 100755 --- a/mmgen/help/help_notes.py +++ b/mmgen/help/help_notes.py @@ -53,7 +53,7 @@ class help_notes: def swaptxcreate_args(self): return 'COIN1 [AMT CHG_ADDR] COIN2 [ADDR]' - def account_info_desc(self): + def acct_info_desc(self): return 'unspent outputs' if self.proto.base_proto == 'Bitcoin' else 'account info' def fee_spec_letters(self, *, use_quotes=False, proto=None): diff --git a/mmgen/main_txcreate.py b/mmgen/main_txcreate.py index 7db17f24..d400c9f1 100755 --- a/mmgen/main_txcreate.py +++ b/mmgen/main_txcreate.py @@ -105,7 +105,7 @@ opts_data = { 'options': lambda cfg, proto, help_notes, s: s.format( cfg = cfg, cu = proto.coin, - a_info = help_notes('account_info_desc'), + a_info = help_notes('acct_info_desc'), fu = help_notes('rel_fee_desc'), fl = help_notes('fee_spec_letters', use_quotes=True), tp = fmt_dict(tx_priorities, fmt='equal_compact'), diff --git a/mmgen/main_txdo.py b/mmgen/main_txdo.py index 03c43ce5..4e5c34b4 100755 --- a/mmgen/main_txdo.py +++ b/mmgen/main_txdo.py @@ -134,7 +134,7 @@ column below:{n_fc}{n_cx}""" cu = proto.coin, pnm = gc.proj_name, pnl = gc.proj_name.lower(), - a_info = help_notes('account_info_desc'), + a_info = help_notes('acct_info_desc'), kgs = help_notes('keygen_backends'), coin_id = help_notes('coin_id'), fu = help_notes('rel_fee_desc'), diff --git a/mmgen/proto/rune/rpc/remote.py b/mmgen/proto/rune/rpc/remote.py index 2b59f8d9..3d853291 100755 --- a/mmgen/proto/rune/rpc/remote.py +++ b/mmgen/proto/rune/rpc/remote.py @@ -59,7 +59,7 @@ class THORChainRemoteRPCClient(RemoteRPCClient): self.rest_api = ThornodeRemoteRESTClient(cfg, proto) self.rpc_api = ThornodeRemoteRPCClient(cfg, proto) - def get_balance(self, addr: str, *, block=None): + def balance(self, addr: str, *, block=None): "get balance for a given address, optionally at a given block height" res = process_response( self.rest_api.get(path=f'/bank/balances/{addr}'), @@ -68,13 +68,13 @@ class THORChainRemoteRPCClient(RemoteRPCClient): assert len(rune_res) == 1, f'{rune_res}: result length is not one!' return self.proto.coin_amt(int(rune_res[0]['amount']), from_unit='satoshi') - def get_account_info(self, addr: str, *, block=None): + def acct_info(self, addr: str, *, block=None): "get account information for a given address, optionally at a given block height" return process_response( self.rest_api.get(path=f'/auth/accounts/{addr}'), errmsg = f'address ‘{addr}’ not found in blockchain')['value'] - def get_tx_info(self, txid: str): + def tx_info(self, txid: str): "get transaction information for a given TxID" return process_response( self.rpc_api.post( diff --git a/mmgen/proto/rune/tw/ctl.py b/mmgen/proto/rune/tw/ctl.py index 9dc2ae04..5d0fde5b 100755 --- a/mmgen/proto/rune/tw/ctl.py +++ b/mmgen/proto/rune/tw/ctl.py @@ -22,7 +22,7 @@ class THORChainTwCtl(TwCtlWithStore): async def rpc_get_balance(self, addr, block='latest'): assert self.rpc.is_remote, 'tw.store.rpc_get_balance(): RPC is not remote!' try: - return self.rpc.get_balance(addr, block=block) + return self.rpc.balance(addr, block=block) except Exception as e: ymsg(f'{type(e).__name__}: {e}') ymsg(f'Unable to get balance for address ‘{addr}’') diff --git a/mmgen/proto/rune/tx/new.py b/mmgen/proto/rune/tx/new.py index 790f3ee4..0b978d71 100755 --- a/mmgen/proto/rune/tx/new.py +++ b/mmgen/proto/rune/tx/new.py @@ -40,7 +40,7 @@ class New(VmNew, Base, TxBase.New): ({'memo': self.swap_memo} if self.is_swap else {})) async def make_txobj(self): # called by create_serialized() - acct_info = self.rpc.get_account_info(self.inputs[0].addr) + acct_info = self.rpc.acct_info(self.inputs[0].addr) self.txobj = { 'from': self.inputs[0].addr, 'to': self.outputs[0].addr if self.outputs else None, diff --git a/mmgen/proto/rune/tx/online.py b/mmgen/proto/rune/tx/online.py index 619f29bc..00a43c75 100755 --- a/mmgen/proto/rune/tx/online.py +++ b/mmgen/proto/rune/tx/online.py @@ -43,7 +43,7 @@ class OnlineSigned(Signed, TxBase.OnlineSigned): async def get_receipt(self, txid, *, receipt_only=False): try: - return self.rpc.get_tx_info(txid) + return self.rpc.tx_info(txid) except Exception as e: msg(f'{type(e).__name__}: {e}') return False diff --git a/mmgen/proto/rune/tx/status.py b/mmgen/proto/rune/tx/status.py index b0e022ce..84d3e0ee 100755 --- a/mmgen/proto/rune/tx/status.py +++ b/mmgen/proto/rune/tx/status.py @@ -20,7 +20,7 @@ class Status(TxBase.Status): async def display(self, *, idx=''): try: - self.tx.rpc.get_tx_info(self.tx.coin_txid) + self.tx.rpc.tx_info(self.tx.coin_txid) except Exception as e: msg(f'{type(e).__name__}: {e}') return 2 diff --git a/test/cmdtest_d/httpd/thornode/rpc.py b/test/cmdtest_d/httpd/thornode/rpc.py index 8d822102..e7b2c1c3 100755 --- a/test/cmdtest_d/httpd/thornode/rpc.py +++ b/test/cmdtest_d/httpd/thornode/rpc.py @@ -27,13 +27,13 @@ class ThornodeRPCServer(ThornodeServer): # pylint: disable=unsubscriptable-object - def get_balance(m, length): + def balance(m, length): return [ {'denom': 'foocoin', 'amount': 321321321321}, {'denom': 'rune', 'amount': 987654321321}, {'denom': 'barcoin', 'amount': 123123123123}] - def get_account_info(m, length): + def acct_info(m, length): return { 'value': { 'address': m[1], @@ -41,7 +41,7 @@ class ThornodeRPCServer(ThornodeServer): 'account_number': '1234', 'sequence': '333444'}} - def get_tx_info(m, length): + def tx_info(m, length): txid = environ['wsgi.input'].read(length).decode().removeprefix('hash=0x').upper() return { 'hash': txid, @@ -75,9 +75,9 @@ class ThornodeRPCServer(ThornodeServer): return res pat_info = ( - ('get_balance', 'GET', r'/bank/balances/(\S+)'), - ('get_account_info', 'GET', r'/auth/accounts/(\S+)'), - ('get_tx_info', 'POST', r'/tx$'), + ('balance', 'GET', r'/bank/balances/(\S+)'), + ('acct_info', 'GET', r'/auth/accounts/(\S+)'), + ('tx_info', 'POST', r'/tx$'), ('check_tx', 'POST', r'/check_tx$'), ('broadcast_tx_sync', 'POST', r'/broadcast_tx_sync$')) diff --git a/test/modtest_d/rune.py b/test/modtest_d/rune.py index 5a69f233..81ead930 100755 --- a/test/modtest_d/rune.py +++ b/test/modtest_d/rune.py @@ -211,12 +211,12 @@ class unit_tests: rpc = await rpc_init(regtest_cfg) - res = rpc.get_account_info(addr) + res = rpc.acct_info(addr) assert res['address'] == addr assert res['account_number'] assert res['sequence'] - res = rpc.get_tx_info(txhash) + res = rpc.tx_info(txhash) assert res['hash'] == txhash.upper() res = rpc.tx_op(txbytes.hex(), op='check_tx')