本文整理汇总了Python中market.contracts.Contract.get_order_id方法的典型用法代码示例。如果您正苦于以下问题:Python Contract.get_order_id方法的具体用法?Python Contract.get_order_id怎么用?Python Contract.get_order_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类market.contracts.Contract
的用法示例。
在下文中一共展示了Contract.get_order_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rpc_order_confirmation
# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import get_order_id [as 别名]
def rpc_order_confirmation(self, sender, pubkey, encrypted):
try:
box = Box(self.signing_key.to_curve25519_private_key(), PublicKey(pubkey))
order = box.decrypt(encrypted)
c = Contract(self.db, contract=json.loads(order, object_pairs_hook=OrderedDict),
testnet=self.multiplexer.testnet)
valid = c.accept_order_confirmation(self.get_notification_listener())
if valid is True:
self.router.addContact(sender)
self.log.info("received confirmation for order %s" % c.get_order_id())
return ["True"]
else:
self.log.warning("received invalid order confirmation from %s" % sender)
return [valid]
except Exception, e:
self.log.error("unable to decrypt order confirmation from %s" % sender)
return [str(e.message)]
示例2: rpc_complete_order
# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import get_order_id [as 别名]
def rpc_complete_order(self, sender, pubkey, encrypted):
try:
box = Box(self.signing_key.to_curve25519_private_key(), PublicKey(pubkey))
order = box.decrypt(encrypted)
json.loads(order, object_pairs_hook=OrderedDict)
temp = Contract(self.db, contract=json.loads(order, object_pairs_hook=OrderedDict),
testnet=self.multiplexer.testnet)
c = Contract(self.db, hash_value=unhexlify(temp.get_order_id()),
testnet=self.multiplexer.testnet)
contract_id = c.accept_receipt(self.get_notification_listener(),
self.multiplexer.blockchain,
receipt_json=json.dumps(temp.contract["buyer_receipt"], indent=4))
self.router.addContact(sender)
self.log.info("received receipt for order %s" % contract_id)
return ["True"]
except Exception, e:
self.log.error("unable to parse receipt from %s" % sender)
return [e.message]