web icon indicating copy to clipboard operation
web copied to clipboard

Autogenerated CosmJS Interface hardcodes gas

Open patrickwieth opened this issue 4 years ago • 0 comments

The error i get is: index.js:883 Uncaught (in promise) TxClient:MsgSetItemString:Send: Could not broadcast Tx: Broadcasting transaction failed with code 13 (codespace: sdk). Log: invalid fee provided: null: insufficient fee

This is because the gas fee is too low for the transaction I wanted to do. The used code was generated with starport g vuex. It is actually done with the Pylons blockchain, but I think this does not matter.

image

The screenshot shows the function and I could fix my error by increasing the hardcoded gas fees. I think the proper way would be that the gas fee limits can be piped through in a dispatch like this: .dispatch('Pylonstech.pylons.pylons/sendMsgSetItemString', { value: { '@type': '/Pylonstech.pylons.pylons.MsgSetItemString', creator: this.$store.getters['common/wallet/address'], cookbookID: 'nftarena', ID: this.heroNft.ID, field: 'image', value: compressedImg, }, fee: [ { amount: [], gas_limit: 2000000, payer: "", granter: "" } ] }) the same code but with readability:

image

the fee cannot be set in a dispatched tx, because it is hardcoded

patrickwieth avatar Dec 07 '21 12:12 patrickwieth