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.ed25519 import AccountFactory

account = AccountFactory(chain_id).create()

Create an account from seed

from lto.accounts.ed25519 import AccountFactory

account = AccountFactory(chain_id).create_from_seed(seed)

Create an account from public key

from lto.accounts.ed25519 import AccountFactory

account = AccountFactory(chain_id).create_from_public_key(public_key)

Create an account from private key

from lto.accounts.ed25519 import AccountFactory

account = AccountFactory(chain_id).create_from_private_key(private_key)

Executing Transactions

Create transaction

First a transaction needs to be created.

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.

Sign transaction

transaction.sign_with(account)

Broadcast transaction

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

transaction.broadcast_to(node)

Transactions

Transfer Transaction

from lto.transactions import Transfer

transaction = Transfer(recipient, amount)

Mass Transfer Transaction

from lto.transactions import MassTransfer

transaction = MassTransfer(transfers)

Anchor Transaction

from lto.transactions import Anchor

transaction = Anchor(anchor)

Lease Transaction

from lto.transactions import Lease

transaction = Lease(recipient, amount)

Cancel Lease Transaction

from lto.transactions import CancelLease

transaction = CancelLease(lease_id)

SetScript Transaction

from lto.transactions import SetScript

transaction = SetScript(script)

Sponsorship transaction

from lto.transactions import Sponsorship

transaction = Sponsorship(recipient)

Cancel Sponsorship transaction

from lto.transactions import CancelSponsorship

transaction = CancelSponsorship(recipient)

Association transaction

from lto.transactions import Association

transaction = Association(recipient, association_type, anchor)

Revoke Association transaction

from lto.transactions 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.2.5.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

lto-1.2.5-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lto-1.2.5.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for lto-1.2.5.tar.gz
Algorithm Hash digest
SHA256 b3f21c1bf79de418055670b6bd7decf761ebbb2325bd3ea9e079ab04f8f2f513
MD5 ce313a8f5ffd048e1c42d1f41440e428
BLAKE2b-256 5041cc275229066b365584993d49158c5bd33cc63ccab79051eee93eeb187698

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lto-1.2.5-py3-none-any.whl
  • Upload date:
  • Size: 36.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for lto-1.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cbaba96f46bbf6fd7499c77a713ed4337971cff99d6ccd1da30233abb73354cd
MD5 8923809b8386fdda84d419b9901911cc
BLAKE2b-256 5881c129490a150903d550cd1bb053cd80118de3431b7dea4c34f3fb88901483

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