Example #1
0
func setAccountId(addressOrSeed string, aid *xdr.AccountId) error {
	kp, err := keypair.Parse(addressOrSeed)
	if err != nil {
		return err
	}

	if aid == nil {
		return errors.New("aid is nil in setAccountId")
	}

	return aid.SetAddress(kp.Address())
}
// MutateTransactionEnvelope adds a signature to the provided envelope
func (m Sign) MutateTransactionEnvelope(txe *TransactionEnvelopeBuilder) error {
	hash, err := txe.child.Hash()

	if err != nil {
		return err
	}

	kp, err := keypair.Parse(m.Seed)
	if err != nil {
		return err
	}

	sig, err := kp.SignDecorated(hash[:])
	if err != nil {
		return err
	}

	txe.E.Signatures = append(txe.E.Signatures, sig)
	return nil
}