简体   繁体   English

在 Solana 上创建代币账户是否会自动免费租用?

[英]Does creating a token account on Solana make it rent free automatically?

I have create a token on the devote and have created token account which I can transfer my token to successfully.我已经在奉献者上创建了一个代币并创建了代币帐户,我可以将我的代币成功转移到该帐户。 I notice that a Solana fee is taken when I do this.我注意到这样做时会收取 Solana 费用。

I also understand that I have to deposit enough Solana into an account to pay for rent or have 2 years worth of Solana to make it exempt.我也明白,我必须将足够的 Solana 存入帐户以支付租金或拥有 2 年的 Solana 价值才能使其免税。

When I create the account (using the code below) is it automatically making the accounts rent exempt or do I have to transfer additional Solana to do so.当我创建帐户(使用下面的代码)时,它会自动使帐户免租金,还是我必须转移额外的 Solana 才能这样做。

How can I do this?我怎样才能做到这一点?

Code:代码:

const tokenAccount = await getOrCreateAssociatedTokenAccount(
  connection,
  payer,
  mint,
  payer.publicKey
)

Yes, an associated token account created by this call will be rent exempt.是的,通过此调用创建的关联代币账户将免租金。 You can see it in the associated-token-program source code .您可以在associated-token-program 源代码中看到它。

All new accounts now require to be rent exempt cf https://docs.solana.com/developing/programming-model/accounts#rent现在所有新帐户都需要免租金 cf https://docs.solana.com/developing/programming-model/accounts#rent

So any accounts initialised successfully will be rent exempt.因此,任何成功初始化的帐户都将免除租金。 You don't have to worry about anything你不必担心任何事情

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM