This project has been archived by its maintainers, and is no longer receiving any updates.
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)
Metadata
Release files for lto 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lto-1.5.1.tar.gz | 25.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lto-1.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.8 kB
Release files / lto-1.5.1.tar.gz
| Download URL | lto-1.5.1.tar.gz |
|---|---|
| Size | 25.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9692091cac5dbb4b044b012cb201d38917d69a3a1b135513bc9cf025def334a
|
|
BLAKE2b-256 checksum How to use checksums |
f6894959fba32959420f39ae1e73391c059dbf818237949662943d6c66f37344
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / lto-1.5.1-py3-none-any.whl
| Download URL | lto-1.5.1-py3-none-any.whl |
|---|---|
| Size | 38.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10d864aa3fe201cb78a37e77e39ee9d5649219b9aca6819440d9dae8affb4b3f
|
|
BLAKE2b-256 checksum How to use checksums |
78711146d6758eaed95aaf9654195303650311fe6094f6e292e064bb3d0ea36e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|