CosmWasm / wasmd

Basic cosmos-sdk app with web assembly smart contracts
Other
369 stars 404 forks source link

tx wasm upload --block flag #1897

Open stongo opened 5 months ago

stongo commented 5 months ago

We're having an issue with v0.51.0 (also tested previous versions) where the -b or --block flag don't appear to work. We've tested putting the flag in different argument positions, to no effect.

For example:

wasmd tx wasm upload  /app/asc.wasm --from <redacted> --chain-id testing  --gas-prices 0.25ucosm --gas auto --gas-adjustment 1.3 -y --output json -b sync

Yields a response like:

{"height":"0","txhash":"<redacted>","codespace":"","code":0,"data":"","raw_log":"","logs":[],"info":"","gas_wanted":"0","gas_used":"0
","tx":null,"timestamp":"","events":[]} 

I would expect those fields to be populated, as in the documentation https://docs.cosmwasm.com/docs/getting-started/interact-with-contract/

Please advise how to make synchronous calls. It's quite important to our automation.

chipshort commented 3 months ago

That's because the docs use -b block, which is deprecated now. -b sync only performs some checks on the transaction, but does not wait until it is included into a block on chain.

When you use -b sync, you get the transaction hash and can poll to figure out if it is available. Here's how it is done in cosmjs: https://github.com/cosmos/cosmjs/blob/e819a1fc0e99a3e5320d8d6667a08d3b92e5e836/packages/stargate/src/stargateclient.ts#L424 For polling on the command line, wasmd q tx --type=hash YOUR_HASH will probably get you further.