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 chainId is 'L' for the MainNet and 'T' TestNet

from src.LTO.AccountFactory import AccountFactory

account = AccountFactory(chainId).create()

Create an account from seed

from src.LTO.AccountFactory import AccountFactory

account = AccountFactory(chaindId).createFromSeed(seed)

Create an account from public key

from src.LTO.AccountFactory import AccountFactory

account = AccountFactory(chainId).createFromPublicKey(publicKey)

Create an account from private key

from src.LTO.AccountFactory import AccountFactory

account = AccountFactory(chainId).createFromPrivateKey(privateKey)

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.signWith(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.broadcastTo(node)

Transactions

Transfer Transaction

from src.LTO.Transactions.Transfer import Transfer

transaction = Transfer(recipient, amount)

Mass Transfer Transaction

from src.LTO.Transactions.MassTransfer 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.CancelLease import CancelLease

transaction = CancelLease(leaseId)

SetScript Transaction

from src.LTO.Transactions.SetScript import SetScript

transaction = SetScript(script)

Sponsorship transaction

from src.LTO.Transactions.Sponsorship import Sponsorship

transaction = Sponsorship(recipient)

Cancel Sponsorship transaction

from src.LTO.Transactions.CancelSponsorship import CancelSponsorship

transaction = CancelSponsorship(recipient)

Association transaction

from src.LTO.Transactions.Association import Association

transaction = Association(recipient, associationType, anchor)

Revoke Association transaction

from src.LTO.Transactions.RevokeAssociation import RevokeAssociation

transaction = RevokeAssociation(recipient, associationType, 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-0.0.3.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

lto-0.0.3-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lto-0.0.3.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for lto-0.0.3.tar.gz
Algorithm Hash digest
SHA256 363180c71e2518ff560c1d5bd2e82ad3bc4a15873ccde1442ecf8f505a2805c5
MD5 d45e535192c87148812b648af8eaa1a5
BLAKE2b-256 74d3e5a162fd9499528d7752f36a4b9381a211c688ffac459e8038b1cabf91a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lto-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for lto-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5e0de2cdaa0b8ebe5048ae5871169977abde9e2d58c272ad5e4835a869119dd4
MD5 96fd5823f76ebc1a317609d1dd8ad0ed
BLAKE2b-256 e9e96ca4f0effc0fcf992c0b092c4f23b58367fa96eabb16e8f1c53fffb1bc77

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