high-level Ledger API client for DAML ledgers
Project description
dazl
Copyright (c) 2017-2021 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:
pip install --user dazl
Requirements
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:
with dazl.simple_client('http://localhost:6865', 'Alice') as client:
contract = { 'issuer' : 'Alice', 'owner' : 'Alice', 'name' : 'hello world!' }
client.ready()
client.submit_create('Main.Asset', contract)
Connect to the ledger as a single party, print all contracts, and close:
with dazl.simple_client('http://localhost:6865', 'Alice') as client:
# wait for the ACS to be fully read
client.ready()
contract_dict = client.find_active('*')
print(contract_dict)
Connect to the ledger using asynchronous callbacks:
from dazl.model.reading import ReadyEvent
network = dazl.Network()
network.set_config(url='http://localhost:6865')
alice = network.aio_party('Alice')
@alice.ledger_ready()
async def onReady(event: ReadyEvent):
contracts = await event.acs_find_one('Main.Asset')
print(contracts)
network.run_until_complete()
Building locally
You will need to have Poetry installed, and the dependencies fetched using poetry install. Then do:
make build
If you see errors about incompatible python versions, switch your environment to python3 using poetry env use python3, for instance.
Building Documentation
The above command will build documentation in the root docs/ dir. Committing this into source control and pushing to github will cause github-pages to be updated.
Tests
Tests in dazl are written using pytest. You can run them by doing:
make test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dazl-7.3.2.tar.gz.
File metadata
- Download URL: dazl-7.3.2.tar.gz
- Upload date:
- Size: 240.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.9.1 Darwin/20.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20e3d0d0ac2164222e538bbc8c93096445b873ad4c0517ab14698a8dd6815db8
|
|
| MD5 |
27fe17ef6abaeb199a2d9d38bea34f4b
|
|
| BLAKE2b-256 |
3bc4ff057a931836eefa4c2081aed07c38c85abf6840afcdea03e8016399f5da
|
File details
Details for the file dazl-7.3.2-py3-none-any.whl.
File metadata
- Download URL: dazl-7.3.2-py3-none-any.whl
- Upload date:
- Size: 344.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.9.1 Darwin/20.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ceff15bc203845dbec02b6b1cf53f792367e7d023e0eb853b8f7abefd815fce
|
|
| MD5 |
82f27c941b2a4c6d54321ddf4b182805
|
|
| BLAKE2b-256 |
d7aef4751135f999cf7c5925d3eb6ee6d6b142bed7c3911932476c84043ed321
|