semvec/pypi-packages huggingface dataset:
agton-dedust 0.2.4
TON Blockchain DeDust SDK
License: MIT
Requires Python: >=3.12

# agton-dedust

```python
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)
```
agton-wallet 0.2.4
TON Blockchain wrappers for wallets contracts
License: MIT
Requires Python: >=3.12

# agton-wallet

```python
import os
from time import time
from agton.ton import ToncenterClient, MessageRelaxed, Address, to_nano, comment
from agton.wallet import WalletV3R2

mnemonic = os.environ["WALLET_MNEMONIC"]
provider = ToncenterClient(net="testnet") # pass api_key=... if you have one

wallet = WalletV3R2.from_mnemonic(provider, mnemonic)
message = MessageRelaxed.internal(
    value=to_nano(0.1),
    dest=Address.parse('0QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACkT'),
    body=comment('Hello! Привет! 你好! agton 🚀')
)

wallet.send(message)
# ^ Line above is actually just a shortcut for manual message crafting

# Here is manual crafting
signed_external = wallet.create_signed_external(
    messages_with_modes=[(message, 3)],
    valid_until=int(time()) + 3 * 60,
    seqno=wallet.seqno() 
)

# Now you can send it or do whatever with it
# provider.send_external_message(signed_external)
```
agton-jetton 0.2.4
TON Blockchain jetton wrappers, implementation of TEP-74
License: MIT
Requires Python: >=3.12

# agton-jetton

```python
import os
from agton.ton import ToncenterClient, Address, to_nano, comment
from agton.jetton import JettonMaster
from agton.wallet import WalletV3R2

mnemonic = os.environ["WALLET_MNEMONIC"]
provider = ToncenterClient(net="testnet") # pass api_key=... if you have one

wallet = WalletV3R2.from_mnemonic(provider, mnemonic)
jetton_master = JettonMaster(provider, Address.parse("kQBLdsCM9ksHe22vgPMBN7OScP6z6w8xAsM5AuHldrDT9EwR"))
jetton_wallet = jetton_master.get_jetton_wallet(wallet.address)

message = jetton_wallet.create_jetton_transfer(
    value=to_nano(0.5),                  # native TON to cover forwarding fees
    query_id=0,
    amount=to_nano(777),                 # jetton amount
    destination=wallet.address,
    response_destination=wallet.address,
    forward_amount=to_nano(0.1),
    forward_payload=comment("agton"),
)

wallet.send(message)
```