LTO Network Python API
Project description
lto-api.python
Python client library for interacting with LTO Network
Accounts
Create an account
The chainId is 'L' for the MainNet and 'T' TestNet
from src.LTO.AccountFactory import AccountFactory
account = AccountFactory(chainId).create()
Create an account from seed
from src.LTO.AccountFactory import AccountFactory
account = AccountFactory(chaindId).createFromSeed(seed)
Create an account from public key
from src.LTO.AccountFactory import AccountFactory
account = AccountFactory(chainId).createFromPublicKey(publicKey)
Create an account from private key
from src.LTO.AccountFactory import AccountFactory
account = AccountFactory(chainId).createFromPrivateKey(privateKey)
Executing Transactions:
First a transaction needs to be created:
Ex Transfer Transaction
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 (check at the beginning of the page the steps to create an account).
Ex of signinig a transaction
transaction.signWith(account)
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
https://nodes.lto.network
https://testnet.lto.network
Ex of broadcasting a transaction
transaction.broadcastTo(node)
Transactions
Transfer Transaction
from src.LTO.Transactions.Transfer import Transfer
transaction = Transfer(recipient, amount)
Mass Transfer Transaction
from src.LTO.Transactions.MassTransfer import MassTransfer
transaction = MassTransfer(transfers)
Anchor Transaction
import Anchor
transaction = Anchor(anchor)
Lease Transaction
from src.LTO.Transactions.Lease import Lease
transaction = Lease(recipient, amount)
Cancel Lease Transaction
from src.LTO.Transactions.CancelLease import CancelLease
transaction = CancelLease(leaseId)
SetScript Transaction
from src.LTO.Transactions.SetScript import SetScript
transaction = SetScript(script)
Sponsorship transaction
from src.LTO.Transactions.Sponsorship import Sponsorship
transaction = Sponsorship(recipient)
Cancel Sponsorship transaction
from src.LTO.Transactions.CancelSponsorship import CancelSponsorship
transaction = CancelSponsorship(recipient)
Association transaction
from src.LTO.Transactions.Association import Association
transaction = Association(recipient, associationType, anchor)
Revoke Association transaction
from src.LTO.Transactions.RevokeAssociation import RevokeAssociation
transaction = RevokeAssociation(recipient, associationType, anchor)
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
Built Distribution
File details
Details for the file lto-0.0.10.tar.gz
.
File metadata
- Download URL: lto-0.0.10.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b53bed6f95fac8ab893e66c8853bd869f39e7138ac1d5ef869af58937f89332 |
|
MD5 | b565f144158011eac66a046d8d95144f |
|
BLAKE2b-256 | 107cf6d7e8a20296eb83163f8f6a889d34195f1d8b623ae5a54580d91e209e8c |
File details
Details for the file lto-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: lto-0.0.10-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3b8f2f7f42e1324de30af1ca7f7553474215691dd03c26284968563b62a6257 |
|
MD5 | 70f35ce12850425ec5fc235cf35b3fe2 |
|
BLAKE2b-256 | 3a2490baf587c1a7e2d15e4d6e9bdd8173a8c3abcbee0ba0646a44dcf1a9fa98 |