xbr._buyer¶
Classes¶
Simple XBR buyer component. This component can be used by a XBR buyer delegate to |
|
Module Contents¶
- class SimpleBuyer(market_maker_adr, buyer_key, max_price)[source]¶
Bases:
objectSimple XBR buyer component. This component can be used by a XBR buyer delegate to handle the automated buying of data encryption keys from the XBR market maker.
- _save_transaction_phase1(channel_oid, delegate_adr, buyer_pubkey, key_id, channel_seq, amount, balance, signature)[source]¶
- Parameters:
channel_oid
delegate_adr
buyer_pubkey
key_id
channel_seq
amount
balance
signature
- Returns:
- _save_transaction_phase2(channel_oid, delegate_adr, buyer_pubkey, key_id, channel_seq, amount, balance, signature)[source]¶
- Parameters:
channel_oid
delegate_adr
buyer_pubkey
key_id
channel_seq
amount
balance
signature
- Returns:
- async balance()[source]¶
Return current balance of payment channel:
amount: The initial amount with which the payment channel was opened.remaining: The remaining amount of XBR in the payment channel that can be spent.inflight: The amount of XBR allocated to buy transactions that are currently processed.
- Returns:
Current payment balance.
- Return type:
- async close_channel(details=None)[source]¶
Requests to close the currently active payment channel.
- Returns:
- async open_channel(buyer_addr, amount, details=None)[source]¶
- Parameters:
amount
details
- Returns:
- Return type:
- past_transactions(filter_complete=True, limit=1)[source]¶
- Parameters:
filter_complete
limit
- Returns:
- async start(session, consumer_id)[source]¶
Start buying keys to decrypt XBR data by calling
unwrap().- Parameters:
session (
autobahn.wamp.protocol.ApplicationSession) – WAMP session over which to communicate with the XBR market maker.consumer_id (str) – XBR consumer ID.
- Returns:
Current remaining balance in payment channel.
- Return type: