当前位置: 首页>>代码示例>>Python>>正文


Python Contract.await_funding方法代码示例

本文整理汇总了Python中market.contracts.Contract.await_funding方法的典型用法代码示例。如果您正苦于以下问题:Python Contract.await_funding方法的具体用法?Python Contract.await_funding怎么用?Python Contract.await_funding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在market.contracts.Contract的用法示例。


在下文中一共展示了Contract.await_funding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: rpc_order

# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import await_funding [as 别名]
 def rpc_order(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)
         v = c.verify(sender.pubkey)
         if v is True:
             self.router.addContact(sender)
             self.log.info("received an order from %s, waiting for payment..." % sender)
             payment_address = c.contract["buyer_order"]["order"]["payment"]["address"]
             chaincode = c.contract["buyer_order"]["order"]["payment"]["chaincode"]
             masterkey_b = c.contract["buyer_order"]["order"]["id"]["pubkeys"]["bitcoin"]
             buyer_key = derive_childkey(masterkey_b, chaincode)
             amount = c.contract["buyer_order"]["order"]["payment"]["amount"]
             listing_hash = c.contract["vendor_offer"]["listing"]["contract_id"]
             signature = self.signing_key.sign(
                 str(payment_address) + str(amount) + str(listing_hash) + str(buyer_key))[:64]
             c.await_funding(self.get_notification_listener(), self.multiplexer.blockchain, signature, False)
             return [signature]
         else:
             self.log.warning("received invalid order from %s reason %s" % (sender, v))
             return ["False"]
     except Exception, e:
         self.log.error("Exception (%s) occurred processing order from %s" % (e.message, sender))
         return ["False"]
开发者ID:inertia186,项目名称:OpenBazaar-Server,代码行数:28,代码来源:protocol.py

示例2: rpc_order

# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import await_funding [as 别名]
 def rpc_order(self, sender, pubkey, encrypted):
     try:
         box = Box(PrivateKey(self.signing_key.encode(nacl.encoding.RawEncoder)), PublicKey(pubkey))
         order = box.decrypt(encrypted)
         c = Contract(self.db, contract=json.loads(order, object_pairs_hook=OrderedDict),
                      testnet=self.multiplexer.testnet)
         if c.verify(sender.signed_pubkey[64:]):
             self.router.addContact(sender)
             self.log.info("received an order from %s, waiting for payment..." % sender)
             payment_address = c.contract["buyer_order"]["order"]["payment"]["address"]
             chaincode = c.contract["buyer_order"]["order"]["payment"]["chaincode"]
             masterkey_b = c.contract["buyer_order"]["order"]["id"]["pubkeys"]["bitcoin"]
             buyer_key = derive_childkey(masterkey_b, chaincode)
             amount = c.contract["buyer_order"]["order"]["payment"]["amount"]
             listing_hash = c.contract["buyer_order"]["order"]["ref_hash"]
             signature = self.signing_key.sign(
                 str(payment_address) + str(amount) + str(listing_hash) + str(buyer_key))[:64]
             c.await_funding(self.get_notification_listener(), self.multiplexer.blockchain, signature, False)
             return [signature]
         else:
             self.log.warning("received invalid order from %s" % sender)
             return ["False"]
     except Exception:
         self.log.error("unable to decrypt order from %s" % sender)
         return ["False"]
开发者ID:wmpedersen,项目名称:OpenBazaar-Server,代码行数:27,代码来源:protocol.py

示例3: rpc_order

# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import await_funding [as 别名]
 def rpc_order(self, sender, pubkey, encrypted):
     try:
         box = Box(PrivateKey(self.signing_key.encode(nacl.encoding.RawEncoder)), PublicKey(pubkey))
         order = box.decrypt(encrypted)
         c = Contract(self.db, contract=json.loads(order, object_pairs_hook=OrderedDict),
                      testnet=self.multiplexer.testnet)
         if c.verify(sender.signed_pubkey[64:]):
             self.router.addContact(sender)
             self.log.info("Received an order from %s" % sender)
             payment_address = c.contract["buyer_order"]["order"]["payment"]["address"]
             signature = self.signing_key.sign(str(payment_address))[:64]
             c.await_funding(self.multiplexer.ws, self.multiplexer.blockchain, signature, False)
             return [signature]
         else:
             self.log.error("Received invalid order from %s" % sender)
             return ["False"]
     except Exception:
         self.log.error("Unable to decrypt order from %s" % sender)
         return ["False"]
开发者ID:JimmyMow,项目名称:OpenBazaar-Server,代码行数:21,代码来源:protocol.py


注:本文中的market.contracts.Contract.await_funding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。