circle chain sdk in python
Project description
Circle Chain
build & upload
build project
build the project please input the following command:
python3 -m build
upload to testpypi
twine upload --repository testpypi dist/*
pip install -i https://test.pypi.org/simple/ circle-chain
after installation, test passed in the local machine. then upload the lib to the release pypi:
upload to pypi
upload to pypi:
twine upload dist/*
Install
pip install circle-chain
Usage
register and login or login with verify code
# 1. first register and login or login with verify code
## option1: register and login
from circle_chain.user import send_register_verify_code,register,login,send_verify_code
response = send_register_verify_code({ "email": "<your-email>" })
if response['status'] != 200:
raise Exception(response['message'])
# receive the register verify code in your email
response = register({
"email": "<your-email>",
"passwordInput1": "111111",
"passwordInput2": "111111",
"verifyCode": "222222"
})
if response['status'] != 200:
raise Exception(response['message'])
# now login with password
response = login({
"email": "<your-email>",
"password": "111111",
})
if response['status'] != 200:
raise Exception(response['message'])
# now user login success
## option2: login with verify code
response = send_verify_code({ "email": "<your-email>" })
if response['status'] != 200:
raise Exception(response['message'])
# receive login verify code in your email
response = login({
"email": "<your-email>",
"verifyCode": "111111",
})
if response['status'] != 200:
raise Exception(response['message'])
# now user login success
## for you login, option1 and option2 are ok, you just select one.
Wallet functions
from circle_chain.wallet import create_wallet,list_wallet,assets_of_wallet
response = create_wallet()
if response['status'] != 200:
raise Exception(response['message'])
# get the address created
address = response['data']
response = list_wallet()
if response['status'] != 200:
raise Exception(response['message'])
# get address list
address_list = response['data']
response = assets_of_wallet()
if response['status'] != 200:
raise Exception(response['message'])
# the asset info of wallet
data = response['data']
set pay password
from circle_chain.user import send_pay_verify_code, set_pay_password
response = send_pay_verify_code({ "email": "<your-email>" })
if response['status'] != 200:
raise Exception(response['message'])
# receive the pay verify code in your email
response = set_pay_password({
"account": {
"email": "test@gmail.com"
},
"password": "333333",
"verifyCode": "112222"
})
if response['status'] != 200:
raise Exception(response['message'])
# now your pay password is set success
Transactions
from circle_chain.wallet import send_to, pay
from_address = '1L8eRrBuWnBxcQ6DKCDkkPM7ozxDcmpho1'
to = '14hF1BynFVnBEFKxyo51FHmJksVwfxg4sg'
# send asset from `1L8eRrBuWnBxcQ6DKCDkkPM7ozxDcmpho1` to `14hF1BynFVnBEFKxyo51FHmJksVwfxg4sg`
response = send_to({
'email': 'test@gmail.com',
'from': from_address,
'address': to,
'transContent': {
'type': 1,
'uuid': 'e1f1d3c7-3c6e-4f3b-a50d-58710b851357'
},
'payPassword': '111111'
})
if response['status'] != 200:
raise Exception(response['message'])
# asset is sent success
# pay balance from `1L8eRrBuWnBxcQ6DKCDkkPM7ozxDcmpho1` to `14hF1BynFVnBEFKxyo51FHmJksVwfxg4sg`
response = pay({
'from': from_address,
'to': to,
'value': 100,
'payPassword': "111111"
});
if response['status'] != 200:
raise Exception(response['message'])
# the value is paid success.
add contacts
from circle_chain.user import add_contacts
response = add_contacts({
'email': "test2@gmail.com",
'name': "test2",
'sex': 1,
'address': "beijing"
});
if response['status'] != 200:
raise Exception(response['message'])
# the contact is added success.
APIs
circle_node
-
subcribe
-
server_features
-
broadcast_transaction
circle_user
send_verify_code
login
logout
send_register_verify_code
register
add_contacts
list_contacts
send_pay_verify_code
set_pay_password
have_pay_password
send_reset_password_verify_code
reset_password
save_or_update_user_info
user_info
circle_wallet
cloud wallets
create_wallet
list_wallet
balance_of_wallet
assets_of_wallet
assets_of_address
get_public_key_hash_from_address
balance_of_address
send_to
pay
search_tx_by_type
search_tx_by_time
public_key_from_address
let_me_try
open wallets
public_get_address_by_uid
public_get_assets_of_address
public_search_transaction
public_get_balance_of_address
circle_block
get_block_hash_list
get_block
get_block_header_list
get_block_data
get_block_tail_hash_list
get_block_tails_po
get_transaction_by_txid
search_tx_by_txid
search_tx_by_address
search_utxo
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_chain-0.0.3.tar.gz
(13.0 kB
view details)
Built Distribution
File details
Details for the file circle_chain-0.0.3.tar.gz
.
File metadata
- Download URL: circle_chain-0.0.3.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e1092c40b13adeebda5781c749af582195cf043e42ce29f1905eebdb1954ba2 |
|
MD5 | 2251955bc787bf8ee9a5200f5b9548fb |
|
BLAKE2b-256 | a325d251d20749160964ba2295d60a2638638affddf5a2d08efb91d2f47619c8 |
File details
Details for the file circle_chain-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: circle_chain-0.0.3-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 170b58971394974cc7c11a1cb6060c47bff068807401ff934e4b44507bd8c7a5 |
|
MD5 | 27f874703c72ed082d5fd2ff9fdc7351 |
|
BLAKE2b-256 | 45e94c067f41b9175164b41dea566ed396f85ad7cfd5f7216498585c4c37e44e |