GithubHelp home page GithubHelp logo

legua25 / client-sdk-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from diem/client-sdk-python

0.0 1.0 0.0 1.92 MB

Python client library for Diem

License: Apache License 2.0

Python 99.66% Makefile 0.27% HTML 0.06%

client-sdk-python's Introduction

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.jsonrpc import AsyncClient
>>> from diem.testing import JSON_RPC_URL
>>> import asyncio
>>>
>>> async def main():
...     # Use with statement to close client after usage
...     # or call client.close() when initialized without with statement
...     with AsyncClient(JSON_RPC_URL) as client:
...         print(await client.get_metadata())
...
>>> asyncio.run(main())

version: 3300304
timestamp: 1601492912847973
chain_id: 2
......

You can find more examples under the examples directory:

For building a wallet application, see MiniWallet Application for example.

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

client-sdk-python's People

Contributors

capcap avatar dependabot[bot] avatar ericnakagawa avatar nimishamw avatar sunmilee avatar xli avatar yanivmo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.