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
Release history Release notifications | RSS feed
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.4.1.tar.gz
(24.2 kB
view details)
Built Distribution
lto-1.4.1-py3-none-any.whl
(38.0 kB
view details)
File details
Details for the file lto-1.4.1.tar.gz
.
File metadata
- Download URL: lto-1.4.1.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39c6f6a8f84e7780a86be8b79aa53c246de453afd8212500e4ab610e32d59985 |
|
MD5 | 5a9fc7fee63206f391ad78be36f7cfa7 |
|
BLAKE2b-256 | a81b77bcbc3c25638251a97d44f9c0402cc8c6897ec64b90573c99a15a0d4c4e |
File details
Details for the file lto-1.4.1-py3-none-any.whl
.
File metadata
- Download URL: lto-1.4.1-py3-none-any.whl
- Upload date:
- Size: 38.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dff9b3914b5364ef6dfbedad73b51100b913b185184a543a922d497157cac702 |
|
MD5 | 74e3719c160012455a567eec7b518a59 |
|
BLAKE2b-256 | 96a6bfe55b13d0aa6fdcd1f3387fb834e1389a28269535535bad123dc7327364 |