This repository was archived by the owner on Oct 4, 2024. It is now read-only.
refactor: check if beneficiary account exists, require confirmation#999
Merged
Conversation
Contributor
|
@judith-Near @BenKurrek looks like this PR broke tests. |
Contributor
|
@volovyk-s oop yea it looks like the tests have to be rewritten? |
volovyks
reviewed
Jul 25, 2022
| console.log(`Account ${options.accountId} for network "${options.networkId}" was deleted.`); | ||
| const beneficiaryAccount = await near.account(options.beneficiaryId); | ||
| // beneficiary account does not exist if there are no access keys | ||
| if (!(await beneficiaryAccount.getAccessKeys()).length) { |
Contributor
There was a problem hiding this comment.
@judith-Near If the account has 0 AC. it does not mean it does not exist.
Contributor
There was a problem hiding this comment.
- geAccessKeys() can return
null, it will crash the execution.
Contributor
There was a problem hiding this comment.
Ah... I misunderstood what's happening here. I was under the impression that this would throw an error if the account doesn't exist and you're trying to query for the keys. That's on me. Apologies.
Contributor
There was a problem hiding this comment.
Hm, maybe it will. It's better to test it. But logic seems wrong anyway.
Contributor
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
related to issue #994
PR adds a warning
This method will delete your account. Beneficiary account must exist in order to transfer all Near tokens. Make sure to send all fungible tokens or NFTs that you own to the beneficiary account prior to deleting, as this method will only transfer NEAR tokens. Do you want to proceed?that the user must confirm.Delete will also not run if beneficiary account does not exist.