Browse Source

clean up Maker interface

master
undeath 7 years ago
parent
commit
d33cc5c6a8
  1. 27
      jmclient/jmclient/maker.py
  2. 25
      jmclient/jmclient/yieldgenerator.py

27
jmclient/jmclient/maker.py

@ -4,6 +4,7 @@ from __future__ import print_function
import base64 import base64
import pprint import pprint
import sys import sys
import abc
from binascii import unhexlify from binascii import unhexlify
import btc import btc
@ -234,3 +235,29 @@ class Maker(object):
return return
assert hasattr(bci, 'get_wallet_name') assert hasattr(bci, 'get_wallet_name')
bci.import_addresses(addr_list, bci.get_wallet_name(self.wallet)) bci.import_addresses(addr_list, bci.get_wallet_name(self.wallet))
@abc.abstractmethod
def create_my_orders(self):
"""Must generate a set of orders to be displayed
according to the contents of the wallet + some algo.
(Note: should be called "create_my_offers")
"""
@abc.abstractmethod
def oid_to_order(self, cjorder, oid, amount):
"""Must convert an order with an offer/order id
into a set of utxos to fill the order.
Also provides the output addresses for the Taker.
"""
@abc.abstractmethod
def on_tx_unconfirmed(self, cjorder, txid, removed_utxos):
"""Performs action on receipt of transaction into the
mempool in the blockchain instance (e.g. announcing orders)
"""
@abc.abstractmethod
def on_tx_confirmed(self, cjorder, confirmations, txid):
"""Performs actions on receipt of 1st confirmation of
a transaction into a block (e.g. announce orders)
"""

25
jmclient/jmclient/yieldgenerator.py

@ -41,31 +41,6 @@ class YieldGenerator(Maker):
self.income_statement.write(','.join(data) + '\n') self.income_statement.write(','.join(data) + '\n')
self.income_statement.close() self.income_statement.close()
@abc.abstractmethod
def create_my_orders(self):
"""Must generate a set of orders to be displayed
according to the contents of the wallet + some algo.
(Note: should be called "create_my_offers")
"""
@abc.abstractmethod
def oid_to_order(self, cjorder, oid, amount):
"""Must convert an order with an offer/order id
into a set of utxos to fill the order.
Also provides the output addresses for the Taker.
"""
@abc.abstractmethod
def on_tx_unconfirmed(self, cjorder, txid, removed_utxos):
"""Performs action on receipt of transaction into the
mempool in the blockchain instance (e.g. announcing orders)
"""
@abc.abstractmethod
def on_tx_confirmed(self, cjorder, confirmations, txid):
"""Performs actions on receipt of 1st confirmation of
a transaction into a block (e.g. announce orders)
"""
class YieldGeneratorBasic(YieldGenerator): class YieldGeneratorBasic(YieldGenerator):
"""A simplest possible instantiation of a yieldgenerator. """A simplest possible instantiation of a yieldgenerator.

Loading…
Cancel
Save