Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Handle case where account hasn't been created #95

Open
msfeldstein opened this issue Aug 28, 2019 · 3 comments
Open

Handle case where account hasn't been created #95

msfeldstein opened this issue Aug 28, 2019 · 3 comments

Comments

@msfeldstein
Copy link
Contributor

It's possible to create a deposit on an account that hasn't been created yet. In that case, we depend on the anchor to create the account, which we need to wait for, then add the trustline, then complete the rest of the deposit.

@accordeiro explains here: https://github.com/stellar/sep6-demo-client/pull/93

The deposit flow does not require a Stellar account to be created upfront, i.e. you can provide the public key of an account that does not exist until that moment (similarly to what we do with Friendbot). In this case, it'll be the anchor's responsibility to create that Stellar account and provide it with the minimum recommended funding (2.01XLM).

So I think the correct flow would be:

    Check /info
    Get /deposit (using the key provided by the config, regardless of it being an existing account)
    Interactive deposit flow
    Start polling transactions
    If we get a pending_trust as a response, then we actually perform the trustline creation

Does that make sense? The code is a bit messy, but I think this describes the exact moment in which we should establish a trustline: 

@accordeiro
Copy link

accordeiro commented Sep 26, 2019

Thanks @msfeldstein!

I wonder if we should increase the priority of this change, since on testnet it's easy to get some initial funding for an account (through Friendbot + lab) but on mainnet we'll probably see more cases where wallets expect the account creation / funding to be performed by that anchor – as otherwise they'd need to buy real XLM through some other means.

Considering that, we probably need to ensure new anchors are properly implementing this account creation and initial funding flow. Does that make sense? @tomerweller @tomquisel I'd love to hear your thoughts as well.

@msfeldstein
Copy link
Contributor Author

msfeldstein commented Sep 26, 2019 via email

@tomquisel
Copy link

tomquisel commented Sep 26, 2019

I agree, this is high priority. It shouldn't be much of an issue for our mobile wallet since it'll pre-fund accounts, but it'll be a real stumbling block with any other wallet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants