gitlab.com/SiaPrime/SiaPrime@v1.4.1/node/api/client/transactionpool.go (about)

     1  package client
     2  
     3  import (
     4  	"encoding/base64"
     5  	"net/url"
     6  
     7  	"gitlab.com/SiaPrime/SiaPrime/encoding"
     8  	"gitlab.com/SiaPrime/SiaPrime/node/api"
     9  	"gitlab.com/SiaPrime/SiaPrime/types"
    10  )
    11  
    12  // TransactionPoolFeeGet uses the /tpool/fee endpoint to get a fee estimation.
    13  func (c *Client) TransactionPoolFeeGet() (tfg api.TpoolFeeGET, err error) {
    14  	err = c.get("/tpool/fee", &tfg)
    15  	return
    16  }
    17  
    18  // TransactionPoolRawPost uses the /tpool/raw endpoint to send a raw
    19  // transaction to the transaction pool.
    20  func (c *Client) TransactionPoolRawPost(txn types.Transaction, parents []types.Transaction) (err error) {
    21  	values := url.Values{}
    22  	values.Set("transaction", base64.StdEncoding.EncodeToString(encoding.Marshal(txn)))
    23  	values.Set("parents", base64.StdEncoding.EncodeToString(encoding.Marshal(parents)))
    24  	err = c.post("/tpool/raw", values.Encode(), nil)
    25  	return
    26  }