Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-genarate contract code from ABI #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lcswillems
Copy link
Contributor

@lcswillems lcswillems commented Apr 13, 2023

Auto-generate contract code from ABI. Includes views and endpoints.

To auto-generate contract code:

python3 gen_pair_contract.py abis/pair.abi.json contracts/pair_contract_gen.py

To use the contract code:

from multiversx_sdk_network_providers import ProxyNetworkProvider
from multiversx_sdk_core import Address

from contracts.pair_contract_gen import PairContractInteractor


proxy = ProxyNetworkProvider("https://gateway.multiversx.com")
contract_address = Address.from_bech32("erd1qqqqqqqqqqqqqpgqp5d4x3d263x4alnapwafwujch5xqmvyq2jpsk2xhsy")
interactor = PairContractInteractor(proxy, contract_address)

print(interactor.query_getState())
print(interactor.query_getTokensForGivenPosition(1000))

@lcswillems lcswillems marked this pull request as ready for review April 14, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant