Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 8004

Error Code: AccountDidNotSerialize. Error Number: 3004. Error Message: Failed to serialize the account

$
0
0

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:

  1. 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(())    }
  1. derive Account:
#[derive(Accounts)]pub struct ModifyLedger<'info> {    #[account(mut)]    pub ledger_account: Account<'info, Ledger>,    #[account(mut)]    pub wallet: Signer<'info>,}
  1. Account:
#[account]pub struct Ledger {    pub uri: String,}

Viewing all articles
Browse latest Browse all 8004

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>