BlockChainTransactionApiDO.py 6.0 KB

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