Installation

pip install cobo_custody

Test

python test.py --env develop/prod --secret <yourApiSecret>

Usage

Initialize

Generate Key Pair

from cobo_custody.signer.local_signer import generate_new_key
api_secret, api_key = generate_new_key()
print(api_secret)
print(api_key)

Please refer to the link for how to use apiKey

Initialize RestClient

from cobo_custody.client import Client
from cobo_custody.config import DEVELOP_ENV
from cobo_custody.signer.local_signer import LocalSigner
client = Client(signer=signer, env=DEVELOP_ENV, debug=True)

Initialize ApiSigner

ApiSigner can be instantiated through

from cobo_custody.signer.local_signer import LocalSigner
LocalSigner("API_SECRET")

In some cases, your private key cannot be exported, for example, your private key is in aws kms, you should pass in your own implementation by implements ApiSigner interface

Account

Check Account Details

client.get_account_info()

Get Coin Details

client.get_coin_info("ETH")

Get New Deposit Address

client.new_deposit_address("BTC")

Batch New Deposit Address

client.batch_new_deposit_address("BTC",4)

Verify Deposit Address

client.verify_deposit_address("BTC", "3Qd8ZV4DWxMPK1HfitxccZXV2H8mCST3kM")

Batch Verify Deposit Address

client.batch_verify_deposit_address("ETH", "0x05325e6f9d1f0437bd78a72c2ae084fbb8c039ee,0x05325e6f9d1f0437bd78a72c2ae084fbb8c039e1")

Verify Valid Address

client.verify_valid_address("ETH", "0x05325e6f9d1f0437bd78a72c2ae084fbb8c039ee")

Get Address History List

from cobo_custody.model.enums import SortFlagEnum
client.get_address_history("ETH",0, 10, sort_flag=SortFlagEnum.DESCENDING)

Loop Alliance

Check Loop Address Details

client.check_loop_address_details("ETH", "0x05325e6f9d1f0437bd78a72c2ae084fbb8c039ee")

Verify Loop Address List

client.verify_loop_address_list("ETH", "0xe7ebdc5bbb6c99cc8f7f2c1c83ff38aa6647f38a,0xe7ebdc5bbb6c99cc8f7f2c1c83ff38aa6647f38a")

Loop Transaction Explorer

To help your user to check the Loop transaction, we offer you an explorer, you may insert the following URL in your platform:https://loop.top/tx/[Loop_ID] e.g. https://loop.top/tx/L456e5cb652dcfe557a43fd9d8e48627

Transactions

Get Transaction Details

client.get_transaction_details("20210422193807000343569000002370")

Get Transactions By txid

client.get_transaction_by_txid("0x5d5396c3992ed524bf68a22a7ab6ae503f0349354ad69bc5204d5214085d4e9f")

Obtain the list of confirmed transactions through ID query(deposit&withdraw)

client.get_transactions_by_id()

Obtain the list of confirmed transactions through time query(deposit&withdraw)

client.get_transactions_by_time()

Get Pending Transactions

client.get_pending_transactions()

Get Pending Deposit Details

client.get_pending_transaction("20200604171238000354106000006405")

Get Transaction History

client.get_transaction_history()

Withdrawal

Submit Withdraw Request

client.withdraw("TETH","0xb744adc8d75e115eec8e582eb5e8d60eb0972037", 1)

Get Withdraw Information

client.query_withdraw_info("teth29374893624")

Staking

Get a Staking Product Details

client.get_staking_product_details(product_id)

Get All Staking Product List

client.get_staking_product_list()

Stake

client.stake(product_id, 1000000)

Unstake

unstake(product_id, 1000000)

Get Staking Data

get_stakings("IOST")

Get Unstaking Data

client.get_unstakings()

Get All Staking History

client.get_staking_history()