Skip to main content

LTO Network Python API

Project description

LTO github readme

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)

Here is the updated README.md section with the missing transaction types added: Genesis, MappedAnchor, Statement, and Certificate:


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)

Mapped Anchor Transaction

from lto.transactions import MappedAnchor

transaction = MappedAnchor(anchor_map)

Lease Transaction

from lto.transactions import Lease

transaction = Lease(recipient, amount)

Cancel Lease Transaction

from lto.transactions import CancelLease

transaction = CancelLease(lease_id)

Set Script 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)

Statement Transaction

from lto.transactions import Statement

transaction = Statement(statement_type, recipient, subject, data_entries)

Certificate Transaction

from lto.transactions import Certificate

transaction = Certificate(pem_or_der)

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

Uploaded Source

Built Distribution

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

lto-1.5.1-py3-none-any.whl (38.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lto-1.5.1.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for lto-1.5.1.tar.gz
Algorithm Hash digest
SHA256 b9692091cac5dbb4b044b012cb201d38917d69a3a1b135513bc9cf025def334a
MD5 1aa834a6cfcf09c1f4a258da56a3fc64
BLAKE2b-256 f6894959fba32959420f39ae1e73391c059dbf818237949662943d6c66f37344

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lto-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for lto-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10d864aa3fe201cb78a37e77e39ee9d5649219b9aca6819440d9dae8affb4b3f
MD5 5d6c74dd4a918d3176976a822d45c93c
BLAKE2b-256 78711146d6758eaed95aaf9654195303650311fe6094f6e292e064bb3d0ea36e

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