Example #1
0
// MutateSetOptions for Signer sets the SetOptionsOp's signer field
func (m Signer) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
	var signer xdr.Signer
	signer.Weight = xdr.Uint32(m.Weight)
	err = setAccountId(m.PublicKey, &signer.PubKey)
	o.Signer = &signer
	return
}
Example #2
0
// MutateSetOptions for HomeDomain sets the SetOptionsOp's HomeDomain field
func (m HomeDomain) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
	if len(m) > 32 {
		return errors.New("HomeDomain is too long")
	}

	value := xdr.String32(m)
	o.HomeDomain = &value
	return
}
Example #3
0
// MutateSetOptions for Thresholds sets the SetOptionsOp's thresholds fields
func (m Thresholds) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
	if m.Low != nil {
		val := xdr.Uint32(*m.Low)
		o.LowThreshold = &val
	}

	if m.Medium != nil {
		val := xdr.Uint32(*m.Medium)
		o.MedThreshold = &val
	}

	if m.High != nil {
		val := xdr.Uint32(*m.High)
		o.HighThreshold = &val
	}

	return
}
Example #4
0
// MutateSetOptions for ClearFlag sets the SetOptionsOp's ClearFlags field
func (m ClearFlag) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
	if !isFlagValid(xdr.AccountFlags(m)) {
		return errors.New("Unknown flag in SetFlag mutator")
	}

	var val xdr.Uint32
	if o.ClearFlags == nil {
		val = xdr.Uint32(m)
	} else {
		val = xdr.Uint32(m) | *o.ClearFlags
	}
	o.ClearFlags = &val
	return
}
Example #5
0
// MutateSetOptions for MasterWeight sets the SetOptionsOp's MasterWeight field
func (m MasterWeight) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
	val := xdr.Uint32(m)
	o.MasterWeight = &val
	return
}
Example #6
0
// MutateSetOptions for InflationDest sets the SetOptionsOp's InflationDest field
func (m InflationDest) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
	o.InflationDest = &xdr.AccountId{}
	err = setAccountId(string(m), o.InflationDest)
	return
}