soroban-cli
soroban-cli copied to clipboard
CLI: Sign with wallet selector in Laboratory
What problem does your feature solve?
To transactions created in the CLI, allow users to connect to a wallet not stored by the CLI. This is being explicitly asked by developer
What would you like to see?
- [ ] Wallet kit - land user in Lab with wallet kit - https://github.com/Creit-Tech/Stellar-Wallets-Kit
This issue includes pass the xdr to the sign page on Lab and pass back the signed xdr to the CLI.
What alternatives are there?
@willemneal @fnando I'm thinking of breaking out the signing with macOS keychain into a separate ticket, what do you think?
For signing with system keychain, it is moved to a separate issue: https://github.com/stellar/stellar-cli/issues/1481
It sounds like from @quietbits and @jeesunikim that this work requires adding a top level account
Currently blocked by #1406
This will add a new --sign-with-lab flag for (currently WIP) tx sign command. The flow is:
- Prompt user to confirm opening browser (unless
--yesis passed) - Start http server on any open port
- Open browser with constructed url:
https://beta-laboratory.stellar.org/transaction/cli-sign?importXdr=<xdr>&passphrase=<network-passphrase>&redirect-url=localhost:port/callback(more below) - cli: wait for callback to be called
- laboratory: show sign view, when user click on sign, redirect to
localhost:port/callback?signed=<xdr> - http server: listen to callback, when called save xdr into var
- http server: redirect from /callback lab's success page (
https://beta-laboratory.stellar.org/transaction/cli-success) - pass xdr back to cli main thread and kill server
- print result signed xdr
We could reuse existing /sign endpoint, but I think it's more flexible to add 2 new endpoints:
/sign-clithat accepts necessary query parameters listed above:
importXdr: XDR to signpassphrase: network passphrase (default to lab selected passphrase if not specified)redirect-url: URL user will be redirected to when transaction is successfully signed it can also have a different UI from a regular/sign, if we would want so in the future without the need of changing the cli (e.g. I think it could be useful to be able to see decoded XDR that user is signing) -> for now it can be the same as/sign, or even redirect to/sign. Previously it was discussed that we should add top level account, but IMO it's not necessary. We can keep current flow where user can either sign with provided secret key account (NOT an intended flow, as they can just use other cli commands for the same result. So we can technically remove signing with secret key from/sign-cli), OR connect wallet and sign with it.
cli-successjust a static page that says "transaction signed you can now close this page"
To sum up user flow (numbered): cli:
- call sign command
- prompt to confirm action Browser:
- open laboratory/sign-cli
- user connects wallet and signs
- redirect localhost/callback (with signed XDR)
- redirect laboratory/success cli:
- print signed XDR
cc @quietbits @jeesunikim
Close in favor of https://github.com/stellar/stellar-cli/issues/674
@janewang You linked this same issue