打开api sdk
open api-sdk是一个与开放平台交互的库。
内容
安装
使用pip:
$ pip install open-api-sdk
开始
开放平台使用openkeys来允许访问api。您可以在Account.上注册新的openkey
open平台希望openkey包含在对服务器的所有api请求中。
我们假设此时您已经拥有了openkey。
要访问库,请导入一个openplatform类并使用openkey调用一个实例,如下所示:
fromopenp_pyimportOpenPy# Access API via instance of OpenPlatform classop=OpenPy(open_key)
open_key
-你的公开密钥。
在下面的示例中,假设op
是用open_key
实例化
OpenPlatform
类的结果。
api
页面请求属性
Attribute | Type | Description |
---|
offset | Long | Page offset |
limit | Int | Page limit |
页面响应属性
Attribute | Type | Description |
---|
totalCount | Long | Total count of entities in a database |
list | [] | List of entities with type T (T is generic) |
脚手架
脚手架属性
Attribute | Type | Description |
---|
address | String | Scaffold address |
abi | String | Scaffold json interface |
description | String | Scaffold description |
fiatAmount | String | Scaffold fiat amount |
currency | String | Fiat amount currency |
conversionAmount | String | Fiat amount converted to ethereum |
developerAddress | String | Scaffold developer address |
webHook | String | Scaffold webhook for events |
properties | ScaffoldProperty[] | Scaffold properties |
脚手架属性属性
Attribute | Type | Description |
---|
name | String | Property name |
type | PropertyType | Property type |
defaultValue | String | Property default value |
全部获取(
scaffolds=op.scaffold.get_all()
获取单个(地址)
address='0x1c297f40beb075936d6dbe4b245b92738867ecb1'# an address of the scaffold (example)scaffold=op.scaffold.get_single(address)
脚手架汇总属性
Attribute | Type | Description |
---|
scaffold | Scaffold | Scaffold |
transactionIndex | BigInteger | Transaction index |
tokenBalance | BigInteger | Scaffold token balance |
enabled | Boolean | Scaffold enabled |
currency | String | Fiat amount currency |
shareHolders | ShareHolder | Scaffold shareholders |
获取摘要(地址)
summary=op.scaffold.get_summary(address)
获取交易(地址)
transactions=op.scaffold.get_summary(address)
设置web hook请求data
Attribute | Type | Description |
---|
address | String | Scaffold address |
webHook | String | Scaffold webhook for events |
示例:
data={'webHook':'https://example.com'}
设置Webhook(地址、数据)
scaffold=op.scaffold.set_webhook(address,data)
部署脚手架请求data
Attribute | Type | Description |
---|
openKey | String | User open key |
description | String | Scaffold description |
fiatAmount | String | Scaffold fiat amount |
currency | String | Fiat amount currency |
conversionAmount | String | Fiat amount converted to ethereum |
developerAddress | String | Scaffold developer address |
webHook | String | Scaffold webhook for events |
properties | ScaffoldProperty[] | Scaffold properties |
示例:
data={'openKey':open_key,'developerAddress':'0x0000000000000000000000000000000000000000','description':"any_description",'fiatAmount':"123",'currency':"USD",'conversionAmount':'0.2139521163','properties':[{'name':"property_name",'type':"STRING",'defaultValue':"property_value"}]}
部署脚手架(数据)
scaffold=op.scaffold.deploy(data)
停用脚手架(地址)
scaffold=op.scaffold.deactivate(address)
配额属性
Attribute | Type | Description |
---|
currentCount | Int | Current deactivated scaffolds count |
limitCount | Int | Limit of deactivated scaffolds count |
获取配额()
quota=op.scaffold.get_quota()
股东
股东属性
Attribute | Type | Description |
---|
address | String | Shareholder address |
percent | Int | Shareholder percent |
示例:
# Shareholder attributesdata={'address':'0x0000000000000000000000000000000000000000','percent':30}
添加(地址、数据)
summary=op.shareholder.create(address,data)
更新股东请求data
Attribute | Type | Description |
---|
percent | Int | Shareholder percent |
示例:
data={'percent':50}
更新(地址、持有人地址、数据)
shareholder_address="0xDc29484cc9C02Ee01015f33BcA8bBb5C7293Fb54"# an example of shareholder's addresssummary=op.shareholder.update(address,shareholder_address,data)
删除(地址,持有者地址)
summary=op.shareholder.remove(address,shareholder_address)
欢迎加入QQ群-->: 979659372
推荐PyPI第三方库