Skip to main content

The official Diem Client SDK for Python.

pypi Apache V2 License Python versoins

API Reference

Pypi package

https://pypi.org/project/diem/

Examples

>>> from diem import jsonrpc, testnet
>>> client = jsonrpc.Client(testnet.JSON_RPC_URL)
>>> client.get_metadata()
version: 3300304
timestamp: 1601492912847973
chain_id: 2

You can find more examples under the examples directory:

Note: make test runs all examples too, see the Makefile for details.

Off-chain service example

Checkout MiniWallet implementation for off-chain service implementation example.

MiniWallet and MiniWallet Test Suite

See mini_wallet.md

Build & Test

make init
make test

run specific test:

make test t=<test file / test name match pattern>

run with local docker testnet (requires initializing diem submodule):

make test t=<test file / test name match pattern> dt=1

Re-generate diem_types, stdlib, jsonrpc response data structures

git submodule update --init diem
cd diem
git pull origin main
cd ..
make gen

Modules Overview

SPEC = specification

DIP-X = Diem Improvement Protocol

Root module name: diem

Sub-modules:

  • jsonrpc: diem JSON-RPC APIs client and API response types. SPEC
  • stdlib: generated code, move stdlib script utils for constructing transaction script playload.
  • diem_types: generated code, Diem on-chain data structure types for encoding and decoding BCS data.
  • utils: utility functions, account address utils, currency code, hashing, hex encoding / decoding, transaction utils.
  • AuthKey | auth_key: auth key utils
  • identifier: Diem Account Identifier and Diem Intent Identifier. DIP-5
  • txnmetadata: utils for creating peer to peer transaction metadata. DIP-4
  • testnet: Testnet utility, minting coins, create Testnet client, chain id, Testnet JSON-RPC URL.
  • testing: Testing utility, MiniWallet application, MiniWallet test suites, LocalAccount for managing local account keys and generating random local account.
  • chain_ids: list of static chain ids

Metadata

Release files for diem 1.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diem 1.7.1
File Size Uploaded
diem-1.7.1.tar.gz 160.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for diem 1.7.1
File Interpreter ABI Platform
diem-1.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 356.6 kB

Release files / diem-1.7.1.tar.gz

Download URL diem-1.7.1.tar.gz
Size 160.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f76b805361388c2fb9d49fec68eca1bad5288cc2c2b86382b278608e2d529fa8
BLAKE2b-256 checksum
How to use checksums
81d2399e995c3d22f048a5d2d5452d8f9b7b27e1a8d6071013de6d0167280bc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release files / diem-1.7.1-py3-none-any.whl

Download URL diem-1.7.1-py3-none-any.whl
Size 195.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af316046fc60340259f63566ab4eca0b3b1e917defa45dd307050e065ac6dd95
BLAKE2b-256 checksum
How to use checksums
78a414248e94ab718f842fba009102e2fc9daa167c68cc120bbf17afc38878f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release history Release notifications | RSS feed

This release

1.7.1 This release

2 release files

1.7.0

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.2.12

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page