Cosmic.Link now support XDR in URLs !
https://cosmic.link/?xdr=AAAAAODiuoFh0qCoyFts6lDzWIM6koo9hi8gvSyCC6uOWe+cAAAAZAB/l7UAAAACAAAAAAAAAAAAAAABAAAAAAAAAAUAAAABAAAAAIQ/AS7GRUBBd96ykumKKUFE92+oiwRuJ7KXuvPwwTQWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==&stripSource
The point of this is easing cosmic link integration in existing web services. This allows you to support the protocol without having to integrate cosmic-lib or any foreign code. Using XDR URLs instead of legacy cosmic link have few drawbacks, and implementation is way easier. Here's the differences between the two:
- Legacy cosmic link allows to use federated address instead of account IDs, XDR and normal Stellar transactions can't do that.
- Legacy links are shorter and more transparent. The example XDR URL I gave you translates to:
https://cosmic.link/?setOptions&inflationDest=GCCD6AJOYZCUAQLX32ZJF2MKFFAUJ53PVCFQI3RHWKL3V47QYE2BNAUT
(Set Lumenaut as your inflation pool)
The XDR URLs have two forms:
https://cosmic.link/?xdr={XDR}
https://cosmic.link/?xdr={XDR}&stripSource
An XDR always contains a source account and a sequence number. This means that it can only be signed by the intended user, and at a given time. When parsing those links, the sequence number is automatically stripped out so that the transaction will be signeable at any time. The first reason sequence is stripped out is that it's not supported by the cosmic link protocol at this time. It's also an ok default behavior as sequence is of few meaning in most situations. However, the source account is kept by default.
As you can tell, the second form allow you to strip out the source account from the transaction. Then, anybody will be able to sign the transaction using its own account. I used it in the example because the link offer to register at an inflation pool, so the transaction should be open to everybody to sign. However, a normal cosmic link does the task better. In most cases, when using the XDR feature, the '&stripSource' would be uneeded and sometimes error-prone. That's why it's not the default behavior. However, it can make sense when issuing generic transactions like trade offers. It also allows to issue valid transactions without knowing the user's account ID.
In the future I may implement a '&keepSequence/&skipSequence'. I'm still wondering which default behavior would fit better.
Anyway I hope you like this new feature as much as I do ?
I'm going to be absent for the next 10 days and won't be able to answer during this time.
See you!
P.S:
At this time only simple transactions (one operation) are supported by the protocol.
Also, signed XDR won't works. I plan to add support for thoses later, but this is not the current priority.