I want to create a hash-table using PDAs with seeds including: i) table-name ii) a u32 integer as key
I tried this:
#[account(
init,
payer=user,
space = 8 + 1 + 32 + 8 + 8,
seeds = [b"users_table", a_u32_int.as_ref()],
bump
)]
pub users_table: Account<'info, UsersTable>,
But here, I was not able to use u32 integer as reference.
Github-copilor suggested this seeds = [b"users_table", 0u32.to_le_bytes().as_ref()]
, but I am not sure what .to_le_bytes()
mean in rust
Also I don't know how I can generate a PDA-address for this in frontend to send as parameter for anchor program's accounts as await PublicKey.findProgramAddress()
does not support numbers