Skip to content

Instantly share code, notes, and snippets.

@renfei
Created September 28, 2025 12:30
Show Gist options
  • Select an option

  • Save renfei/b7a43621f91ae38cd38763cb1b0fa523 to your computer and use it in GitHub Desktop.

Select an option

Save renfei/b7a43621f91ae38cd38763cb1b0fa523 to your computer and use it in GitHub Desktop.
Command to close Ledger's Solana token account and recover deposit in macOS
#!/bin/bash
# Get the public key
# Output my public key: ApqJpFXgNnW4Cw8f8fh5sDaz1fYjqiYmWmERaAZTPM7r
solana-keygen pubkey 'usb://ledger?key=0'
# View the token account list
spl-token accounts --owner ApqJpFXgNnW4Cw8f8fh5sDaz1fYjqiYmWmERaAZTPM7r
# Close the specified token account
spl-token close SNS8DJbHc34nKySHVhLGMUUE72ho6igvJaxtq9T3cX3 --recipient ApqJpFXgNnW4Cw8f8fh5sDaz1fYjqiYmWmERaAZTPM7r --close-authority 'usb://ledger?key=0' --owner ApqJpFXgNnW4Cw8f8fh5sDaz1fYjqiYmWmERaAZTPM7r --fee-payer 'usb://ledger?key=0' --url mainnet-beta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment