【发布时间】:2020-04-27 21:16:36
【问题描述】:
例如在这样的智能合约中:
daml 1.2
module Example where
template Account with
owner : Party
number : Text
money : Int
where
signatory owner
key (owner, number) : (Party, Text)
maintainer key._1
可以根据模板的特定值查询交易
import dazl
network = dazl.Network()
def main():
with dazl.simple_client('http://localhost:6865', 'Alice') as client:
# wait for the ACS to be fully read
client.ready()
allContracts = client.find(template = "Example.Account")
for contract in allContracts:
if contract.cdata ["money"] == 10000:
print("The query is" )
print(contract.cdata)
if __name__ == '__main__':
main()
但是,如何根据key进行查询呢?
【问题讨论】: