示例#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
}
示例#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
}
示例#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
}
示例#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
}
示例#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
}
示例#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
}