项目作者: digital-asset

项目描述 :
dazl Ledger API client
高级语言: Python
项目地址: git://github.com/digital-asset/dazl-client.git
创建时间: 2019-05-23T23:39:20Z
项目社区:https://github.com/digital-asset/dazl-client

开源协议:Other

下载


Daml Python bindings (formerly known as dazl)

License


Copyright (c) 2017-2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0

Rich Python bindings for accessing Ledger API-based applications.

Documentation

The user documentation is available online here.

Installation

If you just want to use the library, you can install it locally with pip:

  1. pip install --user dazl

Requirements

  • Python 3.9+
  • Go 1.22
  • Daml SDK
    • Daml 2: 2.7 or later

Examples

All of the examples below assume you imported dazl, and are running a ledger with the default scenario generated with daml new.

Connect to the ledger and submit a single command:

  1. import asyncio
  2. import dazl
  3. async def main():
  4. async with dazl.connect(url='http://localhost:6865', act_as='Alice') as client:
  5. contract = { 'issuer' : 'Alice', 'owner' : 'Alice', 'name' : 'hello world!' }
  6. await client.create('Main:Asset', contract)
  7. asyncio.run(main())

Connect to the ledger as a single party, print all contracts, and close:

  1. import asyncio
  2. import dazl
  3. from dazl.ledgerutil import ACS
  4. async def main():
  5. async with dazl.connect(url='http://localhost:6865', read_as='Alice') as conn:
  6. async with ACS(conn, {"*": {}}) as acs:
  7. snapshot = await acs.read()
  8. print(snapshot)
  9. asyncio.run(main())

Building locally

You will need additional dependencies to build locally:

Once you have these prerequisites in place:

  1. make build

Tests

Tests in the Daml Python bindings are written using pytest. You can run them by doing:

  1. make test

Support

The Daml Python bindings library are supported under the Daml Enterprise license. If you do not have a Daml Enterprise license and are in need of support, have questions or just want to engage in friendly conversation anything Daml, contact us on our Daml Community Forum.