How it works
This JavaScript CLI tool deploys astate-cleanup.wasm contract replacing the current one, and then uses the new contract to clean up the account’s state, so you can easily redeploy a new contract or use the account in any other way.
Here’s a quick snippet of the contract’s main code:
How to use
Requirements
You’ll need NEAR CLI. You can install it by running:Clear your account state
To clear your account state, follow these steps.Login with NEAR CLI
This will store a full access key locally on your machine. Select the account you wish to clear the state.
Troubleshooting
If your contract state is large, depending on the RPC node, you may get the error:view-state via the JSON RPC API by selecting an alternative RPC provider. You can find different providers in the RPC providers list.
For example, you could replace the default RPC node in commands/clearState.js with another RPC server: