BlockChainContractApiDO.py 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class BlockChainContractApiDO(object):
  6. def __init__(self):
  7. self._abi = None
  8. self._block_chain_id = None
  9. self._block_hash = None
  10. self._cid = None
  11. self._code_hash = None
  12. self._contract_hash = None
  13. self._contract_timestamp = None
  14. self._contract_version = None
  15. self._data = None
  16. self._ext = None
  17. self._transaction_hash = None
  18. @property
  19. def abi(self):
  20. return self._abi
  21. @abi.setter
  22. def abi(self, value):
  23. self._abi = value
  24. @property
  25. def block_chain_id(self):
  26. return self._block_chain_id
  27. @block_chain_id.setter
  28. def block_chain_id(self, value):
  29. self._block_chain_id = value
  30. @property
  31. def block_hash(self):
  32. return self._block_hash
  33. @block_hash.setter
  34. def block_hash(self, value):
  35. self._block_hash = value
  36. @property
  37. def cid(self):
  38. return self._cid
  39. @cid.setter
  40. def cid(self, value):
  41. self._cid = value
  42. @property
  43. def code_hash(self):
  44. return self._code_hash
  45. @code_hash.setter
  46. def code_hash(self, value):
  47. self._code_hash = value
  48. @property
  49. def contract_hash(self):
  50. return self._contract_hash
  51. @contract_hash.setter
  52. def contract_hash(self, value):
  53. self._contract_hash = value
  54. @property
  55. def contract_timestamp(self):
  56. return self._contract_timestamp
  57. @contract_timestamp.setter
  58. def contract_timestamp(self, value):
  59. self._contract_timestamp = value
  60. @property
  61. def contract_version(self):
  62. return self._contract_version
  63. @contract_version.setter
  64. def contract_version(self, value):
  65. self._contract_version = value
  66. @property
  67. def data(self):
  68. return self._data
  69. @data.setter
  70. def data(self, value):
  71. self._data = value
  72. @property
  73. def ext(self):
  74. return self._ext
  75. @ext.setter
  76. def ext(self, value):
  77. self._ext = value
  78. @property
  79. def transaction_hash(self):
  80. return self._transaction_hash
  81. @transaction_hash.setter
  82. def transaction_hash(self, value):
  83. self._transaction_hash = value
  84. def to_alipay_dict(self):
  85. params = dict()
  86. if self.abi:
  87. if hasattr(self.abi, 'to_alipay_dict'):
  88. params['abi'] = self.abi.to_alipay_dict()
  89. else:
  90. params['abi'] = self.abi
  91. if self.block_chain_id:
  92. if hasattr(self.block_chain_id, 'to_alipay_dict'):
  93. params['block_chain_id'] = self.block_chain_id.to_alipay_dict()
  94. else:
  95. params['block_chain_id'] = self.block_chain_id
  96. if self.block_hash:
  97. if hasattr(self.block_hash, 'to_alipay_dict'):
  98. params['block_hash'] = self.block_hash.to_alipay_dict()
  99. else:
  100. params['block_hash'] = self.block_hash
  101. if self.cid:
  102. if hasattr(self.cid, 'to_alipay_dict'):
  103. params['cid'] = self.cid.to_alipay_dict()
  104. else:
  105. params['cid'] = self.cid
  106. if self.code_hash:
  107. if hasattr(self.code_hash, 'to_alipay_dict'):
  108. params['code_hash'] = self.code_hash.to_alipay_dict()
  109. else:
  110. params['code_hash'] = self.code_hash
  111. if self.contract_hash:
  112. if hasattr(self.contract_hash, 'to_alipay_dict'):
  113. params['contract_hash'] = self.contract_hash.to_alipay_dict()
  114. else:
  115. params['contract_hash'] = self.contract_hash
  116. if self.contract_timestamp:
  117. if hasattr(self.contract_timestamp, 'to_alipay_dict'):
  118. params['contract_timestamp'] = self.contract_timestamp.to_alipay_dict()
  119. else:
  120. params['contract_timestamp'] = self.contract_timestamp
  121. if self.contract_version:
  122. if hasattr(self.contract_version, 'to_alipay_dict'):
  123. params['contract_version'] = self.contract_version.to_alipay_dict()
  124. else:
  125. params['contract_version'] = self.contract_version
  126. if self.data:
  127. if hasattr(self.data, 'to_alipay_dict'):
  128. params['data'] = self.data.to_alipay_dict()
  129. else:
  130. params['data'] = self.data
  131. if self.ext:
  132. if hasattr(self.ext, 'to_alipay_dict'):
  133. params['ext'] = self.ext.to_alipay_dict()
  134. else:
  135. params['ext'] = self.ext
  136. if self.transaction_hash:
  137. if hasattr(self.transaction_hash, 'to_alipay_dict'):
  138. params['transaction_hash'] = self.transaction_hash.to_alipay_dict()
  139. else:
  140. params['transaction_hash'] = self.transaction_hash
  141. return params
  142. @staticmethod
  143. def from_alipay_dict(d):
  144. if not d:
  145. return None
  146. o = BlockChainContractApiDO()
  147. if 'abi' in d:
  148. o.abi = d['abi']
  149. if 'block_chain_id' in d:
  150. o.block_chain_id = d['block_chain_id']
  151. if 'block_hash' in d:
  152. o.block_hash = d['block_hash']
  153. if 'cid' in d:
  154. o.cid = d['cid']
  155. if 'code_hash' in d:
  156. o.code_hash = d['code_hash']
  157. if 'contract_hash' in d:
  158. o.contract_hash = d['contract_hash']
  159. if 'contract_timestamp' in d:
  160. o.contract_timestamp = d['contract_timestamp']
  161. if 'contract_version' in d:
  162. o.contract_version = d['contract_version']
  163. if 'data' in d:
  164. o.data = d['data']
  165. if 'ext' in d:
  166. o.ext = d['ext']
  167. if 'transaction_hash' in d:
  168. o.transaction_hash = d['transaction_hash']
  169. return o