github.com/algorand/go-algorand-sdk@v1.24.0/client/v2/algod/pendingTransactionInformation.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  // PendingTransactionInformationParams contains all of the query parameters for url serialization.
    13  type PendingTransactionInformationParams struct {
    14  
    15  	// Format configures whether the response object is JSON or MessagePack encoded.
    16  	Format string `url:"format,omitempty"`
    17  }
    18  
    19  // PendingTransactionInformation given a transaction ID of a recently submitted
    20  // transaction, it returns information about it. There are several cases when this
    21  // might succeed:
    22  // - transaction committed (committed round > 0)
    23  // - transaction still in the pool (committed round = 0, pool error = "")
    24  // - transaction removed from pool due to error (committed round = 0, pool error !=
    25  // "")
    26  // Or the transaction may have happened sufficiently long ago that the node no
    27  // longer remembers it, and this will return an error.
    28  type PendingTransactionInformation struct {
    29  	c *Client
    30  
    31  	txid string
    32  
    33  	p PendingTransactionInformationParams
    34  }
    35  
    36  // Do performs the HTTP request
    37  func (s *PendingTransactionInformation) Do(ctx context.Context, headers ...*common.Header) (response models.PendingTransactionInfoResponse, stxn types.SignedTxn, err error) {
    38  	s.p.Format = "msgpack"
    39  	err = s.c.getMsgpack(ctx, &response, fmt.Sprintf("/v2/transactions/pending/%s", s.txid), s.p, headers)
    40  	stxn = response.Transaction
    41  	return
    42  }