Skip to main content

Telegram Wallet API

Project description


Logo

Telegram Wallet API

Unofficial library for managing your personal Wallet account

Table Of Contents

About The Project

Send and receive tokens | Trade on P2P Market

Built With

To obtain an authorization token, the "selenium" library is used. Working with the API is implemented using "requests"

Getting Started

pip install pyTelegramWalletApi

Send by address

from wallet import Wallet, Client

# use chromedriver to loging tg and parse auth_token
c = Client(profile='main', headless=True)
auth_token = c.get_token()

w = Wallet(auth_token)
balance = w.get_user_balances('USDT')
print(f'[*] Balance: {balance.available_balance} TON')

w.send_to_address(balance.available_balance, 'USDT', 'UQC_tRAxYGgMuU4sSqN6eRWArwvL4qI3gXn_', network='ton')

Send by username

from wallet import Client, Wallet

c = Client(profile='main', headless=True)

# To send coins within a telegram, you need to receive an “auth_token”
# from Wallet directly in chat with the recipient

auth_token = c.get_token(username='username_to_recieve')
print(c.receiver_id)  # browser parse tg_id by username

w = Wallet(auth_token, log_response=True)
w.send_to_user(amount=1, currency='USDT', receiver_tg_id=c.receiver_id)

Parse P2P market

import time
from wallet import Wallet

w = Wallet.token_from_file('token.txt')  # load token from file method

while True:
    try:
        o = w.get_p2p_market('TON', 'RUB', 'SALE', desired_amount=5000)[0]

        print(f'Top offer ID: {o.id}\n'
              f'Price: {o.price.value} {o.price.quoteCurrencyCode}\n'
              f'Volume: {o.availableVolume} TON\n'
              f'User: {o.user.nickname} | Orders: {o.user.statistics.totalOrdersCount}\n'
              f'=============================')
        """
        Top offer ID: 187885
        Price: 590.0 RUB
        Volume: 30.682475494 TON
        User: Lucky Goose | Orders: 3127
        =============================
        """
        
    except Exception as e:
        print(f"[!] Error: {e}")

    time.sleep(5)

Create own offers

from wallet import Wallet

w = Wallet.token_from_file('token.txt')  # load token from file method
 
new_offer = w.create_p2p_offer(
    comment='Hello',
    currency='TON',
    fiat='RUB',
    amount=10,
    margine=90,
    offer_type='PURCHASE',
    order_min_price=500,
    pay_methods=['tinkoff'],
)

w.activate_p2p_offer(new_offer.id, new_offer.type)

Wallet realised methods

Account methods

get_user_balances(currency)
get_transactions(limit, last_id, crypto_currency, transaction_type, transaction_gateway)
get_wallet(crypto_currency)
get_exchange_pair_info(from_currency, to_currency, from_amount)
get_earn_campings()
test_get_transaction_details(tx_id)
get_user_region_verification()
send_to_address(amount, currency, address, network)
send_to_user(amount, currency, receiver_tg_id)
create_exchange(from_currency, to_currency, from_amount, local_currency)

P2P matket methods

get_own_p2p_user_info()
get_user_p2p_payments()
get_own_p2p_order_history(offset, limit, status)
get_p2p_order(order_id)
get_p2p_rate(base, quote)
get_p2p_payment_methods_by_currency(currency)
create_p2p_offer(currency, amount, fiat, margine, offer_type,
                 order_min_price, pay_methods, comment, price_type,
                 confirm_timeout_tag:)
edit_p2p_offer(currency, offer_id, margine, volume, order_amount_min, comment)
activate_p2p_offer(offer_id, offer_type)
deactivate_p2p_offer(offer_id, offer_type)
enable_p2p_bidding()
disable_p2p_bidding()
get_own_p2p_offers(offset limit, offer_type, status)
get_p2p_offer(offer_id)
get_own_p2p_offer(offer_id)
accept_p2p_order(order_id, offer_type)
get_p2p_market(base_currency_code, quote_currency_code, offer_type, offset, limit,desired_amount)

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

pyTelegramWalletApi-0.2.40.tar.gz (12.3 kB view details)

Uploaded Source

File details

Details for the file pyTelegramWalletApi-0.2.40.tar.gz.

File metadata

  • Download URL: pyTelegramWalletApi-0.2.40.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.5

File hashes

Hashes for pyTelegramWalletApi-0.2.40.tar.gz
Algorithm Hash digest
SHA256 576765e6b971c3b032d43cce2b49129866cc61dfe767cb3356fa837a0561aac2
MD5 d9bfc534d1e4ba520997cd2a480d14bb
BLAKE2b-256 8c7eabc48da6db0e075805a3f2af5fb40beadaa9299b0abbb772601257caa31e

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