Solana 程序部署失败后如何恢复用于出租的 SOL?

How can I recover the SOL used for rent after a failed Solana program deployment?

我尝试部署一个 Solana 程序,但失败了,我丢失了用于出租的 SOL。有什么办法可以取回吗?

Error: Deploying program failed: Error processing Instruction 1: custom program error: 0x1

是的!即使部署失败,您用于出租的 SOL 仍存储在帐户中。

从一次部署中恢复 SOL

部署失败后,您将收到如下错误消息:

Recover the intermediate account's ephemeral keypair file with
`solana-keygen recover` and the following 12-word seed phrase:
=================================================================================
this is a fake seed phrase really argle bargle boopity doop face
=================================================================================
To resume a deploy, pass the recovered keypair as the
[BUFFER_SIGNER] to `solana program deploy` or `solana write-buffer'.
Or to recover the account's lamports, pass it as the
[BUFFER_ACCOUNT_ADDRESS] argument to `solana program close`.
=================================================================================

首先从它给你的种子短语中恢复密钥对:

# After running this, paste in the seed phrase above
solana-keygen recover -o recover.json

然后您可以关闭帐户以恢复您的 SOL。

solana program close recover.json

从所有正在进行或失败的部署中恢复 SOL

或者,您可以通过 运行 从所有正在进行的部署中恢复 SOL:

solana program close --buffers