Skip to main content
2 of 2
added 582 characters in body
Sharmilan
  • 421
  • 2
  • 10

This is how i convert the XDR before the initial signature.

    trustTx, err := build.Transaction(
    build.SourceAccount{recipient.Address()},
    build.AutoSequence{SequenceProvider: horizon.DefaultTestNetClient},
    build.TestNetwork,
    build.Trust(Asset.Code, Asset.Issuer, build.Limit(cd.Limit)),
)


var result build.TransactionEnvelopeBuilder
err := result.Mutate(trustTx)
if err != nil {
    log.Fatal(err)
}

trustTxeB64, err := result.Base64()

To sign in client side offline

var txe xdr.TransactionEnvelope
err = xdr.SafeUnmarshalBase64(trustTxeB64, &txe)
if err != nil {
    log.Fatal(err)
}

b := &build.TransactionEnvelopeBuilder{E: &txe}
b.Init()
err = b.MutateTX(build.TestNetwork)
if err != nil {
    log.Fatal(err)
}
err = b.Mutate(build.Sign{cd.Signerkey})
if err != nil {
    log.Fatal(err)
}

newEnv, err := xdr.MarshalBase64(b.E)
if err != nil {
    log.Fatal(err)
}

to submit that to an online node

    resp, err := horizon.DefaultTestNetClient.SubmitTransaction(newEnv)
Sharmilan
  • 421
  • 2
  • 10