MoneroWalletRPCClient: simplify instantiation
This commit is contained in:
parent
792fad1e43
commit
641c6bdf97
4 changed files with 17 additions and 24 deletions
13
mmgen/rpc.py
13
mmgen/rpc.py
|
|
@ -706,6 +706,19 @@ class MoneroRPCClientRaw(MoneroRPCClient):
|
|||
class MoneroWalletRPCClient(MoneroRPCClient):
|
||||
|
||||
auth_type = 'digest'
|
||||
|
||||
def __init__(self,daemon,test_connection=True):
|
||||
|
||||
RPCClient.__init__(
|
||||
self,
|
||||
daemon.host,
|
||||
daemon.rpc_port,
|
||||
test_connection = test_connection )
|
||||
|
||||
self.daemon = daemon
|
||||
self.auth = auth_data(daemon.user,daemon.passwd)
|
||||
self.set_backend('requests')
|
||||
|
||||
rpcmethods = (
|
||||
'get_version',
|
||||
'get_height', # sync height of the open wallet
|
||||
|
|
|
|||
|
|
@ -341,12 +341,7 @@ class MoneroWalletOps:
|
|||
if not uopt.no_start_wallet_daemon:
|
||||
self.wd.restart()
|
||||
|
||||
self.c = MoneroWalletRPCClient(
|
||||
host = self.wd.host,
|
||||
port = self.wd.rpc_port,
|
||||
user = self.wd.user,
|
||||
passwd = self.wd.passwd
|
||||
)
|
||||
self.c = MoneroWalletRPCClient(daemon=self.wd)
|
||||
|
||||
def create_addr_data(self):
|
||||
if uarg.wallets:
|
||||
|
|
@ -742,12 +737,7 @@ class MoneroWalletOps:
|
|||
|
||||
self.wd2.start()
|
||||
|
||||
self.c = MoneroWalletRPCClient(
|
||||
host = self.wd2.host,
|
||||
port = self.wd2.rpc_port,
|
||||
user = self.wd2.user,
|
||||
passwd = self.wd2.passwd
|
||||
)
|
||||
self.c = MoneroWalletRPCClient(daemon=self.wd2)
|
||||
|
||||
async def main(self):
|
||||
gmsg(f'\n{self.desc}ing account #{self.account} of wallet {self.source.idx}' + (
|
||||
|
|
|
|||
|
|
@ -236,13 +236,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
|
|||
datadir = os.path.join('test','daemons'),
|
||||
daemon_addr = f'127.0.0.1:{md.rpc_port}',
|
||||
)
|
||||
wd_rpc = MoneroWalletRPCClient(
|
||||
host = wd.host,
|
||||
port = wd.rpc_port,
|
||||
user = wd.user,
|
||||
passwd = wd.passwd,
|
||||
test_connection = False,
|
||||
)
|
||||
wd_rpc = MoneroWalletRPCClient( daemon=wd, test_connection=False )
|
||||
self.users[user] = ud(
|
||||
sid = sid,
|
||||
mmwords = f'test/ref/{sid}.mmwords',
|
||||
|
|
|
|||
|
|
@ -124,11 +124,7 @@ class unit_tests:
|
|||
if not opt.no_daemon_autostart:
|
||||
md.start()
|
||||
wd.start()
|
||||
c = MoneroWalletRPCClient(
|
||||
host = wd.host,
|
||||
port = wd.rpc_port,
|
||||
user = wd.user,
|
||||
passwd = wd.passwd )
|
||||
c = MoneroWalletRPCClient(daemon=wd)
|
||||
await c.call('get_version')
|
||||
|
||||
for md,wd in daemons:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue