As part of the protocol outlined in SEP007, to create a uri without a known source account beforehand, you must specify the source account in the XDR as all zeros.
xdr (required) - A Stellar transaction in XDR format that is base64 encoded and then URL-encoded. If the source account in the xdr is all zeros then the URI handler should replace the source account and sequence number with the user's source account and sequence number before it signs it. If the source account is set and the sequence number is 0 then the URI handler should replace only the sequence number before signing.
Currently this is not possible in the Stellar-JS-SDK.
Here I present three possible approaches for integrating SEP007 into the Stellar-JS-SDK. Each approach is briefly described and then presented below.
Regarding the first approach, Nikhil said the reference implementation is not correct... so disregard that.
From the second and third approaches, I think that the second approach may be the best. The reason here is that the changes I had to make for the third to work are a little iffy -- I had to accept an empty public key which may be added accidentally versus "00000000000000000000000000000000"
is a more intentional addition.
Here is the code change (works for both second and third approaches):
if (publicKey === "00000000000000000000000000000000" || !publicKey) {
return new this({type: 'ed25519', publicKey: "00000000000000000000000000000000"});
}
This code would be inserted here.