I am trying to update value of string. I can update if its type is u8
, u32
, u64
, or i64
but cannot update if it's a string type. Any guesses what am I doing wrong?
Code snippet:
- Program Function
pub fn set_uri(
ctx: Context<ModifyLedger>,
new_uri: String,
) -> Result<()> {
let ledger_account = &mut ctx.accounts.ledger_account;
ledger_account.uri = new_uri;
Ok(())
}
- derive Account:
#[derive(Accounts)]
pub struct ModifyLedger<'info> {
#[account(mut)]
pub ledger_account: Account<'info, Ledger>,
#[account(mut)]
pub wallet: Signer<'info>,
}
- Account:
#[account]
pub struct Ledger {
pub uri: String,
}