diff --git a/__init__.py b/__init__.py index 38a920998b23a4645a39eff0789e6bb6b8e88108..e68c8e79a27f9cf673bda6cb8c287bfdddde83d2 100644 --- a/__init__.py +++ b/__init__.py @@ -92,7 +92,7 @@ class Response: class API: """APIRequest is a class used as an interface. The intermediate derivated classes are the modules and the leaf classes are the API requests.""" - def __init__(self, module): + def __init__(self, module, server=None, port=None): """ Asks a module in order to create the url used then by derivated classes. @@ -100,7 +100,9 @@ class API: - `module`: module name """ - self.url = 'http://%s:%d/%s' % (settings['server'], settings['port'], module) + self.url = 'http://%s:%d/%s' % (server if server else settings['server'], + port if port else settings['port'], + module) self.headers = {} if settings['auth']: diff --git a/hdc/__init__.py b/hdc/__init__.py index c54d8f65ef51fa64d976d611e5539550f9d55a32..9e242612dd3ac3ae98ef654d55333e8650208ebf 100644 --- a/hdc/__init__.py +++ b/hdc/__init__.py @@ -21,7 +21,7 @@ from .. import API, logging logger = logging.getLogger("ucoin/hdc") class HDC(API): - def __init__(self, module='hdc'): - super().__init__(module) + def __init__(self, module='hdc', server=None, port=None): + super().__init__(module, server, port) from . import amendments, coins, transactions diff --git a/hdc/amendments/__init__.py b/hdc/amendments/__init__.py index 00136dc1db6b4bccd2604c5e25a3fc5b7c1efcd2..812066a5186a3512bc2c9423e559048599af19d3 100644 --- a/hdc/amendments/__init__.py +++ b/hdc/amendments/__init__.py @@ -22,13 +22,13 @@ import logging logger = logging.getLogger("ucoin/hdc/amendments") class Base(HDC): - def __init__(self): - super().__init__('hdc/amendments') + def __init__(self, server=None, port=None): + super().__init__('hdc/amendments', server, port) class Promoted(Base): """GET the current promoted amendment (amendment which received enough votes to be accepted).""" - def __init__(self, number=None): + def __init__(self, number=None, server=None, port=None): """ Uses number to fit the result. @@ -36,15 +36,15 @@ class Promoted(Base): - `number`: amendment number """ - super().__init__() + super().__init__(server, port) self.number = number def __get__(self, **kwargs): if not self.number: - return self.requests_get('/promoted').json() + return self.requests_get('/promoted', **kwargs).json() - return self.requests_get('/promoted/%d' % self.number).json() + return self.requests_get('/promoted/%d' % self.number, **kwargs).json() class Current(Promoted): """Alias of amendments/promoted.""" @@ -57,11 +57,11 @@ class List(Base): def __get__(self, **kwargs): """creates a generator with one amendment per iteration.""" - current = self.requests_get('/promoted').json() + current = self.requests_get('/promoted', **kwargs).json() yield current while 'previousHash' in current and current['previousHash']: - current = self.requests_get('/promoted/%d' % (current['number']-1)).json() + current = self.requests_get('/promoted/%d' % (current['number']-1), **kwargs).json() yield current class CurrentVotes(Base): @@ -73,7 +73,7 @@ class CurrentVotes(Base): class Votes(Base): """GET an index of votes received by this node.""" - def __init__(self, amendment_id=None): + def __init__(self, amendment_id=None, server=None, port=None): """ Uses amendment_id to fit the result. @@ -81,13 +81,13 @@ class Votes(Base): - `amendment_id`: amendment id """ - super().__init__() + super().__init__(server, port) self.amendment_id = amendment_id def __get__(self, **kwargs): if not self.amendment_id: - return self.requests_get('/votes').json() + return self.requests_get('/votes', **kwargs).json() return self.merkle_easy_parser('/votes/%s' % self.amendment_id) diff --git a/hdc/amendments/view.py b/hdc/amendments/view.py index e32dce03a148303b54fc04713ce310295383b4de..418606dcc877bb3c46b54e5fb594e46faf03eb4c 100644 --- a/hdc/amendments/view.py +++ b/hdc/amendments/view.py @@ -21,8 +21,8 @@ from . import HDC, logging logger = logging.getLogger("ucoin/hdc/amendments/view") class View(HDC): - def __init__(self, amendment_id): - super().__init__('hdc/amendments/view/%s' % amendment_id) + def __init__(self, amendment_id, server=None, port=None): + super().__init__('hdc/amendments/view/%s' % amendment_id, server, port) class Members(View): """GET the members present in the Community for this amendment.""" @@ -34,7 +34,7 @@ class Self(View): """Shows the raw data of the amendment [AMENDMENT_ID].""" def __get__(self, **kwargs): - return self.requests_get('/self').json() + return self.requests_get('/self', **kwargs).json() class Voters(View): """GET the voters listed in this amendment.""" diff --git a/hdc/coins/__init__.py b/hdc/coins/__init__.py index 5c6933c7b3e44884298a8c8ea11c17a65ae45756..83c174128f533002af05c7e7cb9d1dc38f97aca4 100644 --- a/hdc/coins/__init__.py +++ b/hdc/coins/__init__.py @@ -21,24 +21,24 @@ from .. import HDC, logging logger = logging.getLogger("ucoin/hdc/coins") class Coins(HDC): - def __init__(self, pgp_fingerprint): - super().__init__('hdc/coins/%s' % pgp_fingerprint) + def __init__(self, pgp_fingerprint, server=None, port=None): + super().__init__('hdc/coins/%s' % pgp_fingerprint, server, port) class List(Coins): """GET a list of coins owned by the given [PGP_FINGERPRINT].""" def __get__(self, **kwargs): - return self.requests_get('/list').json() + return self.requests_get('/list', **kwargs).json() class View(Coins): """GET the ownership state of the coin [COIN_NUMBER] issued by [PGP_FINGERPRINT].""" - def __init__(self, pgp_fingerprint, coin_number): - super().__init__(pgp_fingerprint) + def __init__(self, pgp_fingerprint, coin_number, server=None, port=None): + super().__init__(pgp_fingerprint, server, port) self.coin_number = coin_number def __get__(self, **kwargs): - return self.requests_get('/view/%d' % self.coin_number).json() + return self.requests_get('/view/%d' % self.coin_number, **kwargs).json() from . import view diff --git a/hdc/coins/view.py b/hdc/coins/view.py index cfda8cbf0ec448ad539e4d32787c70edc43cac61..846aefef31aa047e8d43159146441d1750f0c467 100644 --- a/hdc/coins/view.py +++ b/hdc/coins/view.py @@ -21,11 +21,11 @@ from . import HDC, logging logger = logging.getLogger("ucoin/hdc/coins/view") class Base(HDC): - def __init__(self, pgp_fingerprint, coin_number): - super().__init__('hdc/coins/%s/view/%d' % (pgp_fingerprint, coin_number)) + def __init__(self, pgp_fingerprint, coin_number, server=None, port=None): + super().__init__('hdc/coins/%s/view/%d' % (pgp_fingerprint, coin_number), server, port) class History(Base): """GET a transaction history of the coin [COIN_NUMBER] issued by [PGP_FINGERPRINT].""" def __get__(self, **kwargs): - return self.requests_get('/history').json() + return self.requests_get('/history', **kwargs).json() diff --git a/hdc/transactions/__init__.py b/hdc/transactions/__init__.py index 61b6bb61ce0d79816aecd0645d20e14802aded8e..0aaa09d3062921628f103de1656fd83d80eb1309 100644 --- a/hdc/transactions/__init__.py +++ b/hdc/transactions/__init__.py @@ -21,8 +21,8 @@ from .. import HDC, logging logger = logging.getLogger("ucoin/hdc/transactions") class Base(HDC): - def __init__(self): - super().__init__('hdc/transactions') + def __init__(self, server=None, port=None): + super().__init__('hdc/transactions', server, port) class Process(Base): """POST a transaction.""" @@ -52,26 +52,26 @@ class Keys(Base): class Last(Base): """GET the last received transaction.""" - def __init__(self, count=None): + def __init__(self, count=None, server=None, port=None): """ Arguments: - `count`: Integer indicating to retrieve the last [COUNT] transactions. """ - super().__init__() + super().__init__(server, port) self.count = count def __get__(self, **kwargs): if not self.count: - return self.requests_get('/last').json() + return self.requests_get('/last', **kwargs).json() - return self.requests_get('/last/%d' % self.count).json() + return self.requests_get('/last/%d' % self.count, **kwargs).json() class Sender(Base): """GET all the transactions sent by this sender and stored by this node (should contain all transactions of the sender).""" - def __init__(self, pgp_fingerprint, begin=None, end=None): + def __init__(self, pgp_fingerprint, begin=None, end=None, server=None, port=None): """ Arguments: - `pgp_fingerprint`: PGP fingerprint of the key we want to see sent transactions. @@ -79,7 +79,7 @@ class Sender(Base): - `end`: integer value used by the merkle parser to know when to end requesting. """ - super().__init__() + super().__init__(server, port) self.pgp_fingerprint = pgp_fingerprint self.begin = begin @@ -91,7 +91,7 @@ class Sender(Base): class Recipient(Base): """GET all the transactions received for this recipient stored by this node.""" - def __init__(self, pgp_fingerprint, begin=None, end=None): + def __init__(self, pgp_fingerprint, begin=None, end=None, server=None, port=None): """ Arguments: - `pgp_fingerprint`: PGP fingerprint of the key we want to see sent transactions. @@ -99,7 +99,7 @@ class Recipient(Base): - `end`: integer value used by the merkle parser to know when to end requesting. """ - super().__init__() + super().__init__(server, port) self.pgp_fingerprint = pgp_fingerprint self.begin = begin @@ -111,17 +111,17 @@ class Recipient(Base): class View(Base): """GET the transaction of given TRANSACTION_ID.""" - def __init__(self, transaction_id): + def __init__(self, transaction_id, server=None, port=None): """ Arguments: - `transaction_id`: The transaction unique identifier. """ - super().__init__() + super().__init__(server, port) self.transaction_id = transaction_id def __get__(self, **kwargs): - return self.requests_get('/view/%s' % self.transaction_id).json() + return self.requests_get('/view/%s' % self.transaction_id, **kwargs).json() from . import sender diff --git a/hdc/transactions/sender/__init__.py b/hdc/transactions/sender/__init__.py index d95208b8848e8b6704c096e5fe582f9706cc655d..3dc85196eb5f7c00b0e378b28afe01ecc85ebede 100644 --- a/hdc/transactions/sender/__init__.py +++ b/hdc/transactions/sender/__init__.py @@ -23,32 +23,32 @@ logger = logging.getLogger("ucoin/hdc/transactions/sender") class Base(HDC): """Get the last received transaction of a PGP key.""" - def __init__(self, pgp_fingerprint): + def __init__(self, pgp_fingerprint, server=None, port=None): """ Arguments: - `pgp_fingerprint`: PGP fingerprint of the key we want to see sent transactions. """ - super().__init__('hdc/transactions/sender/%s' % pgp_fingerprint) + super().__init__('hdc/transactions/sender/%s' % pgp_fingerprint, server, port) class Last(Base): """Get the last received transaction of a PGP key.""" - def __init__(self, pgp_fingerprint, count=None): + def __init__(self, pgp_fingerprint, count=None, server=None, port=None): """ Arguments: - `count`: Integer indicating to retrieve the last [COUNT] transactions. """ - super().__init__(pgp_fingerprint) + super().__init__(pgp_fingerprint, server, port) self.count = count def __get__(self, **kwargs): if not self.count: - return self.requests_get('/last').json() + return self.requests_get('/last', **kwargs).json() - return self.requests_get('/last/%d' % self.count).json() + return self.requests_get('/last/%d' % self.count, **kwargs).json() class Transfer(Base): """GET all transfer transactions sent by this sender and stored by this node (should contain all transfert transactions of the sender).""" diff --git a/hdc/transactions/sender/issuance.py b/hdc/transactions/sender/issuance.py index d4a5c1e4f3b51cd915b58841eb59813658e4baa0..d5cd20cfc8edfa8ca3681956e8e5707b68fd6dba 100644 --- a/hdc/transactions/sender/issuance.py +++ b/hdc/transactions/sender/issuance.py @@ -23,19 +23,19 @@ logger = logging.getLogger("ucoin/hdc/transactions/sender/issuance") class Base(HDC): """Get the received issuance transaction of a PGP key.""" - def __init__(self, pgp_fingerprint): + def __init__(self, pgp_fingerprint, server=None, port=None): """ Arguments: - `pgp_fingerprint`: PGP fingerprint of the key we want to see sent transactions. """ - super().__init__('hdc/transactions/sender/%s/issuance' % pgp_fingerprint) + super().__init__('hdc/transactions/sender/%s/issuance' % pgp_fingerprint, server, port) class Last(Base): """GET the last received issuance transaction of a PGP key.""" def __get__(self, **kwargs): - return self.requests_get('/last').json() + return self.requests_get('/last', **kwargs).json() class Fusion(Base): """GET all fusion transactions sent by this sender and stored by this node (should contain all fusion transactions of the sender).""" @@ -46,13 +46,13 @@ class Fusion(Base): class Dividend(Base): """GET all dividend transactions (issuance of new coins) sent by this sender and stored by this node (should contain all dividend transactions of the sender).""" - def __init__(self, pgp_fingerprint, am_number=None): + def __init__(self, pgp_fingerprint, am_number=None, server=None, port=None): """ Arguments: - `am_number`: amendment number """ - super().__init__(pgp_fingerprint) + super().__init__(pgp_fingerprint, server, port) self.am_number = am_number diff --git a/pks/__init__.py b/pks/__init__.py index 3c0bed2b05163c876d871a4cb1c231c6673763aa..2c52bb407f034549971e4ab1ca10a48f39306e02 100644 --- a/pks/__init__.py +++ b/pks/__init__.py @@ -21,8 +21,8 @@ from .. import API, logging logger = logging.getLogger("ucoin/pks") class PKS(API): - def __init__(self, module='pks'): - super().__init__(module) + def __init__(self, module='pks', server=None, port=None): + super().__init__(module, server, port) class Add(PKS): """POST ASCII-armored OpenPGP certificates.""" diff --git a/ucg/__init__.py b/ucg/__init__.py index a858f95cbc519cec3652c512b89d880342dd9f20..cf1d7ff0a04bc9769a1bdaeb41ba58074264ee52 100644 --- a/ucg/__init__.py +++ b/ucg/__init__.py @@ -21,25 +21,25 @@ from .. import API, logging logger = logging.getLogger("ucoin/ucg") class UCG(API): - def __init__(self, module='ucg'): - super().__init__(module) + def __init__(self, module='ucg', server=None, port=None): + super().__init__(module, server, port) class Pubkey(UCG): """GET the public key of the peer.""" def __get__(self, **kwargs): - return self.requests_get('/pubkey').text + return self.requests_get('/pubkey', **kwargs).text class Peering(UCG): """GET peering information about a peer.""" def __get__(self, **kwargs): - return self.requests_get('/peering').json() + return self.requests_get('/peering', **kwargs).json() class THT(UCG): """GET/POST THT entries.""" - def __init__(self, pgp_fingerprint=None): + def __init__(self, pgp_fingerprint=None, server=None, port=None): """ Use the pgp fingerprint parameter in order to fit the result. @@ -47,7 +47,7 @@ class THT(UCG): - `pgp_fingerprint`: pgp fingerprint to use as a filter """ - super().__init__() + super().__init__(server, port) self.pgp_fingerprint = pgp_fingerprint diff --git a/ucg/peering/__init__.py b/ucg/peering/__init__.py index 77534303dbe76fd1550076699944bfd3232160c1..f08b9a57949bccdca6b22f0fb1de6c8dc3d8704b 100644 --- a/ucg/peering/__init__.py +++ b/ucg/peering/__init__.py @@ -21,8 +21,8 @@ from .. import UCG, logging logger = logging.getLogger("ucoin/ucg/peering") class Base(UCG): - def __init__(self): - super().__init__('ucg/peering') + def __init__(self, server=None, port=None): + super().__init__('ucg/peering', server, port) class Keys(Base): """GET PGP keys' fingerprint this node manages, i.e. this node will have transactions history and follow ohter nodes for this history.""" @@ -38,7 +38,7 @@ class Peer(Base): def __get__(self, **kwargs): """returns peering entry of the node.""" - return self.requests_get('/peer').json() + return self.requests_get('/peer', **kwargs).json() class Peers(Base): """GET peering entries of every node inside the currency network.""" diff --git a/ucg/peering/peers.py b/ucg/peering/peers.py index f03cbe88f6e012e880995097b52fc645487b999c..29fd76c5333f22c76c03708a19ee8584c5850663 100644 --- a/ucg/peering/peers.py +++ b/ucg/peering/peers.py @@ -21,13 +21,13 @@ from . import UCG, logging logger = logging.getLogger("ucoin/ucg/peering/peers") class Base(UCG): - def __init__(self): - super().__init__('ucg/peering/peers') + def __init__(self, server=None, port=None): + super().__init__('ucg/peering/peers', server, port) class Stream(Base): """GET a list of peers this node is listening to/by for ANY incoming transaction.""" - def __init__(self, request, pgp_fingerprint=None): + def __init__(self, request, pgp_fingerprint=None, server=None, port=None): """ Use the pgp fingerprint parameter in order to fit the result. @@ -36,7 +36,7 @@ class Stream(Base): - `pgp_fingerprint`: pgp fingerprint to use as a filter """ - super().__init__() + super().__init__(server, port) self.request = request self.pgp_fingerprint = pgp_fingerprint @@ -45,14 +45,14 @@ class Stream(Base): """returns the corresponding peer list.""" if not self.pgp_fingerprint: - return self.requests_get('/%s' % self.request).json() + return self.requests_get('/%s' % self.request, **kwargs).json() - return self.requests_get('/%s/%s' % (self.request, self.pgp_fingerprint)).json() + return self.requests_get('/%s/%s' % (self.request, self.pgp_fingerprint), **kwargs).json() class UpStream(Stream): """GET a list of peers this node is listening to for ANY incoming transaction.""" - def __init__(self, pgp_fingerprint=None): + def __init__(self, pgp_fingerprint=None, server=None, port=None): """ Use the pgp fingerprint parameter in order to fit the result. @@ -60,12 +60,12 @@ class UpStream(Stream): - `pgp_fingerprint`: pgp fingerprint to use as a filter """ - super().__init__('upstream', pgp_fingerprint) + super().__init__('upstream', pgp_fingerprint, server, port) class DownStream(Stream): """GET a list of peers this node is listening by for ANY incoming transaction.""" - def __init__(self, pgp_fingerprint=None): + def __init__(self, pgp_fingerprint=None, server=None, port=None): """ Use the pgp fingerprint parameter in order to fit the result. @@ -73,4 +73,4 @@ class DownStream(Stream): - `pgp_fingerprint`: pgp fingerprint to use as a filter """ - super().__init__('downstream', pgp_fingerprint) + super().__init__('downstream', pgp_fingerprint, server, port) diff --git a/wrappers/__init__.py b/wrappers/__init__.py index 2e7f868a60bc02826c92644038f2d16810c14448..ee7cd804aa46748bd0faee2a6c465093f7277b0a 100644 --- a/wrappers/__init__.py +++ b/wrappers/__init__.py @@ -23,6 +23,10 @@ from .. import pks, ucg, hdc, settings logger = logging.getLogger("wrappers") class Wrapper: + def __init__(self, server=None, port=None): + self.server = server + self.port = port + def __call__(self): pass diff --git a/wrappers/coins.py b/wrappers/coins.py index 106898563ce98ed6360d72796cfeb2197e12f224..1793a0f98a5162b685690dab7127e98e526e36f3 100644 --- a/wrappers/coins.py +++ b/wrappers/coins.py @@ -23,16 +23,19 @@ from . import Wrapper, pks, ucg, hdc, settings logger = logging.getLogger("coins") class Coins(Wrapper): - def __init__(self, pgp_fingerprint): + def __init__(self, pgp_fingerprint, server=None, port=None): + super().__init__(server, port) + self.pgp_fingerprint = pgp_fingerprint class Get(Coins): - def __init__(self, pgp_fingerprint, values): - super().__init__(pgp_fingerprint) + def __init__(self, pgp_fingerprint, values, server=None, port=None): + super().__init__(pgp_fingerprint, server, port) + self.values = values def __call__(self): - __list = hdc.coins.List(self.pgp_fingerprint).get() + __list = hdc.coins.List(self.pgp_fingerprint, self.server, self.port).get() coins = {} for c in __list['coins']: for id in c['ids']: @@ -60,12 +63,13 @@ class Get(Coins): return res class List(Coins): - def __init__(self, pgp_fingerprint, limit=None): - super().__init__(pgp_fingerprint) + def __init__(self, pgp_fingerprint, limit=None, server=None, port=None): + super().__init__(pgp_fingerprint, server, port) + self.limit = limit def __call__(self): - __list = hdc.coins.List(self.pgp_fingerprint).get() + __list = hdc.coins.List(self.pgp_fingerprint, self.server, self.port).get() coins = [] __sum = 0 diff --git a/wrappers/transactions.py b/wrappers/transactions.py index 670dbffaab7902c6c9db435ee2d9fa69a845c0e8..e1ed0f66ac724602e27f94222d3d013b5c699fe8 100644 --- a/wrappers/transactions.py +++ b/wrappers/transactions.py @@ -23,7 +23,9 @@ from . import Wrapper, pks, ucg, hdc, settings logger = logging.getLogger("transactions") class Transaction(Wrapper): - def __init__(self, type, pgp_fingerprint, message='', peering=None): + def __init__(self, type, pgp_fingerprint, message='', peering=None, server=None, port=None): + super().__init__(server, port) + self.pgp_fingerprint = pgp_fingerprint self.message = message self.type = type @@ -32,7 +34,7 @@ class Transaction(Wrapper): def __call__(self): try: - last_tx = hdc.transactions.sender.Last(self.pgp_fingerprint).get() + last_tx = hdc.transactions.sender.Last(self.pgp_fingerprint, self.server, self.port).get() except ValueError: last_tx = None @@ -83,7 +85,7 @@ Comment: def process(self, tx, txs): try: - hdc.transactions.Process().post(transaction=tx, signature=txs) + hdc.transactions.Process(self.server, self.port).post(transaction=tx, signature=txs) except ValueError as e: self.error = str(e) else: @@ -97,7 +99,7 @@ Comment: data = coin.split(':') issuer, numbers = data[0], data[1:] for number in numbers: - view = hdc.coins.View(issuer, int(number)).get() + view = hdc.coins.View(issuer, int(number), self.server, self.port).get() if view['owner'] != self.pgp_fingerprint: raise ValueError('Trying to divide a coin you do not own (%s)' % view['id']) coins.append(view) @@ -115,8 +117,9 @@ Comment: if not m: raise ValueError('bad sum value %d' % __sum) class Transfer(Transaction): - def __init__(self, pgp_fingerprint, recipient, coins, message=''): - super().__init__('TRANSFER', pgp_fingerprint, message) + def __init__(self, pgp_fingerprint, recipient, coins, message='', server=None, port=None): + super().__init__('TRANSFER', pgp_fingerprint, message, server, port) + self.recipient = recipient self.coins = coins @@ -133,7 +136,7 @@ Coins: data = coin.split(':') issuer = data[0] for number in data[1:]: - context_data.update(hdc.coins.View(issuer, int(number)).get()) + context_data.update(hdc.coins.View(issuer, int(number), self.server, self.port).get()) tx += '%(id)s, %(transaction)s\n' % context_data return tx @@ -154,7 +157,7 @@ Coins: """ % context_data try: - last_issuance = hdc.transactions.sender.issuance.Last(self.pgp_fingerprint).get() + last_issuance = hdc.transactions.sender.issuance.Last(self.pgp_fingerprint, self.server, self.port).get() except ValueError: last_issuance = None @@ -168,8 +171,9 @@ Coins: return tx class Issue(MonoTransaction): - def __init__(self, pgp_fingerprint, amendment, coins, message=''): - super().__init__('ISSUANCE', pgp_fingerprint, message) + def __init__(self, pgp_fingerprint, amendment, coins, message='', server=None, port=None): + super().__init__('ISSUANCE', pgp_fingerprint, message, server, port) + self.amendment = amendment self.coins = coins @@ -184,8 +188,9 @@ class Issue(MonoTransaction): return tx class Fusion(MonoTransaction): - def __init__(self, pgp_fingerprint, coins, message=''): - super().__init__('FUSION', pgp_fingerprint, message) + def __init__(self, pgp_fingerprint, coins, message='', server=None, port=None): + super().__init__('FUSION', pgp_fingerprint, message, server, port) + self.coins = coins def get_mono_message(self, context_data, tx=''): @@ -200,8 +205,9 @@ class Fusion(MonoTransaction): return tx class Divide(MonoTransaction): - def __init__(self, pgp_fingerprint, old_coins, new_coins, message=''): - super().__init__('DIVISION', pgp_fingerprint, message) + def __init__(self, pgp_fingerprint, old_coins, new_coins, message='', server=None, port=None): + super().__init__('DIVISION', pgp_fingerprint, message, server, port) + self.old_coins = old_coins self.new_coins = new_coins