/cosmos/gov/v1/proposals/{proposal_id}/votes/{voter} REST API Endpoint
This method only works while the proposal is active
路徑參數
proposal_id
字串
必填
載入中...
voter
字串
必填
載入中...
退貨
vote
物件
載入中...
proposal_id
字串
載入中...
voter
字串
載入中...
選項
字串
載入中...
選項
陣列
載入中...
選項
字串
載入中...
weight
字串
載入中...
請求
1curl --location 'https://docs-demo.celestia-mainnet.quiknode.pro/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter_id}'
1curl --location 'https://docs-demo.celestia-mainnet.quiknode.pro/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter_id}'
1package main23import (4"context"5gov "cosmossdk.io/api/cosmos/gov/v1beta1"6"fmt"7"google.golang.org/grpc"8"log"9)1011func main() {12endpoint := "YOUR_QUICKNODE_ENDPOINT"13target, opts := getGrpcOptions(endpoint)14grpcConn, err := grpc.Dial(target, opts...)15if err != nil {16log.Fatal(err)17}18defer grpcConn.Close()1920governance := gov.NewQueryClient(grpcConn)2122proposalID := uint64(proposal_id)23voter := "voter_id"2425resp, err := governance.Vote(context.Background(), &gov.QueryVoteRequest{26ProposalId: proposalID,27Voter: voter,28})29if err != nil {30log.Fatal(err)31}3233fmt.Printf("Vote on proposal %d by %s: %s\n",34resp.GetVote().ProposalId,35resp.GetVote().Voter,36resp.GetVote().GetOption())37}
1package main23import (4"context"5gov "cosmossdk.io/api/cosmos/gov/v1beta1"6"fmt"7"google.golang.org/grpc"8"log"9)1011func main() {12endpoint := "YOUR_QUICKNODE_ENDPOINT"13target, opts := getGrpcOptions(endpoint)14grpcConn, err := grpc.Dial(target, opts...)15if err != nil {16log.Fatal(err)17}18defer grpcConn.Close()1920governance := gov.NewQueryClient(grpcConn)2122proposalID := uint64(proposal_id)23voter := "voter_id"2425resp, err := governance.Vote(context.Background(), &gov.QueryVoteRequest{26ProposalId: proposalID,27Voter: voter,28})29if err != nil {30log.Fatal(err)31}3233fmt.Printf("Vote on proposal %d by %s: %s\n",34resp.GetVote().ProposalId,35resp.GetVote().Voter,36resp.GetVote().GetOption())37}
1const myHeaders = new Headers();2myHeaders.append("Accept", "*/*");34const requestOptions = {5方法: "GET",6標題: myHeaders,7重定向: 「追蹤」8};910fetch("https://docs-demo.celestia-mainnet.quiknode.pro/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter_id}", requestOptions)11.接著((回應) => 回應.文字())12.接著((結果) => 控制台.log(結果))13.catch((錯誤) => 控制台.錯誤(錯誤));
1const myHeaders = new Headers();2myHeaders.append("Accept", "*/*");34const requestOptions = {5方法: "GET",6標題: myHeaders,7重定向: 「追蹤」8};910fetch("https://docs-demo.celestia-mainnet.quiknode.pro/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter_id}", requestOptions)11.接著((回應) => 回應.文字())12.接著((結果) => 控制台.log(結果))13.catch((錯誤) => 控制台.錯誤(錯誤));
1匯入 請求23url = "https://docs-demo.celestia-mainnet.quiknode.pro/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter_id}"45有效載荷 = {}6標題 = {7'Accept': '*/*'8}910回應 = 請求.請求("GET", url, headers=headers, data=有效載荷)1112列印(回應.text)13
1匯入 請求23url = "https://docs-demo.celestia-mainnet.quiknode.pro/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter_id}"45有效載荷 = {}6標題 = {7'Accept': '*/*'8}910回應 = 請求.請求("GET", url, headers=headers, data=有效載荷)1112列印(回應.text)13
1需要 "uri"2需要 "net/http"34url = URI("https://docs-demo.celestia-mainnet.quiknode.pro/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter_id}")56https = 網::HTTP.new(url.主機, url.port)7https.use_ssl = true89請求 = 淨::HTTP::Get.new(url)10request["Accept"] = "*/*"1112回應 = https.請求(請求)13將回應。read_body14
1需要 "uri"2需要 "net/http"34url = URI("https://docs-demo.celestia-mainnet.quiknode.pro/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter_id}")56https = 網::HTTP.new(url.主機, url.port)7https.use_ssl = true89請求 = 淨::HTTP::Get.new(url)10request["Accept"] = "*/*"1112回應 = https.請求(請求)13將回應。read_body14