Telos Coin Handler

Module contents

Telos Coin Handler

This python module is a Coin Handler for Privex’s CryptoToken Converter, designed to handle all required functionality for both receiving and sending tokens on the Telos network.

It will automatically handle any payments.models.Coin which has it’s type set to telos

To use this handler, you must first create the base coin with symbol Telos:

Coin Name:  TLOS
Symbol:     TLOS
Our Account: (username of account used for sending/receiving native Telos token)
Custom JSON: {"contract": "eosio.token"}

To change the RPC node from the admin panel, simply set the host/port/username/password on the Telos Coin:

# Below are the defaults used if you don't configure the Telos coin::
Host: telos.caleos.io
Port: 443
User: (leave blank)
Pass: (leave blank)
Custom JSON: {"ssl": True}

Coin Settings (Custom JSON settings)

Tip

You can override the defaults for all Telos coins by setting the settings_json for a coin with the symbol TLOS.

All Coin’s handled by the Telos handler will inherit the TLOS coin’s custom JSON settings, which can be overrided via the individual coin’s settings_json.

You can set the following JSON keys inside of a Coin’s “settings_json” field to adjust settings such as the “contract account” for the token, whether or not to use SSL with the RPC node, as well as the precision (DP) of the coin, if it’s different from the default of 4 decimal places.

Coin Key Description
endpoint (str) The base URI to query against, e.g. /telos_rpc/
ssl (bool) Whether or not to use SSL (https). Boolean true or false
contract (str) The contract account for this token, e.g. eosio.token or steemenginex
precision (int) The precision (decimal places) of this coin (defaults to 4)
load_method (str) Either actions to use v1/history, or pvx to use Privex EOS History
history_url (str) (if load_method is pvx) Privex history URL, e.g. https://eos-history.privex.io

Copyright:

+===================================================+
|                 © 2019 Privex Inc.                |
|               https://www.privex.io               |
+===================================================+
|                                                   |
|        CryptoToken Converter                      |
|                                                   |
|        Core Developer(s):                         |
|                                                   |
|          (+)  Chris (@someguy123) [Privex]        |
|                                                   |
+===================================================+
payments.coin_handlers.Telos.reload()[source]

Reload’s the provides property for the loader and manager from the DB.

By default, since new tokens are constantly being created for Telos, our classes can provide for any models.Coin by scanning for coins with the type telos. This saves us from hard coding specific coin symbols.

Submodules

TelosLoader module

class payments.coin_handlers.Telos.TelosLoader.TelosLoader(symbols)[source]

Bases: payments.coin_handlers.EOS.EOSLoader.EOSLoader, payments.coin_handlers.Telos.TelosMixin.TelosMixin

This is a stub class which simply glues TelosMixin onto EOSLoader

Once the mixin is applied, it adjusts the chain settings and overrides any required methods, then the standard EOSLoader code should just work.

provides

TelosManager module

class payments.coin_handlers.Telos.TelosManager.TelosManager(symbol: str)[source]

Bases: payments.coin_handlers.EOS.EOSManager.EOSManager, payments.coin_handlers.Telos.TelosMixin.TelosMixin

This is a stub class which simply glues TelosMixin onto EOSManager

Once the mixin is applied, it adjusts the chain settings and overrides any required methods, then the standard EOSManager code should just work.

provides

TelosMixin module

class payments.coin_handlers.Telos.TelosMixin.TelosMixin[source]

Bases: payments.coin_handlers.EOS.EOSMixin.EOSMixin

chain = 'telos'
chain_coin = 'TLOS'
chain_type = 'telos'
default_contracts = {'TLOS': 'eosio.token'}
eos

Returns an instance of Cleos and caches it in the attribute _telos after creation

provides = ['TLOS']
replace_eos(**conn) → eospy.cleos.Cleos[source]

Destroy the EOS Cleos instance at _eos and re-create it with the modified connection settings conn

Also returns the EOS instance for convenience.

Only need to specify settings you want to override.

Example:

>>> eos = self.replace_eos(host='example.com', port=80, ssl=False)
>>> eos.get_account('someguy123')
Parameters:conn – Connection settings. Keys: endpoint, ssl, host, port, username, password
Return Cleos eos:
 A Cleos instance with the modified connection settings.
setting_defaults = {'endpoint': '/', 'history_url': '', 'host': 'telos.caleos.io', 'load_method': 'actions', 'password': None, 'port': 443, 'precision': 4, 'ssl': True, 'telos': True, 'username': None}