I want to calculate the minimum balance for Rent-except and have found code like this:
const { Connection, clusterApiUrl, LAMPORTS_PER_SOL } = require('@solana/web3.js');
const connection = new Connection(clusterApiUrl('mainnet-beta'), 'confirmed');
(async () => {
const dataSize = 16; // Replace with the desired account size in bytes
const minBalance = await connection.getMinimumBalanceForRentExemption(dataSize);
console.log(`Rent-exempt minimum: ${minBalance / LAMPORTS_PER_SOL} SOL`);
})();
But what the data size that a wallet account (for example: normal accout on Phantom Wallet) use?
Also, I saw this code somewhere:
Account {
lamports: 100,
data: data.to_vec(),
owner: spl_token::id(),
executable: false,
rent_epoch: 0,
};
Is the data size that use to compute rent just the size of above data
field or the size of whole Account struct?