terra-money / terra.py

Python SDK for Terra
https://terra-money.github.io/terra.py/
MIT License
132 stars 102 forks source link

I am getting error : terra_sdk.exceptions.LCDResponseError: Status 401 - chain-id required but not specified #16

Closed ssenathi closed 3 years ago

ssenathi commented 3 years ago

Description

Using LocalTerra , Station connected and all looks OK. Latest Terra and Latest CosmWasm template.

When i try to upload a sample contract it was throwing the error in the create_and_sign_tx method

Status 401 - chain-id required but not specified

test_contract_wasm is the cosmwasm template.

What I Did

terra = LocalTerra() test1 = terra.wallets["test1"] contract_file = open("./test_contract.wasm", "rb") file_bytes = base64.b64encode(contract_file.read()).decode() store_code = MsgStoreCode(test1.key.acc_address, file_bytes) store_code_tx = test1.create_and_sign_tx(msgs=[store_code]) store_code_tx_result = terra.tx.broadcast(store_code_tx) print(store_code_tx_result)

Traceback (most recent call last): File "contract.py", line 11, in store_code_tx = test1.create_and_sign_tx(msgs=[store_code]) File "/home/ssenathi/.local/lib/python3.8/site-packages/terra_sdk/client/lcd/wallet.py", line 136, in create_and_sign_tx self.create_tx( File "/home/ssenathi/.local/lib/python3.8/site-packages/terra_sdk/client/lcd/wallet.py", line 93, in create_tx return self.lcd.tx.create( File "/home/ssenathi/.local/lib/python3.8/site-packages/terra_sdk/client/lcd/api/_base.py", line 29, in decorator return instance._run_sync(async_call(instance, *args, kwargs)) File "/home/ssenathi/.local/lib/python3.8/site-packages/terra_sdk/client/lcd/api/_base.py", line 13, in _run_sync return self._c.loop.run_until_complete(coroutine) File "/home/ssenathi/.local/lib/python3.8/site-packages/nest_asyncio.py", line 70, in run_until_complete return f.result() File "/usr/lib/python3.8/asyncio/futures.py", line 178, in result raise self._exception File "/usr/lib/python3.8/asyncio/tasks.py", line 280, in __step result = coro.send(None) File "/home/ssenathi/.local/lib/python3.8/site-packages/terra_sdk/client/lcd/api/tx.py", line 67, in create self.estimate_fee(tx, gas_prices, gas_adjustment, fee_denoms) File "/home/ssenathi/.local/lib/python3.8/site-packages/terra_sdk/client/lcd/api/_base.py", line 29, in decorator return instance._run_sync(async_call(instance, *args, *kwargs)) File "/home/ssenathi/.local/lib/python3.8/site-packages/terra_sdk/client/lcd/api/_base.py", line 13, in _run_sync return self._c.loop.run_until_complete(coroutine) File "/home/ssenathi/.local/lib/python3.8/site-packages/nest_asyncio.py", line 70, in run_until_complete return f.result() File "/usr/lib/python3.8/asyncio/futures.py", line 178, in result raise self._exception File "/usr/lib/python3.8/asyncio/tasks.py", line 280, in __step result = coro.send(None) File "/home/ssenathi/.local/lib/python3.8/site-packages/terra_sdk/client/lcd/api/tx.py", line 126, in estimate_fee res = await self._c._post("/txs/estimate_fee", data) File "/home/ssenathi/.local/lib/python3.8/site-packages/terra_sdk/client/lcd/lcdclient.py", line 255, in _post result = await super()._post(args, kwargs) File "/home/ssenathi/.local/lib/python3.8/site-packages/terra_sdk/client/lcd/lcdclient.py", line 110, in _post raise LCDResponseError(message=result.get("error"), response=response) terra_sdk.exceptions.LCDResponseError: Status 401 - chain-id required but not specified

hanjukim commented 3 years ago

The latest LocalTerra is compatible with bombay(columbus-5) network. You need to git checkout v0.4.1. Sorry for the inconvenience.