Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xbr fixes #1396

Merged
merged 1 commit into from Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions autobahn/twisted/xbr/__init__.py
Expand Up @@ -54,8 +54,8 @@ class SimpleBlockchain(_blockchain.SimpleBlockchain):
class KeySeries(_seller.KeySeries):
log = txaio.make_logger()

def __init__(self, api_id, price, interval, on_rotate=None):
super().__init__(api_id, price, interval, on_rotate)
def __init__(self, api_id, price, interval=None, count=None, on_rotate=None):
super().__init__(api_id, price, interval, count, on_rotate)
self.running = False
self._run_loop = None
self._started = None
Expand Down
6 changes: 6 additions & 0 deletions autobahn/xbr/__init__.py
Expand Up @@ -53,6 +53,8 @@
from autobahn.xbr._seller import SimpleSeller, KeySeries # noqa
from autobahn.xbr._buyer import SimpleBuyer # noqa

from autobahn.xbr._config import load_or_create_profile, UserConfig, Profile # noqa

HAS_XBR = True

if not hasattr(abi, 'collapse_type'):
Expand Down Expand Up @@ -295,6 +297,10 @@ def account_from_seedphrase(seephrase, index=0):
'sign_eip712_channel_close',
'recover_eip712_channel_close',

'load_or_create_profile',
'UserConfig',
'Profile',

'MemberLevel',
'ActorType',
'ChannelType',
Expand Down
24 changes: 18 additions & 6 deletions autobahn/xbr/_config.py
Expand Up @@ -260,6 +260,7 @@ def prompt_for_key(msg, key_len):

# default XBR market URL to connect to
market_url={market_url}
market_realm={market_realm}

# Infura blockchain gateway configuration
infura_url={infura_url}
Expand All @@ -284,12 +285,23 @@ def load_or_create_profile(dotdir=None, profile=None):
with open(config_path, 'w') as f:
market_url = prompt_for_wamp_url('enter a XBR data market URL')
market_realm = click.prompt('enter the WAMP realm of the XBR data market', type=str)
ethkey = prompt_for_key('your private Etherum key', 32)
cskey = prompt_for_key('your private WAMP client key', 32)
infura_network = click.prompt('enter Ethereum network to use', type=str, default='rinkeby')
infura_url = click.prompt('enter Infura gateway URL', type=str)
infura_key = click.prompt('your Infura gateway key', type=str)
infura_secret = click.prompt('your Infura gateway secret', type=str)
ethkey = prompt_for_key('your private Etherum key', os.urandom(32))
cskey = prompt_for_key('your private WAMP client key', os.urandom(32))

# infura_url=https://rinkeby.infura.io/v3/40c6...
# infura_network=rinkeby
# infura_key=40c6...
# infura_secret=5511...
infura_network = click.prompt('enter Ethereum network to use', type=str, default='')
if infura_network:
infura_url = click.prompt('enter Infura gateway URL', type=str)
infura_key = click.prompt('your Infura gateway key', type=str)
infura_secret = click.prompt('your Infura gateway secret', type=str)
else:
infura_url = ''
infura_key = ''
infura_secret = ''

f.write(_DEFAULT_CONFIG.format(market_url=market_url, market_realm=market_realm, ethkey=ethkey,
cskey=cskey, infura_url=infura_url, infura_network=infura_network,
infura_key=infura_key, infura_secret=infura_secret))
Expand Down