Skip to main content

LTO Network Python API

Project description

lto-api.python

Python client library for interacting with LTO Network

Accounts

Create an account

The chain_id is 'L' for the MainNet and 'T' TestNet

from lto.accounts.account_factory import AccountFactory

account = AccountFactory(chain_id).create()

Create an account from seed

from lto.accounts.account_factory import AccountFactory

account = AccountFactory(chain_id).create_from_seed(seed)

Create an account from public key

from lto.accounts.account_factory import AccountFactory

account = AccountFactory(chain_id).create_from_public_key(public_key)

Create an account from private key

from lto.accounts.account_factory import AccountFactory

account = AccountFactory(chain_id).create_from_private_key(private_key)

Executing Transactions:

First a transaction needs to be created:

Ex Transfer Transaction

from src.LTO.Transactions.Transfer import Transfer
transaction = Transfer(recipient, amount)

The Transaction needs then to be signed.
In order to sign a transaction an account is needed (check at the beginning of the page the steps to create an account).

Ex of signinig a transaction

transaction.sign_with(account)

For last the transaction needs to be broadcasted to the node.
In order to do so we need to connect to the node using the PublicNode class.

from src.LTO.PublicNode import PublicNode
node = PublicNode(url)

The url refers to the node, there are many nodes available, here there are two examples, one for the MainNet and one for the TestNet

https://nodes.lto.network
https://testnet.lto.network

Ex of broadcasting a transaction

transaction.broadcast_to(node)

Transactions

Transfer Transaction

from src.lto.transactions.transfer import Transfer

transaction = Transfer(recipient, amount)

Mass Transfer Transaction

from src.lto.transactions.mass_transfer import MassTransfer

transaction = MassTransfer(transfers)

Anchor Transaction

import Anchor

transaction = Anchor(anchor)

Lease Transaction

from src.lto.transactions.lease import Lease

transaction = Lease(recipient, amount)

Cancel Lease Transaction

from src.lto.transactions.cancel_lease import CancelLease

transaction = CancelLease(lease_id)

SetScript Transaction

from src.lto.transactions.set_script import SetScript

transaction = SetScript(script)

Sponsorship transaction

from src.lto.transactions.sponsorship import Sponsorship

transaction = Sponsorship(recipient)

Cancel Sponsorship transaction

from src.lto.transactions.cancel_sponsorship import CancelSponsorship

transaction = CancelSponsorship(recipient)

Association transaction

from src.lto.transactions.association import Association

transaction = Association(recipient, association_type, anchor)

Revoke Association transaction

from src.lto.transactions.revoke_association import RevokeAssociation

transaction = RevokeAssociation(recipient, association_type, anchor)

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

lto-1.1.1.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

lto-1.1.1-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file lto-1.1.1.tar.gz.

File metadata

  • Download URL: lto-1.1.1.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for lto-1.1.1.tar.gz
Algorithm Hash digest
SHA256 dbae45816e9cc989bb1f66d0c1b19fe018f07071faf9163324b340e7f161ec73
MD5 7143970f009e0e02d6811686d0e921dc
BLAKE2b-256 7537af1eed244cb558e1156bc432c940f77f3d3e63a26b11ae97daf207d7630e

See more details on using hashes here.

File details

Details for the file lto-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: lto-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 35.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for lto-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea8dfcb1ac80f1bf05f9bf52673e012a28a1bb1ed060354753b8016abb6c392f
MD5 9913bab41baa4276a7a1d8d430dcd746
BLAKE2b-256 38f2eb61273b3588c28f424a25c02a5bb0a8069d810b617b2ece82cc3c89cf46

See more details on using hashes here.

Supported by

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