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