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)

Data transaction

from lto.transactions import Data

transaction = Data(data_entries)

Register transaction

from lto.transactions import Register

transaction = Register(account2, account3)

Burn transaction

from lto.transactions import Burn

transaction = Burn(amount)

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.3.2.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lto-1.3.2.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for lto-1.3.2.tar.gz
Algorithm Hash digest
SHA256 ee19b5f3a00cae434607183f0f0c14ea4aa5290215ee4cceae0106da412e0943
MD5 d9d494fa95d7b1ca28f80fa186bdde05
BLAKE2b-256 2a5ddb7859d1dedac8aa10455ad7ad4cd9f6594c2f8928840114c22ca904b617

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lto-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 36.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for lto-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 56d979641fb54b767d113019cf9c40f264e6a989202259cbd988a4b5bafd5b77
MD5 81999c9f24d85ba8f4c2d6c7240866fc
BLAKE2b-256 69a8d7d95cf2913c66ba7f8b5e6fefe702367f525af51607fc9dbf690505a0fd

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