跳转到主要内容

ComChain API客户端库

项目描述

pyc3l

Latest Pypi Version

此项目允许创建与ComChain API通信的Python脚本。

成熟度

此代码处于alpha阶段。尚未在Windows上进行测试。API可能会更改。这更像是一个持续反思的草案。

需求

此代码适用于python3,并使用

  • eth_account
  • web3
  • ecdsa
  • requests

已在Python 3.93.103.113.12 上进行测试。

安装

由于pyc3l在PyPI上可用,您无需下载git版本的代码。因此,您应该能够运行

pip install pyc3l

如果您已下载了GIT源代码,则可以通过传统方式安装当前版本:

pip install .

如果您没有git源代码但想从GitHub获取最新master分支或分支,您也可以:

pip install git+https://github.com/com-chain/pyc3l

或者甚至选择特定的修订版(分支/标签/提交):

pip install git+https://github.com/com-chain/pyc3l@master

使用方法

from pyc3l import Pyc3l

## Instantiate our interface to Comchain's node
pyc3l = Pyc3l()

## load your ciphered wallet
wallet = pyc3l.Wallet.from_json(json_string_wallet)

## use the ``wallet`` object to read the blockchain

wallet.isValidAdmin
wallet.status

wallet.globalBalance
wallet.nantBalance
wallet.cmBalance
wallet.cmLimitMin
wallet.cmLimitMax

wallet.Allowances        ## dict of {address: amount}
wallet.Requests          ## dict of {address: amount}
wallet.MyRequests        ## dict of {address: amount}
wallet.Delegations       ## dict of {address: amount}
wallet.MyDelegations     ## dict of {address: amount}
wallet.AcceptedRequests  ## dict of {address: amount}
wallet.RejectedRequests  ## dict of {address: amount}


## use the ``wallet`` object to emit transaction

## unlock your wallet with your password
wallet.unlock(mypassword)

wallet.enable(address)
wallet.disable(address)

wallet.pledge(address, amount, amount,  message_from="", message_to="")
wallet.delegate(address, amount)

wallet.transferNant(address, amount, message_from="", message_to="")
wallet.transferOnBehalfOf(address_from, address_to, amount, message_from="", message_to="")


## Get the currency object

currency = Currency("Lemanopolis")
## or from wallet:
currency = wallet.currency

请注意,pyc3l-cli软件包包含许多简短的脚本,用于展示库的使用方法。

贡献

欢迎提出建议或问题。非常欢迎推送请求,请查看指南。

测试

要运行测试,您需要安装hatch和:

hatch run test

推送请求指南

您可以发送任何代码。我会查看它,并自己将其集成到代码库中,并将您作为作者保留。这个过程可能需要一些时间,如果您遵循以下指南,则所需时间会更短

  • 使用PEP8或pylint检查您的代码。尽量保持80列宽度。
  • 按最小关注点分隔您的提交。
  • 每个提交都应该通过测试(以便轻松二分查找)
  • 每个功能/错误修复提交应包含代码、测试和文档。
  • 优先的次要提交(包含排版或代码美学更改)非常欢迎。这些应在提交摘要中标记为!minor
  • 提交信息应遵循gitchangelog规则(查看git日志以获取示例)
  • 如果提交修复了问题或完成了功能的实现,请在摘要中提及。

如果您对这里未解答的指南有任何疑问,请检查当前的git log,您可能会找到以前的提交,该提交显示了如何处理您的问题。

许可证

根据[GNU Affero General Public License](GNU Affero General Public License: http://raw.github.com/com-chain/pyc3l/master/LICENSE)许可

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

pyc3l-0.3.0.tar.gz (30.6 kB 查看散列)

上传时间 源代码

构建分发

pyc3l-0.3.0-py3-none-any.whl (30.9 kB 查看散列)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面