Skip to main content

The Python SDK Utility for Circle Web3 Services

Project description

Circle Web3 APIs Python SDK

The Circle Web3 Python SDK provides convenient access to the Circle Web3 APIs for applications written in Python. For the API reference, see the Circle Web3 API Docs. Also see this project's PyPI Package Page [TODO].

Requirements

Python 3.7+.

Java 11 and Node 10+ (optional for contributing and development).

Installation

The recommended way of installation is using the Python Package Index (PyPI):

pip install circle-developer-controlled-wallets
pip install circle-smart-contract-platform
pip install circle-user-controlled-wallets

Development

Clone this repo and install development dependencies using

# For codegen tools and git hook checks
yarn install

Initialize the submodules:

git submodule init

Build the OpenAPI specifications:

cd w3s-openapi-internal
make bundle
cd ..

Run the codegen command to generate the source code for this SDK from the w3s-openapi-internal OpenAPI specifications

# Executes .openapi-generator/gen-sdk.sh
yarn gen-sdk

Usage

Initialize circle web3 API clients. To secure your entity secret and circle API key. Set the API key and entity secret as environment variables. Learn more about entity secret management here

export CIRCLE_ENTITY_SECRET="Your entity secret"
export CIRCLE_WEB3_API_KEY="Your API KEY"
from circle.web3 import utils

dcw_client = utils.init_developer_controlled_wallets_client(api_key="Your API KEY", entity_secret="Your entity secret")
scp_client = utils.init_smart_contract_platform_client(api_key="Your API KEY", entity_secret="Your entity secret")
ucw_client = utils.init_user_controlled_wallets_client(api_key="Your API KEY")

Using client to make a transaction.

from circle.web3 import user_controlled_wallets

# Create a API instance
ucw_client = utils.init_user_controlled_wallets_client(api_key="<your-api-key>")

api_instance = user_controlled_wallets.PINAuthenticationApi(ucw_client)
try:
    api_request = user_controlled_wallets.UserTokenRequest.from_dict({"userId": "test-user"})
    api_response = api_instance.get_user_token(api_request)
    print(api_response.data.user_token)
except user_controlled_wallets.ApiException as e:
    print("Exception when calling PINAuthenticationApi->get_user_token: %s\n" % e)

Contributions

Please follow the Conventional Commits format for all commits when creating a contributing pull request for this repo.

Project details


Download files

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

Source Distribution

circle_web3_sdk_util-6.0.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

circle_web3_sdk_util-6.0.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file circle_web3_sdk_util-6.0.0.tar.gz.

File metadata

  • Download URL: circle_web3_sdk_util-6.0.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for circle_web3_sdk_util-6.0.0.tar.gz
Algorithm Hash digest
SHA256 1d1756b8f0b44c6a9293e7f9aaf569ef6559e63217be48deaab93ded6bb94223
MD5 1e4dcb84b0760c108da86566548a5e32
BLAKE2b-256 0157c04d512e1da6c74bbec2868c6cc20b2880848f94be67ac08df80885a111f

See more details on using hashes here.

File details

Details for the file circle_web3_sdk_util-6.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for circle_web3_sdk_util-6.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b6653f90fda8c5446993d2a466b95eda07debd6d5a77b31c1c26cfd2a9f7c9b
MD5 70af60ccf6e06c4e4afd9639d4a622b2
BLAKE2b-256 6359c05ddf74d75ccf9cb7ce5d2a84c3a93bf8641fac0b978773b25c591bcdcb

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