Skip to main content

high-level Ledger API client for DAML ledgers

Project description

dazl

License

Copyright 2019 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.

Requirements

  • Python 3.6+
  • Pipenv
  • Although not strictly required for building, you'll probably want the DAML SDK

Examples

All of the examples below assume you imported dazl.

Connect to the ledger and submit a single command:

with dazl.simple_client('http://localhost:7600', 'Alice') as client:
    client.submit_create('Alice', 'My.Template', { someField: 'someText' })

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

with dazl.simple_client('http://localhost:7600', '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 as multiple parties:

network = dazl.Network()
network.set_config(url='http://localhost:7600')

alice = network.simple_party('Alice')
bob = network.simple_party('Bob')

@alice.ledger_ready()
def set_up(event):
    currency_cid, _ = await event.acs_find_one('My.Currency', {"currency": "USD"})
    return dazl.create('SomethingOf.Value', {
        'amount': 100,
        'currency': currency_cid,
        'from': 'Accept',
        'to': 'Bob' })

@bob.ledger_created('SomethingOf.Value')
def on_something_of_value(event):
    return dazl.exercise(event.cid, 'Accept', { 'message': 'Thanks!' })

network.start()

Building locally

cd python && pipenv run package

Tests

cd python && pipenv run test

Project details


Release history Release notifications | RSS feed

This version

6.5.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dazl-6.5.1.tar.gz (222.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dazl-6.5.1-py3-none-any.whl (311.6 kB view details)

Uploaded Python 3

File details

Details for the file dazl-6.5.1.tar.gz.

File metadata

  • Download URL: dazl-6.5.1.tar.gz
  • Upload date:
  • Size: 222.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.6.8 Darwin/18.7.0

File hashes

Hashes for dazl-6.5.1.tar.gz
Algorithm Hash digest
SHA256 af47987e06c9746f1b8a54608aec366e206c63b9dce0a5914f930b41368c1b07
MD5 0122e8d725327156fe2ec6b5cf3afa8e
BLAKE2b-256 92e528ab63e3340ae090df54f4bb4b4d4f01a5735986624f9f6dace874023948

See more details on using hashes here.

File details

Details for the file dazl-6.5.1-py3-none-any.whl.

File metadata

  • Download URL: dazl-6.5.1-py3-none-any.whl
  • Upload date:
  • Size: 311.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.6.8 Darwin/18.7.0

File hashes

Hashes for dazl-6.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aac62203dce39e08296936e7a2e1ab80991d209b20e663c0759c78d95aa9d4ee
MD5 dc221b3e20b1f72b606c1f5701217ea5
BLAKE2b-256 7e1de859532db37503205ae98c02dff6a59c03db14ddd69ee47d8a7a2f8e68eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page