github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/engine/access/rest/request/create_transaction.go (about)

     1  package request
     2  
     3  import (
     4  	"io"
     5  
     6  	"github.com/onflow/flow-go/model/flow"
     7  )
     8  
     9  type CreateTransaction struct {
    10  	Transaction flow.TransactionBody
    11  }
    12  
    13  func (c *CreateTransaction) Build(r *Request) error {
    14  	return c.Parse(r.Body, r.Chain)
    15  }
    16  
    17  func (c *CreateTransaction) Parse(rawTransaction io.Reader, chain flow.Chain) error {
    18  	var tx Transaction
    19  	err := tx.Parse(rawTransaction, chain)
    20  	if err != nil {
    21  		return err
    22  	}
    23  
    24  	c.Transaction = tx.Flow()
    25  	return nil
    26  }