func (m MemoID) MutateTransaction(o *TransactionBuilder) (err error) {
	o.TX.Memo, err = xdr.NewMemo(xdr.MemoTypeMemoId, xdr.Uint64(m.Value))
	return
}
MutateTransaction for MemoID sets the memo.
package build
import (
	"encoding/hex"
	"github.com/stellar/go/network"
	"github.com/stellar/go/support/errors"
	"github.com/stellar/go/xdr"
)
func Transaction(muts ...TransactionMutator) (*TransactionBuilder, error) {
	result := &TransactionBuilder{}
	err := result.Mutate(muts...)
	if err != nil {
		return nil, err
	}
	err = result.Mutate(Defaults{})
	if err != nil {
		return nil, err
	}
	return result, nil
}
type TransactionMutator interface {
	MutateTransaction(*TransactionBuilder) error
}
type TransactionBuilder struct {
	TX                *xdr.Transaction
	NetworkPassphrase string
	BaseFee           uint64
}
func (b *TransactionBuilder) Mutate(muts ...TransactionMutator) error {
	if b.TX == nil {
		b.TX = &xdr.Transaction{}
	}
	for _, m := range muts {
		err := m.MutateTransaction(b)
		if err != nil {
			return err
		}
	}
	return nil
}
func (b *TransactionBuilder) Hash() ([32]byte, error) {
	return network.HashTransaction(b.TX, b.NetworkPassphrase)
}
func (b *TransactionBuilder) HashHex() (string, error) {
	hash, err := b.Hash()
	if err != nil {
		return "", err
	}
	return hex.EncodeToString(hash[:]), nil
}
func (b *TransactionBuilder) Sign(signers ...string) (TransactionEnvelopeBuilder, error) {
	var result TransactionEnvelopeBuilder
	err := result.Mutate(b)
	if err != nil {
		return result, err
	}
	for _, s := range signers {
		err := result.Mutate(Sign{s})
		if err != nil {
			return result, err
		}
	}
	return result, nil
}
func (m AccountMergeBuilder) MutateTransaction(o *TransactionBuilder) error {
	if m.Err != nil {
		return m.Err
	}
	m.O.Body, m.Err = xdr.NewOperationBody(xdr.OperationTypeAccountMerge, m.Destination)
	o.TX.Operations = append(o.TX.Operations, m.O)
	return m.Err
}
func (m AllowTrustBuilder) MutateTransaction(o *TransactionBuilder) error {
	if m.Err != nil {
		return m.Err
	}
	m.O.Body, m.Err = xdr.NewOperationBody(xdr.OperationTypeAllowTrust, m.AT)
	o.TX.Operations = append(o.TX.Operations, m.O)
	return m.Err
}
func (m AutoSequence) MutateTransaction(o *TransactionBuilder) error {
	source := o.TX.SourceAccount
	if source == (xdr.AccountId{}) {
		return errors.New("auto sequence used prior to setting source account")
	}
	seq, err := m.SequenceForAccount(source.Address())
	if err != nil {
		return err
	}
	o.TX.SeqNum = seq + 1
	return nil
}
func (m ChangeTrustBuilder) MutateTransaction(o *TransactionBuilder) error {
	if m.Err != nil {
		return m.Err
	}
	m.O.Body, m.Err = xdr.NewOperationBody(xdr.OperationTypeChangeTrust, m.CT)
	o.TX.Operations = append(o.TX.Operations, m.O)
	return m.Err
}
func (m CreateAccountBuilder) MutateTransaction(o *TransactionBuilder) error {
	if m.Err != nil {
		return m.Err
	}
	m.O.Body, m.Err = xdr.NewOperationBody(xdr.OperationTypeCreateAccount, m.CA)
	o.TX.Operations = append(o.TX.Operations, m.O)
	return m.Err
}
var DefaultBaseFee uint64 = 100
func (m Defaults) MutateTransaction(o *TransactionBuilder) error {
	if o.BaseFee == 0 {
		o.BaseFee = DefaultBaseFee
	}
	if o.TX.Fee == 0 {
		o.TX.Fee = xdr.Uint32(int(o.BaseFee) * len(o.TX.Operations))
	}
	if o.NetworkPassphrase == "" {
		o.NetworkPassphrase = DefaultNetwork.Passphrase
	}
	return nil
}
func (m InflationBuilder) MutateTransaction(o *TransactionBuilder) error {
	if m.Err != nil {
		return m.Err
	}
	m.O.Body, m.Err = xdr.NewOperationBody(xdr.OperationTypeInflation, nil)
	o.TX.Operations = append(o.TX.Operations, m.O)
	return m.Err
}
func (m ManageDataBuilder) MutateTransaction(o *TransactionBuilder) error {
	if m.Err != nil {
		return m.Err
	}
	m.O.Body, m.Err = xdr.NewOperationBody(xdr.OperationTypeManageData, m.MD)
	o.TX.Operations = append(o.TX.Operations, m.O)
	return m.Err
}
func (m ManageOfferBuilder) MutateTransaction(o *TransactionBuilder) error {
	if m.Err != nil {
		return m.Err
	}
	if m.PassiveOffer {
		m.O.Body, m.Err = xdr.NewOperationBody(xdr.OperationTypeCreatePassiveOffer, m.PO)
		o.TX.Operations = append(o.TX.Operations, m.O)
	} else {
		m.O.Body, m.Err = xdr.NewOperationBody(xdr.OperationTypeManageOffer, m.MO)
		o.TX.Operations = append(o.TX.Operations, m.O)
	}
	return m.Err
}
func (m MemoHash) MutateTransaction(o *TransactionBuilder) (err error) {
	o.TX.Memo, err = xdr.NewMemo(xdr.MemoTypeMemoHash, m.Value)
	return
}