func (this *StellarAccountMerge) GetSigned(seed string) string {

	tx := build.TransactionBuilder{}
	tx.TX = &xdr.Transaction{}
	opt := xdr.Operation{}
	srcAccID, _ := stellarbase.AddressToAccountId(this.SrcInfo.ID)
	destAccID, _ := stellarbase.AddressToAccountId(this.DestPublicAddr)

	opt.SourceAccount = &srcAccID
	opt.Body, _ = xdr.NewOperationBody(xdr.OperationTypeAccountMerge,
		destAccID)
	tx.TX.Operations = append(tx.TX.Operations, opt)

	tx.Mutate(build.Sequence{xdr.SequenceNumber(this.SrcInfo.NextSequence())})
	if STELLAR_DEFAULT_NETWORK == STELLAR_TEST_NETWORK {
		tx.Mutate(build.TestNetwork)
	} else {
		tx.Mutate(build.PublicNetwork)
	}
	tx.Mutate(build.SourceAccount{this.SrcInfo.ID})
	tx.TX.Fee = BASEMENT_FEE
	result := tx.Sign(seed)

	var err error

	this.signBase64, err = result.Base64()
	// fmt.Printf("tx base64: %s\r\n", this.signBase64)

	if err == nil {
		return this.signBase64
	}

	fmt.Println(err)
	return ""
}
Ejemplo n.º 2
0
// MutateOperation for SourceAccount sets the operation's SourceAccount
// to the pubilic key for the address provided
func (m SourceAccount) MutateOperation(o *xdr.Operation) error {
	o.SourceAccount = &xdr.AccountId{}
	return setAccountId(m.AddressOrSeed, o.SourceAccount)
}