This repository was archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentities.py
More file actions
62 lines (48 loc) · 1.88 KB
/
entities.py
File metadata and controls
62 lines (48 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
class Wallet():
def __init__(self, mrpc):
self.height = mrpc.getHeight()
self.creation = mrpc.heightToDate(self.height)
self.addresses = mrpc.getAddresses()
self.balances = mrpc.getBalances()
self.out_transfers = mrpc.getOutTransfers()
self.in_transfers = mrpc.getInTransfers()
for address in self.addresses:
if address.index == 0:
self.main_address = address
# print(mrpc.getAccountsTags())
# print(mrpc.getAddressBook())
class Address():
def __init__(self, address, index, label, used):
self.address = address
self.index = index
self.label = label
self.used = used
class Balance():
def __init__(self, address, balance, unlocked, num_unspent_outputs):
self.address = address
self.balance = balance * 1e-12
self.unlocked = unlocked * 1e-12
self.num_unspent_outputs = num_unspent_outputs
class Transfer():
def __init__(self, address, amount, confirmations, double_spend_seen, fee, height, note, payment_id, timestamp, txid, type, destinations=None):
self.address = address
self.amount = amount * 1e-12
self.confirmations = confirmations
self.double_spend_seen = double_spend_seen
self.fee = fee * 1e-12
self.height = height
self.note = note
self.payment_id = payment_id
self.timestamp = timestamp
self.txid = txid
self.type = type
if type=='out':
self.destinations = destinations if destinations else []
def add_destination(self, destination):
if self.type != 'out':
raise Exception("Destinations only for out transactions")
self.destinations.append(destination)
class Destination():
def __init__(self, address, amount):
self.address = address
self.amount = amount * 1e-12