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
}
MutateTransaction for AutoSequence loads the sequence and sets it on the tx.
NOTE:  this mutator assumes that the source account has already been set on
the transaction and will error if that has not occurred.
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
}