add channel_import and channel_export

This commit is contained in:
Jack Robison 2017-11-22 13:46:34 -05:00
parent d0b2de9850
commit d98e0e8110
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF
3 changed files with 52 additions and 1 deletions

View file

@ -27,7 +27,7 @@ at anytime.
### Added ### Added
* *
* * Added `channel_import` and `channel_export` commands
### Removed ### Removed
* *

View file

@ -1135,6 +1135,15 @@ class Wallet(object):
def send_claim_to_address(self, claim_id, destination, amount): def send_claim_to_address(self, claim_id, destination, amount):
return defer.fail(NotImplementedError()) return defer.fail(NotImplementedError())
def import_certificate_info(self, serialized_certificate_info):
return defer.fail(NotImplementedError())
def export_certificate_info(self, certificate_claim_id):
return defer.fail(NotImplementedError())
def get_certificates_for_signing(self):
return defer.fail(NotImplementedError())
def _start(self): def _start(self):
pass pass
@ -1494,6 +1503,15 @@ class LBRYumWallet(Wallet):
def send_claim_to_address(self, claim_id, destination, amount): def send_claim_to_address(self, claim_id, destination, amount):
return self._run_cmd_as_defer_succeed('sendclaimtoaddress', claim_id, destination, amount) return self._run_cmd_as_defer_succeed('sendclaimtoaddress', claim_id, destination, amount)
def import_certificate_info(self, serialized_certificate_info):
return self._run_cmd_as_defer_succeed('importcertificateinfo', serialized_certificate_info)
def export_certificate_info(self, certificate_claim_id):
return self._run_cmd_as_defer_succeed('exportcertificateinfo', certificate_claim_id)
def get_certificates_for_signing(self):
return self._run_cmd_as_defer_succeed('getcertificatesforsigning')
# TODO: get rid of this function. lbryum should take care of it # TODO: get rid of this function. lbryum should take care of it
def _save_wallet(self, val=None): def _save_wallet(self, val=None):
self.wallet.storage.write() self.wallet.storage.write()

View file

@ -1757,6 +1757,39 @@ class Daemon(AuthJSONRPCServer):
response = yield self._render_response(result) response = yield self._render_response(result)
defer.returnValue(response) defer.returnValue(response)
@AuthJSONRPCServer.auth_required
@defer.inlineCallbacks
def jsonrpc_channel_export(self, claim_id):
"""
Export serialized channel signing information for a given certificate claim id
Usage:
channel_export (<claim_id> | --claim_id=<claim_id>)
Returns:
(str) Serialized certificate information
"""
result = yield self.session.wallet.export_certificate_info(claim_id)
defer.returnValue(result)
@AuthJSONRPCServer.auth_required
@defer.inlineCallbacks
def jsonrpc_channel_import(self, serialized_certificate_info):
"""
Import serialized channel signing information (to allow signing new claims to the channel)
Usage:
channel_import (<serialized_certificate_info> |
--serialized_certificate_info=<serialized_certificate_info>)
Returns:
(dict) Result dictionary
"""
result = yield self.session.wallet.import_certificate_info(serialized_certificate_info)
defer.returnValue(result)
@AuthJSONRPCServer.auth_required @AuthJSONRPCServer.auth_required
@defer.inlineCallbacks @defer.inlineCallbacks
def jsonrpc_publish(self, name, bid, metadata=None, file_path=None, fee=None, title=None, def jsonrpc_publish(self, name, bid, metadata=None, file_path=None, fee=None, title=None,