Skip to main content

TON Blockchain DeDust SDK

Project description

agton-dedust

from os import getenv

from agton.ton import ToncenterClient, Address, to_nano
from agton.wallet import WalletV3R2
from agton.dedust import Factory, NativeVault
import agton.dedust.types.asset as Asset


mnemonic = getenv('WALLET_MNEMONIC')
assert mnemonic is not None

provider = ToncenterClient(net='mainnet')
my_wallet = WalletV3R2.from_mnemonic(provider, mnemonic)

usdt = Asset.Jetton(Address.parse('EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs'))
ton = Asset.Native()

factory = Factory.from_mainnet(provider)

ton_usdt_pool = factory.get_pool(ton, usdt)
ton_vault = factory.get_vault(ton)

assert isinstance(ton_vault, NativeVault)

swap_message = ton_vault.create_swap_message(
    value=to_nano(0.5),
    query_id=0,
    amount=to_nano(0.05),
    swap_step=ton_usdt_pool.pack_swap_step(limit=0),
    recepient_addr=my_wallet.address
)

# my_wallet.send(swap_message)

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

agton_dedust-0.2.5.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

agton_dedust-0.2.5-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file agton_dedust-0.2.5.tar.gz.

File metadata

  • Download URL: agton_dedust-0.2.5.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for agton_dedust-0.2.5.tar.gz
Algorithm Hash digest
SHA256 97f3e0c007a5a555956f39d0e0596f6fe92ea7e2d2d6606d3e3eccde6ce1d25e
MD5 082d52cc20ea4b88fc65750cef3a3e17
BLAKE2b-256 0feca918e3d40d6c2f79c8a4ba7106c1dce3ae9c367f8e0baddabc6cf900ec8f

See more details on using hashes here.

File details

Details for the file agton_dedust-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: agton_dedust-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for agton_dedust-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 90262945fd23f65be096c0055242a50659b62e7b76435f22e75bc1d4ed9c1e13
MD5 20e75c5f7c6c2c677563992a7e7425ec
BLAKE2b-256 ecb3ef014968b6daa29ad9d27692511c224e67d0374bf78b0a0aa89fa36bafc5

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