pytoniq_defi
is an extension of the pytoniq library that focuses on DeFi (Decentralized Finance) operations in the TON network. It helps parse and compose various messages related to Jetton transfers, liquidity provision, staking, and more.
- Parse Jetton messages like transfers, burn, notifications, and internal transfers.
- Compose valid TON messages for DEX operations, liquidity deposits, and staking.
- Offers typed classes (e.g.,
JettonTransfer
,DedustMessageSwap
) that serialize/deserialize seamlessly to/from TON cells.
pip install pytoniq_defi
from pytoniq_code import Address
from pytoniq_defi import Jetton, Dedust, Stonfi, StonfiV2
# Example: Creating a Jetton Transfer message
transfer = Jetton.Transfer(query_id=1, amount=1000, destination=Address("UQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJKZ"))
cell = transfer.serialize()
# Example: Deserializing Dedust Swap
deserialized_swap = Dedust.Swap.deserialize(cell.begin_parse())
- Fork the repository.
- Create a new branch.
- Submit a pull request with details on your changes.
This project is licensed under the MIT License. See LICENSE for details.