Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Funded account with recovery code (lock fix) #455

Merged
merged 4 commits into from
Jul 1, 2021

Conversation

MaximusHaximus
Copy link
Contributor

@MaximusHaximus MaximusHaximus commented Jun 30, 2021

Bugfix for near/near-wallet#1752 - which is only live on staging & testnet currently.

  1. Resolves a bug where any new funded accounts that were created using email or SMS recovery methods did not have their fundedAccountNeedsDeposit set to true, because those recovery methods create an account record in SQL before any post to /fundedAccount is done, but the existing logic in /fundedAccount assumed it would be the creator of the account.
  2. Added an initial check to make the /fundedAccount route throw an error if someone hits it with an accountID that already exists, by leveraging existing middleware named checkAccountDoesNotExist
  • Modified checkAccountDoesNotExist to be a factory function, createCheckAccountDoesNotExistMiddleware() so that we could re-use this middleware with routes that don't have the account id in request.body.accountId - this was needed to share this logic on /fundedAccount, which receives the argument as newAccountId.

…age sites to use the new factory appropriately
…not already exist on-chain when someone calls the create endpoint
… in cases where the SQL record was already created by a prior action (happens during initial creation using SMS or email recovery methods)
@MaximusHaximus MaximusHaximus changed the title Funded account with recovery code fix Funded account with recovery code (lock fix) Jun 30, 2021
@MaximusHaximus MaximusHaximus merged commit ea02a31 into master Jul 1, 2021
@MaximusHaximus MaximusHaximus deleted the funded-account-with-recovery-code-fix branch July 1, 2021 15:38
This was referenced Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants