⚡ MultiversX SmartSend Python SDK: Library for interacting with Smart Send contracts on MultiversX blockchain
Project description
Mx.NET.SDK.SmartSend
⚡ MultiversX SmartSend Python SDK: Library for interacting with Smart Send contracts on MultiversX blockchain
How to install?
The content is delivered via PyPI package:
remarkabletools_mx_smartsend
Main Features
- Create EGLD/Token/MetaESDT/NFT/SFT transactions for Smart Send contracts
Quick start guide
Basic example
provider = ProxyNetworkProvider("https://devnet-gateway.multiversx.com")
account = provider.get_account(Address.from_bech32("MY_ADDRESS"))
network_config = provider.get_network_config()
config = DefaultTransactionBuildersConfiguration(network_config.chain_id)
smart_send = SmartSend(account, config, "MY_CONTRACT_BECH32_ADDRESS")
input_transactions: List[TokenAmount] = []
for i in range(1, 10):
input_transactions.append(TokenAmount("RECEIVER_ADDRESS", TokenPayment.egld_from_amount(f"0.0{i}"))) # TokenPayment can also be fungible_from_amount / meta_esdt_from_amount / non_fungible / semi_fungible
try:
# You can sync the account before creating transactions (to have the latest nonce)
# account = provider.get_account(Address.from_bech32("MY_ADDRESS")) # get account data from network
# smart_send.sync(account) # sync account
txs = smart_send.create_egld_transactions(input_transactions) # or create_token_transactions / create_metaesdt_transactions / create_nft_transactions / create_sft_transactions
# sign and send txs
except Exception as ex:
print(ex)
Advanced example
The following example is using a wallet signer that should not be used in production, only in private!
provider = ProxyNetworkProvider("https://devnet-gateway.multiversx.com")
account = provider.get_account(Address.from_bech32("MY_ADDRESS"))
network_config = provider.get_network_config()
config = DefaultTransactionBuildersConfiguration(network_config.chain_id)
signer = UserSigner.from_pem_file(Path("/path/wallet.pem"))
smart_send = SmartSend(account, config, "MY_CONTRACT_ADDRESS")
input_transactions: List[TokenAmount] = []
for i in range(1, 10):
input_transactions.append(TokenAmount("RECEIVER_ADDRESS", TokenPayment.egld_from_amount(f"0.0{i}")))
try:
txs = smart_send.create_egld_transactions(input_transactions)
for tx in txs:
tx.signature = signer.sign(tx)
response = provider.send_transactions(txs)
print(response)
except Exception as ex:
print(ex)
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
Built Distribution
Close
Hashes for remarkabletools_mx_smartsend-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59b43df8e661fe08285f9a1ac9574b0cb8ba0301bab84cad7af1541538319c8a |
|
MD5 | 792e8ad37ed6cdb52b959f962cd86b6b |
|
BLAKE2b-256 | 77ede2bd952b35eb03e9829c23996e2dfacd54fde99a3e559e26bb725b956824 |
Close
Hashes for remarkabletools_mx_smartsend-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b745dbccdc186ce9d0c498c34d52feed33ce34c92a398fe1082c16b5022186a7 |
|
MD5 | fc58499750986bd975acf6ce89fe56e3 |
|
BLAKE2b-256 | 289b1d67c25309a1bc1b8c0ed9605ed9b6b4df9b0a7342d29be933c01af1978b |