Welcome to CoinView Server(Python) SDK’s documentation!

API document for CoinView’s Python SDK package.

class coinview.Credential(user_id, session_id, pin, pin_token, private_key)

The Credential class contains all user credentials for initialize the CoinViewPay object for interacting with server APIs.

Parameters:
  • user_id – wallet’s user id in UUID format
  • session_id – amount of token you with to transfer
  • pin – the pin setted when creating the wallet.
  • pin_token – pin token can be extracted from the backup secret key
  • private_key – private key can be extracted from the backup secret key
Returns:

A credential object by which you can initialize the CoinViewPay

credential = Credential(
   user_id='a76d6864-a758-46e6-8abc-aa5ddf0d3a51',
   session_id='33057864-864b-44cd-8dda-28ab514117da',
   pin='123321',
   pin_token='oYjrk1chVvnZ...',
   private_key='-----BEGIN RSA PRIVATE KEY-----\n...'
)
from_backup(secret_key: str, pin: str)

You can also create the Credential from a secret key which you can get from CoinView’s wallet’s backup function.

Parameters:
  • secret_key – The secret key
  • pin – the 6 digits pin when you create your wallet
Returns:

A credential object by which you can initialize the CoinViewPay

class coinview.CoinViewPay(credential: coinview.Credential)

Initialize the class with credential information of the wallet

Parameters:credential – an instance of the Credential class
credential = Credential.from_backup('XXXX...', '123456')
app = CoinViewPay(credential)
get_asset(asset_id)

Get assets and its basic information by an asset’s ID

Parameters:asset_id – asset id of the token in UUID format. Use the transactions or list_assets to find the corresponding asset ID
Returns:A JSON object
{
  "asset_id": "07065d64-fd33-39b5-b275-9a2cc4806ef4",
  "balance": "999607",
  "chain_id": "43d61dcd-e413-450d-80b8-101d5e903357",
  "confirmations": 100,
  "name": "NXT Token for NEC2018",
  "public_key": "0x4Ac80f604dA7c7Dd39B26774a84fB99c28Fe41e0",
  "symbol": "NXT",
  "type": "asset"
}
list_assets()

List all your assets in the wallet

Returns:A JSON array of all the assets
[
  {
    "asset_id": "07065d64-fd33-39b5-b275-9a2cc4806ef4",
    "balance": "999607",
    "chain_id": "43d61dcd-e413-450d-80b8-101d5e903357",
    "confirmations": 100,
    "name": "NXT Token for NEC2018",
    "public_key": "0x4Ac80f604dA7c7Dd39B26774a84fB99c28Fe41e0",
    "symbol": "NXT",
    "type": "asset"
  },
  ...
]
transactions(limit: int = None, offset: Optional[str] = None)

List transactions

Parameters:
  • limit – no more than the limit amount of transactions will be returned
  • offset – only return transactions before the offset (a timestamp, eg 2018-09-11T05:39:25.429083062Z)
Returns:

A JSON array of all transactions happened in the account

[
    {
      "amount": "0.1",
      "asset_id": "d0deee89-a0f3-34ec-a92c-1a4d16fd2c3d",
      "counter_user_id": "729c1eec-f03f-3a52-b391-6092cfaba3fb",
      "created_at": "2018-09-11T05:39:25.429083062Z",
      "memo": "",
      "opponent_id": "729c1eec-f03f-3a52-b391-6092cfaba1fb",
      "snapshot_id": "9833191e-f379-4a18-ae49-5199e1ce8a59",
      "trace_id": "49b990c7-cd3b-415b-8c5e-2f5909854202",
      "type": "transfer"
    },
    ...
]
transfer(recipient_id: str, amount: str, asset_id: str, trace_id: str, memo: str)

Make a direct transfer

Parameters:
  • recipient_id – recipient user id in UUID format
  • amount – amount of token you with to transfer
  • asset_id

    asset id of the token in UUID format. Use the transactions or list_assets to find the corresponding asset ID

  • trace_id – a UUID for identifying the transfer
  • memo – optional note
Returns:

A JSON object

{
  "type": "transfer",
  "snapshot_id": "ab56be4c-5b20-41c6-a9c3-244f9a433f35",
  "opponent_id": "a465ffdb-4441-4cb9-8b45-00cf79dfbc46",
  "asset_id": "43d61dcd-e413-450d-80b8-101d5e903357",
  "amount": "-10",
  "trace_id": "7c67e8e8-b142-488b-80a3-61d4d29c90bf",
  "memo": "hello",
  "created_at": "2018-05-03T10:08:34.859542588Z"
}
user(user_id)

Get user detail by user’s ID

Parameters:user_id – The user’s ID in UUID format
Returns:A JSON object of user information including full name and avatar
{
  "avatar_url": "",
  "created_at": "2018-09-04T03:34:18.484856821Z",
  "full_name": "Example",
  "identity_number": "0",
  "is_verified": false,
  "mute_until": "0001-01-01T00:00:00Z",
  "relationship": "STRANGER",
  "type": "user",
  "user_id": "729c1eec-f03f-3a52-b391-6092cfaba3fb"
}
verify_payment(recipient_id: str, amount: str, asset_id: str, trace_id: str)

Verify payment status

Parameters:
  • recipient_id – recipient user id in UUID format
  • amount – amount of token you with to transfer
  • asset_id

    asset id of the token in UUID format. Use the transactions or list_assets to find the corresponding asset ID

  • trace_id – a UUID for identifying the transfer
Returns:

A JSON object with recipient, asset and status information. the status could be pending and paid

{
  "recipient": {
    "type": "user",
    "user_id": "a465ffdb-4441-4cb9-8b45-00cf79dfbc46",
    "identity_number": "20018",
    "full_name": "OS105",
    "avatar_url": "",
    "relationship": "",
    "mute_until": "0001-01-01T00:00:00Z",
    "created_at": "2018-04-25T05:37:10.06433488Z",
    "is_verified": false
  },
  "asset": {
    "type": "asset",
    "asset_id": "43d61dcd-e413-450d-80b8-101d5e903357",
    "chain_id": "43d61dcd-e413-450d-80b8-101d5e903357",
    "symbol": "EOS",
    "name": "EOS",
    "balance": "0",
    "public_key": "",
    "price_btc": "0.0776679",
    "price_usd": "715.394"
  },
  "amount": "10",
  "status": "pending"
}