stellar / js-stellar-sdk

Main Stellar client library for the JavaScript language.
https://stellar.github.io/js-stellar-sdk/
Apache License 2.0
615 stars 296 forks source link

add toXDR and fromXDR for multiauth flow #977

Closed BlaineHeffron closed 3 weeks ago

BlaineHeffron commented 1 month ago

Addresses https://github.com/stellar/js-stellar-sdk/issues/976

Adds a toXDR and fromXDR for AssembledTransaction class. Also adds a txFromXDR to the Client class. Changes the swap test to use this flow.

Limitations: If you use the XDR multi-auth flow, you must resimulate before the final signAndSend call. This is due to the fact that we can't serialize the XDR of the transaction envelope with the results of the simulation. If we want to do this, we would need to add an AssembledTransaction type to XDR in Stellar Base.

Shaptic commented 1 month ago

If it were up to me, [...] I would just ship a breaking change. But we should probably wait until the next major version to do that.

I completely agree, but it's not the way we want to do things anymore (i.e. we want a single major version across the stack [up to the platform] to define protocol compatibility). Yet another reason why the SDK and the binding code should be able to evolve independently :wink: