build/allow_trust.go
func (m AllowTrustAsset) MutateAllowTrust(o *xdr.AllowTrustOp) (err error) {
	length := len(m.Code)

	switch {
	case length >= 1 && length <= 4:
		var code [4]byte
		byteArray := []byte(m.Code)
		copy(code[:], byteArray[0:length])
		o.Asset, err = xdr.NewAllowTrustOpAsset(xdr.AssetTypeAssetTypeCreditAlphanum4, code)
	case length >= 5 && length <= 12:
		var code [12]byte
		byteArray := []byte(m.Code)
		copy(code[:], byteArray[0:length])
		o.Asset, err = xdr.NewAllowTrustOpAsset(xdr.AssetTypeAssetTypeCreditAlphanum12, code)
	default:
		err = errors.New("Asset code length is invalid")
	}

	return
}
func (m AllowTrustAsset) MutateAllowTrust(o *xdr.AllowTrustOp) (err error) {
	length := len(m.Code)

	switch {
	case length >= 1 && length <= 4:
		var code [4]byte
		byteArray := []byte(m.Code)
		copy(code[:], byteArray[0:length])
		o.Asset, err = xdr.NewAllowTrustOpAsset(xdr.AssetTypeAssetTypeCreditAlphanum4, code)
	case length >= 5 && length <= 12:
		var code [12]byte
		byteArray := []byte(m.Code)
		copy(code[:], byteArray[0:length])
		o.Asset, err = xdr.NewAllowTrustOpAsset(xdr.AssetTypeAssetTypeCreditAlphanum12, code)
	default:
		err = errors.New("Asset code length is invalid")
	}

	return
}
// MutateAllowTrust for Asset sets the AllowTrustOp's Asset field