How to delete NEAR account with large state?

Viewed 845

I'm attempting to delete a NEAR wallet and transfer the remaining fund to another wallet by using the following command:

near delete choyeumeo.near maimai276.near

But seems like the action failed because the to-be-deleted accounts has too many state. So someone advice me is to delete all the state before trying again.

Here is the transaction id: Explorer

Here is the picture of failed function: Failed function

So I am looking for a way to delete those states. Any help would be much appreciated.

2 Answers

To delete the account, we need to delete all its state, but instating over all the keys can take longer than a second, so we had to come up with some limit to avoid such situation. Please, use state cleanup contract to remove all the keys before you remove the account: https://github.com/near/core-contracts/pull/171

I created a javascript node js file that comes with a list of options to delete your functionCall access keys and full access keys

This will help clear up your state without having to delete them one by one manually

this file will allow you to delete all your functionCall Access Keys, all your full Access Keys or all but one specified full access keys with instructions on how to specify the key you want to save

You can check it out here!

the code contains the step by step instructions

please leave feedback if you run into any issues or want an additional feature

https://github.com/doriancrutcher/mass-delete-access-keys-near

Related