github.com/algorand/go-algorand-sdk@v1.24.0/client/v2/algod/getPendingTransactions.go (about) 1 package algod 2 3 import ( 4 "context" 5 6 "github.com/algorand/go-algorand-sdk/client/v2/common" 7 "github.com/algorand/go-algorand-sdk/client/v2/common/models" 8 "github.com/algorand/go-algorand-sdk/types" 9 ) 10 11 // PendingTransactionsParams contains all of the query parameters for url serialization. 12 type PendingTransactionsParams struct { 13 14 // Format configures whether the response object is JSON or MessagePack encoded. 15 Format string `url:"format,omitempty"` 16 17 // Max truncated number of transactions to display. If max=0, returns all pending 18 // txns. 19 Max uint64 `url:"max,omitempty"` 20 } 21 22 // PendingTransactions get the list of pending transactions, sorted by priority, in 23 // decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending 24 // transactions. 25 type PendingTransactions struct { 26 c *Client 27 28 p PendingTransactionsParams 29 } 30 31 // Max truncated number of transactions to display. If max=0, returns all pending 32 // txns. 33 func (s *PendingTransactions) Max(Max uint64) *PendingTransactions { 34 s.p.Max = Max 35 36 return s 37 } 38 39 // Do performs the HTTP request 40 func (s *PendingTransactions) Do(ctx context.Context, headers ...*common.Header) (total uint64, topTransactions []types.SignedTxn, err error) { 41 s.p.Format = "msgpack" 42 response := models.PendingTransactionsResponse{} 43 err = s.c.getMsgpack(ctx, &response, "/v2/transactions/pending", s.p, headers) 44 total = response.TotalTransactions 45 topTransactions = response.TopTransactions 46 return 47 }