DeDust - DeDust SDK for Python.
Project description
DeDust SDK for Python
Analogue of DeDust SDK for Python.
Description
You can swap tokens, deposit liquidity and many more.
Getting Started
Dependencies
- pytoniq
Installing
pip install dedust
Using
Example of buying $SCALE using SDK.
from dedust import Asset, Factory, PoolType, SwapParams, VaultNative
from pytoniq import WalletV4R2, LiteBalancer
import asyncio
import time
mnemonics = ["your", "mnemonics", "here"]
async def main():
provider = LiteBalancer.from_mainnet_config(1)
await provider.start_up()
wallet = await WalletV4R2.from_mnemonic(provider=provider, mnemonics=mnemonics)
SCALE_ADDRESS = "EQBlqsm144Dq6SjbPI4jjZvA1hqTIP3CvHovbIfW_t-SCALE"
TON = Asset.native()
SCALE = Asset.jetton(SCALE_ADDRESS)
pool = await Factory.get_pool(pool_type=PoolType.VOLATILE,
assets=[TON, SCALE],
provider=provider)
swap_params = SwapParams(deadline=int(time.time() + 60 * 5),
recipient_address=wallet.address)
swap_amount = int(float(input("Enter swap amount: ")) * 1e9)
swap = VaultNative.create_swap_payload(amount=swap_amount,
pool_address=pool.address,
swap_params=swap_params)
swap_amount = int(swap_amount + (0.25*1e9)) # 0.25 = gas_value
await wallet.transfer(destination="EQDa4VOnTYlLvDJ0gZjNYm5PXfSmmtL6Vs6A_CZEtXCNICq_", # native vault
amount=swap_amount,
body=swap)
asyncio.run(main())
Authors
Version History
- 1.1.4
- Fixed
estimate_deposit_out
get method
- Fixed
- 1.1.2
- Update examples, fix bug with VaultNative
- 1.1.1
- Removed httpx from dependencies
- 1.1.0
- Change tonsdk to pytoniq
- 1.0.5
- Changes
- 1.0.4
- Bug fix
- 1.0.3
- Fixes
- 1.0.2
- Fixes and changes
- 1.0.1
- Small fix
- 1.0.0
- Remake to DeDust SDK analogue
- 0.0.5
- License change
- 0.0.4
- Dependecies fix
- 0.0.3
- Examples fix
- 0.0.2
- LP token address getting
- 0.0.1
- Initial Beta
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Donate
If you like the library, I will be glad to accept donations.
- TON: EQCgphx8rTI0PukwmgpVqiPgqguTujhQscg2h7jgc4U0t347
Acknowledgments
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
dedust-1.1.4.tar.gz
(9.2 kB
view details)
Built Distribution
File details
Details for the file dedust-1.1.4.tar.gz
.
File metadata
- Download URL: dedust-1.1.4.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25969563aa8d86546b2beb344f690a5b8df9e2899c420ec33addd861acea8eaf |
|
MD5 | ddbdac9453bec45bb489b2fd2d8d6a22 |
|
BLAKE2b-256 | 17562650b26a89e882e87f2578562071f26b8b0815bc842b9db36e94b126b131 |
File details
Details for the file dedust-1.1.4-py2.py3-none-any.whl
.
File metadata
- Download URL: dedust-1.1.4-py2.py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 769b61ea2635d691659376ab30bd63645c292a98209bd76f252f1924d8b4e4d2 |
|
MD5 | 3adcce7e372e17b69cdbb557c6f7e78a |
|
BLAKE2b-256 | 9441a1a4edabd6b05cb8870edbe9cf41aba8416b9a3acc18ff0a41af5280daff |