componetize certificate payload construction
@@ -23,18 +23,28 @@ class CertificateClient(BasicClient):
def __init__(self):
super().__init__(CertificateHandler)
- def store_certificate(self, certificate_raw, signature_rem, signature_crt):
+ def get_new_certificate_payload(self, certificate_raw, signature_rem, signature_crt):
payload = NewCertificatePayload()
payload.certificate_raw = certificate_raw
payload.signature_rem = signature_rem
payload.signature_crt = signature_crt
+
+ return payload
+
+ def get_revoke_payload(self, crt_address):
+ payload = RevokeCertificatePayload()
+ payload.address = crt_address
+
+ return payload
+
+ def store_certificate(self, certificate_raw, signature_rem, signature_crt):
+ payload = self.get_new_certificate_payload(certificate_raw, signature_rem, signature_crt)
crt_address = self.make_address_from_data(certificate_raw)
print('Certificate address', crt_address)
self._send_transaction(CertificateMethod.STORE, payload, [crt_address])
def revoke_certificate(self, crt_address):
- payload = RevokeCertificatePayload()
- payload.address = crt_address
+ payload = self.get_revoke_payload(crt_address)
self._send_transaction(CertificateMethod.REVOKE, payload, [crt_address])
def get_signer_pubkey(self):
