コード例 #1
0
ファイル: set_options.go プロジェクト: FihlaTV/bridge-server
// 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
}
コード例 #2
0
		Context("using an invalid PubKey", func() {
			BeforeEach(func() { mut = Signer{bad, 5} })
			It("failed", func() { Expect(subject.Err).To(HaveOccurred()) })
		})
	})

	Describe("HomeDomain", func() {
		Context("using a valid value", func() {
			BeforeEach(func() { mut = HomeDomain("stellar.org") })

			It("succeeds", func() {
				Expect(subject.Err).NotTo(HaveOccurred())
			})

			It("sets the HomeDomain to correct value", func() {
				Expect(*subject.SO.HomeDomain).To(Equal(xdr.String32("stellar.org")))
			})
		})

		Context("value too long", func() {
			BeforeEach(func() { mut = HomeDomain("123456789012345678901234567890123") })
			It("failed", func() { Expect(subject.Err).To(HaveOccurred()) })
		})
	})

	Describe("SetFlag", func() {
		Context("using a valid account flag", func() {
			BeforeEach(func() { mut = SetFlag(1) })

			It("succeeds", func() {
				Expect(subject.Err).NotTo(HaveOccurred())