You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
Python
53 lines
1.4 KiB
Python
5 years ago
|
from django.conf import settings
|
||
|
from monero.daemon import Daemon
|
||
|
from monero.wallet import Wallet
|
||
|
from monero.backends.jsonrpc import JSONRPCDaemon, JSONRPCWallet
|
||
|
|
||
|
|
||
|
class AuctionDaemon(object):
|
||
|
def __init__(self):
|
||
|
self.host = settings.DAEMON_HOST
|
||
|
self.port = settings.DAEMON_PORT
|
||
|
self.username = settings.DAEMON_USER
|
||
|
self.password = settings.DAEMON_PASS
|
||
|
self.daemon = Daemon(JSONRPCDaemon(
|
||
|
host=self.host,
|
||
|
port=self.port,
|
||
|
user=self.username,
|
||
|
password=self.password,
|
||
|
timeout=5
|
||
|
))
|
||
|
|
||
|
try:
|
||
|
status = self.daemon.info()['status']
|
||
|
if status == 'OK':
|
||
|
self.connected = True
|
||
|
else:
|
||
|
self.connected = False
|
||
|
except:
|
||
|
self.connected = False
|
||
|
|
||
|
|
||
|
|
||
|
class AuctionWallet(object):
|
||
|
def __init__(self):
|
||
|
self.host = settings.WALLET_HOST
|
||
|
self.port = settings.WALLET_PORT
|
||
|
self.username = settings.WALLET_USER
|
||
|
self.password = settings.WALLET_PASS
|
||
|
|
||
|
try:
|
||
|
self.wallet = Wallet(JSONRPCWallet(
|
||
|
host=self.host,
|
||
|
port=self.port,
|
||
|
user=self.username,
|
||
|
password=self.password,
|
||
|
timeout=5
|
||
|
))
|
||
|
if self.wallet:
|
||
|
self.connected = True
|
||
|
else:
|
||
|
self.connected = False
|
||
|
except:
|
||
|
self.connected = False
|