Skip to main content

Python wrapper to interact with the TRTL Services API.

Project description

TRTL Service Python API Interface

This wrapper allows you to easily interact with the TRTL Services 0.9.0 API to quickly develop applications that interact with the TurtleCoin Network.

Table of Contents

  1. Installation
  2. Intialization
  3. Documentation
  4. Methods

Installation

pip install ts-api-py

Intialization

import os
from TRTLservices import TS

os.environ["TRTL_SERVICES_TOKEN"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoieW8iLCJhcHBJZCI6MjAsInVzZXJJZCI6MiwicGVybWlzc2lvbnMiOlsiYWRkcmVzczpuZXciLCJhZGRyZXNzOnZpZXciLCJhZGRyZXNzOmFsbCIsImFkZHJlc3M6c2NhbiIsImFkZHJlc3M6ZGVsZXRlIiwidHJhbnNmZXI6bmV3IiwidHJhbnNmZXI6dmlldyJdLCJpYXQiOjE1Mzk5OTQ4OTgsImV4cCI6MTU3MTU1MjQ5OCwiYXVkIjoiZ2FuZy5jb20iLCJpc3MiOiJUUlRMIFNlcnZpY2VzIiwianRpIjoiMjIifQ.KkKyg18aqZfLGMGTnUDhYQmVSUoocrr4CCdLBm2K7V87s2T-3hTtM2MChJB2UdbDLWnf58GiMa_t8xp9ZjZjIg"

os.environ["TRTL_SERVICES_TIMEOUT"] = 2000

Generate a token with the TRTL Services Dashboard and store it as the variable TRTL_SERVICES_TOKEN in your os environment along with TRTL_SERVICES_TIMEOUT if you wish the change the default timeout of 2000.

Documentation

API documentation is available at https://trtl.services/docs

Methods

createAddress()

Create a new TRTL addresses

TS.createAddress()

getAddress(address)

Get address details by address

TS.getAddress("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A")

deleteAddress(address)

Delete a selected TRTL addresses

TS.deleteAdddress("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A")

getAddresses()

View all addresses belonging to the specified token.

TS.getAddresses()

scanAddress(address, blockIndex)

Scan an address for transactions between a 100 block range starting from the specified blockIndex.

TS.scanAddress("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A", 899093)

getAddressKeys(address)

Get the public and secret spend key of an address.

TS.getAddressKeys("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A")

integrateAddress(address, paymentId)

Create an integrated address with an address and payment ID.

TS.integrateAddress("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A", "7d89a2d16365a1198c46db5bbe1af03d2b503a06404f39496d1d94a0a46f8804")

getIntegratedAddresses(address)

Create an integrated address with an address and payment ID.

TS.getIntegratedAddresses("TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A")

getFee(amount)

Calculate the TRTL Services fee for an amount specified in TRTL with two decimal points.

TS.getFee(1092.19)

createTransfer(sender, receiver, amount, fee, paymentId, extra)

Send a TRTL transaction with an address with the amount specified two decimal points.

TS.createTransfer(
  "TRTLuxH78akDMCsXycnU5HjJE6zPCgM4KRNNQSboqh1yiTnvxuhNVUL9tK92j9kurSKdXVHFmjSRkaNBxM6Nb3G8eQGL7aj113A",
  "TRTLuzAzNs1E1RBFhteX56A5353vyHuSJ5AYYQfoN97PNbcMDvwQo4pUWHs7SYpuD9ThvA7AD3r742kwTmWh5o9WFaB9JXH8evP",
  1000.01,
  1.2,
  "7d89a2d16365a1198c46db5bbe1af03d2b503a06404f39496d1d94a0a46f8804",
  "3938f915a11582f62d93f82f710df9203a029f929fd2f915f2701d947f920f99"
)

You can leave the last two fields (paymentId and extra) blank.

getTransfer(address)

Get a transaction details specified by transaction hash.

TS.getTransfer("EohMUzR1DELyeQM9RVVwpmn5Y1DP0lh1b1ZpLQrfXQsgtvGHnDdJSG31nX2yESYZ")

getWallet()

Get wallet container info and health check.

TS.getWallet()

getStatus()

Get the current status of the TRTL Services infrastructure.

TS.getStatus()

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

ts-api-py-0.9.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ts_api_py-0.9.2-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file ts-api-py-0.9.2.tar.gz.

File metadata

  • Download URL: ts-api-py-0.9.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for ts-api-py-0.9.2.tar.gz
Algorithm Hash digest
SHA256 1d6c7c8571af32d8e22dd4767957c3434ac5876018fae58a673dec8719df3959
MD5 0c6f2b796947184f53a83682dfc87cd5
BLAKE2b-256 c55566007d9e25d41653e6a013048f5e790911a0f6d855ac5dafedfceac0f7b5

See more details on using hashes here.

File details

Details for the file ts_api_py-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: ts_api_py-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for ts_api_py-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b8d665b0d51b8478c646a992e195d8f6b1887b1f11ca930da7973a2b05bd68fa
MD5 56651ed31bbd2d6df329e1d82c2e40a2
BLAKE2b-256 06d7bd52856d8a8cedd84223e5a367da4dc26e2c4f95723d8ead6f2e57ee5699

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page