🏗👷🏾 TronPyTool
Library API for Python on TRX or Tron
Ethereum based all tool chain for smart contract development kit documentation.
Why do we use python
Using it because it is fast and easy. More importantly it runs directly by its own and no more dependencies.
Its much faster to building modules and calling functions on python. Also it can be wrapped into an executable binary on wasm or cpython that runs on natively any platforms.
If you are using PyCharm or similar IDE, all type are ready to show at your finger tips.
Get Started
pip3 install tronpytool
or upgrade using
sudo pip3 install tronpytool --upgrade
The development of tronpytool contract deployment tools:
Setup (for the early version, we are going to setup the workspace manually. )
Setup the folders: /vault /artifact /deploy_history /deploy_results /factoryabi
Why use tron-py-tool
It is a all-in-one package with zero setup and configurations that works for multiple architectures. It is lightweight and simple. Build-in ERC20 support and bulk token sending support. Out of the box that comes with solc-compile automation and web3 executions.
Features
- support most of the evm compatible chains
- golang module compile support
- python module compile support
- typescript module compile support
- tron payment usdt support with simple operation
Examples:
Deployment of the new contract:
# !/usr/bin/env python
# coding: utf-8
import os
Show the amount of your wallet
#!/usr/bin/env python
# coding: utf-8
from tronpytool import Tron
from tronpytool import HttpProvider
tron = Tron().setNetwork('nile')
tron.toSun(1)
# result: 1000000
tron.fromSun(1000000)
# result: 1
Mint Coins
The example for minting coins with 18 decimal
# !/usr/bin/env python
# coding: utf-8
import os
Code Compile
Integration of forge that can work perfectly with latest version with ONE LINE code. In order to use this feature, the required package will need to be installed to the system. Otherwise the error message will show.
- factoryabi (source transpiler for ts and python)
- forge (solidity compiler)
- abigen (golang transpile generator)
- abi-gen-uni (transpiler consumer)
If you are all set, then you are ready to run the following code for example:
# !/usr/bin/env python
# coding: utf-8
import os
from tronpytool import TronBrew, Evm
solidity_files = [
"vault/token/RaceToken.sol",
]
ROOT = '.../Documents/b95/devtron'
FACTORY = '$HOME/Documents/piplines/factoryabi'
print("-----> job from here")
print(ROOT)
print("-----> now its ready to go")
TronBrew(ROOT, FACTORY).setClassSolNames(solidity_files).setEvm(Evm.ISTANBUL).useForge().localTranspile()
Deployment of Contract
Showing some example for the deployment of the source code
Examples:
def getTronReady() -> ContractTool:
# ========================== Of course
wallet_address = "..."
private_key = "..."
# ============== wrapping the contract
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
logger = logging.getLogger()
tron_x = ContractTool(ROOT, "mainnet", wallet_address, private_key)
return tron_x
if __name__ == "__main__":
c = getTronReady()
c.deploy("ClassNameFile", [])
Documentation is ready here
Also there is a brother library for those who works with EVM network.
📦 Showcase your project with this SDK
PR your link or your github repo here.
Donations are welcome
Welcome for donation for the good works!