Reputation: 167
I have been struggling to automate the process of swapping tokens on Neutron chain, but haven't got any luck so far. For ease of understanding, I want to swap from NTRN to ASTRO. I know there's a python library cosmpy
that can handle this but I don't know where to start. I have tried to implement their documentation for Fetch network but for some reasons it's not working for Neutron. I can connect to the network and fetch token balances using the following script.
from cosmpy.aerial.client import LedgerClient, NetworkConfig
cfg = NetworkConfig(
chain_id="neutron-1",
url="grpc+https://neutron-grpc.publicnode.com:443",
fee_denomination="untrn",
staking_denomination="untrn",
fee_minimum_gas_price=0.0053,
)
ledger = LedgerClient(cfg=cfg)
balances = ledger.query_bank_all_balances('neutron1xfe27dm62f8lmdtcmltcyxaw6knsa9llcuz7ar')
I'd appreciate if someone could help with the process of swapping tokens. Thanks!
Upvotes: 0
Views: 31