Skip to main content

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.

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())

You may get the following output in the console:

Alan WalletV4R2 -> Jetton Master (Mint:1) [1.0 TON]
└── Jetton Master -> Jetton Wallet (0x178d4519) [0.955002 TON]
    └── Jetton Wallet -> Alan WalletV4R2 (0xd53276db) [0.853806 TON]

Full Examples

  1. Get Transaction Flows
  2. Decode Jetton Get Method Result
  3. Decode Custom Get Method Result
  4. Execute Parallelly
  5. Subscribe transactions for address
  6. Address Parser

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytoncenter-0.0.4.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytoncenter-0.0.4-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file pytoncenter-0.0.4.tar.gz.

File metadata

  • Download URL: pytoncenter-0.0.4.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.0 Linux/6.2.0-1019-azure

File hashes

Hashes for pytoncenter-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7b38b2ae865db8d2a4cd51387ca52a28891b2c59d7609734099bc7042da02042
MD5 9886cc1a4442d2c2efbea345f1c2d5bd
BLAKE2b-256 07bad105a16152258f9c934184a4f99ab9ee747497e81cb8f3ffe7266b3bcc90

See more details on using hashes here.

File details

Details for the file pytoncenter-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pytoncenter-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.0 Linux/6.2.0-1019-azure

File hashes

Hashes for pytoncenter-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 517665314b5bb01222dc17c8f09012e5ffe6e56c9c846f44180d872285fe3888
MD5 37fa03538065b44ae6990161f68b52cf
BLAKE2b-256 903e606b438a79496fec2b128176147efb878972b6ee240f4c19aa6c8bb01e45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page