No project description provided
Project description
Pytoncenter
Introduction
Pytoncenter is a TON Center client with type hints that introduces advanced features such as address subscriptions, obtaining transaction flows similar to TON Viewer, parallel processing of multiple calls, and robust debug tools. Developers can use this package to create TON data analysis platforms, Dapp backends, and other services with enhanced functionality and efficiency.
Quick Start
1. Install the package
To get started, install Pytoncenter using pip:
pip3 install pytoncenter
2. Obtain a Transaction Flow
The following example demonstrates how to obtain the transaction flow for a specified transaction. This transaction is associated with a contract deployed using the TON Dynasty Contract Jetton Template.
- Contract Address on Testnet TON Viewer
- JettonMint Message Transaction on Testnet TON Viewer
from pytoncenter import AsyncTonCenterClient, Address
import asyncio
import json
from pytoncenter.debug import pretty_print_trace_tx, create_named_mapping_func
async def main():
# Initialize the client and query a transaction
client = AsyncTonCenterClient(network="testnet")
txs = await client.get_transactions(address="kQAreQ23eabjRO5glLCbhZ4KxQ9SOIjtw2eM2PuEXXhIZeh3", hash="Lomkyzxh1WBkxvxZ3cJNS2bAYIPC7dPZA67wDomGM4U=", limit=1)
tx = txs[0]
# Pretty print the transaction trace with name mapping for addresses
named_func = create_named_mapping_func(
{
Address("EQC8zFHM8LCMp9Xs--w3g9wmf7RwuDgJcQtV-oHZRSCqQZ__"): "Alan WalletV4R2",
Address("0:2b790db779a6e344ee6094b09b859e0ac50f523888edc3678cd8fb845d784865"): "Jetton Master",
Address("kQC40ScRg9_1ob5sjWsdScltrCGu0HARsUnOYQ1esc12588C"): "Jetton Wallet",
},
truncate_address=True,
)
pretty_print_trace_tx(tx, named_func=named_func)
if __name__ == "__main__":
asyncio.run(main())
Full Examples
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
Hashes for pytoncenter-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05cf84d7017bd1e57f8c3a4370efbaa37876c456b83d10807f63ea415169d8ac |
|
MD5 | 86bb562d45ab1c9c35bd0034c676974b |
|
BLAKE2b-256 | 6ab3e3e7d2fa5622408bdb2e2d78ae086e3d4eb7b6f5400326e4a231f35a76c3 |