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

How to vote with cosmosjs #1575

Open
laohe-adam opened this issue Mar 29, 2024 · 1 comment
Open

How to vote with cosmosjs #1575

laohe-adam opened this issue Mar 29, 2024 · 1 comment

Comments

@laohe-adam
Copy link

const result = await signingClient.signAndBroadcast(

            address,

            [
                {
                    typeUrl: "/cosmos.gov.v1beta1.MsgVote",
                     value: {
                        proposalId:895,
                        voter: i,
                        option:1,
                        //amount: { denom: "uatom", amount: 0, },
                    },
                    },
            ],
            "auto"
                
            )
        
                // Output the result of the Tx
                console.log("Transfer result:", result)
```
/ how to fix it
```
With signing client, chain id: cosmoshub-4 , height: 19756249
Error: Broadcasting transaction failed with code 11 (codespace: sdk). Log: out of gas in location: WriteFlat; gasWanted: 43121, gasUsed: 43494: out of gas
    at SigningStargateClient.broadcastTx (d:\deskbokk\cosmjs-sandbox-master\node_modules\@cosmjs\stargate\src\stargateclient.ts:386:9)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runAll (d:\deskbokk\cosmjs-sandbox-master\投.ts:64:24)
@seleniumforest
Copy link

https://atmoner.github.io/cosmjs-examples/broadcast/gov/MsgVote.html

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

No branches or pull requests

2 participants