2

I'm trying to close token accounts with spl-token close <address>. But I'm not able to close any account with 0 tokens. The error is it cannot parse the token account, and points back to my owner pubkey.

Hereby relevant console output:

$ spl-token close 2WehTH4Hjb1kLU4BYG8Y71KLCwPX95H6xoQen6ngRWk5
Error: Account could not be parsed as token account: pubkey=TestqXotSYZhoAoFGpGxjzwXhrKh5pdgiZzU48vFeoW
$ spl-token close --address 83kaPUwngQs9ffJ4RHWPc3xXR6oPpmnT4fAmQWWdyp9a
Error: Account could not be parsed as token account: pubkey=TestqXotSYZhoAoFGpGxjzwXhrKh5pdgiZzU48vFeoW
$ spl-token close --address 2WehTH4Hjb1kLU4BYG8Y71KLCwPX95H6xoQen6ngRWk5
Error: Account could not be parsed as token account: pubkey=2WehTH4Hjb1kLU4BYG8Y71KLCwPX95H6xoQen6ngRWk5
$ spl-token accounts -v
Token                                         Account                                       Balance
----------------------------------------------------------------------------------------------------------
2WehTH4Hjb1kLU4BYG8Y71KLCwPX95H6xoQen6ngRWk5  83kaPUwngQs9ffJ4RHWPc3xXR6oPpmnT4fAmQWWdyp9a  0
$ spl-token account-info 2WehTH4Hjb1kLU4BYG8Y71KLCwPX95H6xoQen6ngRWk5

Address: 83kaPUwngQs9ffJ4RHWPc3xXR6oPpmnT4fAmQWWdyp9a
Balance: 0
Mint: 2WehTH4Hjb1kLU4BYG8Y71KLCwPX95H6xoQen6ngRWk5
Owner: TestqXotSYZhoAoFGpGxjzwXhrKh5pdgiZzU48vFeoW
State: Initialized
Delegation: (not set)
Close authority: (not set)
1
  • 1
    I solved it by using the web3js api. It looks to me the close account CLI is broken. I also noticed the program authority CLI commands for the new v2 deployer are not working. I will reach out to the solana CLI devs.
    – Omega
    Commented Oct 6, 2022 at 9:05

2 Answers 2

1

did you try

spl-token close --address 2WehTH4Hjb1kLU4BYG8Y71KLCwPX95H6xoQen6ngRWk5
1
  • Yes, it gives this: $ spl-token close --address 2WehTH4Hjb1kLU4BYG8Y71KLCwPX95H6xoQen6ngRWk5 Error: Account could not be parsed as token account: pubkey=2WehTH4Hjb1kLU4BYG8Y71KLCwPX95H6xoQen6ngRWk5
    – Omega
    Commented Sep 28, 2022 at 10:03
0

Non-native Accounts must have a balance of zero to be closed. Firstly check your acounts:

spl-token accounts -v

Then try this:

spl-token close <TOKEN_ADDRESS> --recipient <REFUND_ACCOUNT_ADDRESS>

<TOKEN_ADDRESS> is the token mint address that you want to close. In the example above, it should be 2WehTH4Hjb1kLU4BYG8Y71KLCwPX95H6xoQen6ngRWk5

<REFUND_ACCOUNT_ADDRESS> is another different token account address(not mint address). When closing an Account, all remaining SOL will be transferred to another Solana account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.