Error creating RWA Metadata: unknown signer: 8YPeMc8CkWyW95SExgKz6o8pKuKfn1H3Bqvu6HWk81dX
Error creating RWA Metadata: unknown signer: 8YPeMc8CkWyW95SExgKz6o8pKuKfn1H3Bqvu6HWk81dX
Loading saved threads...
Joshua Akpansunday · External communityPost link
External question — Solana Stack Exchange
Author: Joshua Akpansunday
Original post: https://solana.stackexchange.com/questions/16190
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
#[program]
pub mod rwa_tokenization {
use super::*;
// Initialize RWA metadata and mint
pub fn initialize_rwa(
ctx: Context<InitializeRwa>,
uri: String,
name: String,
total_supply: u64,
price_per_fraction: u64
) -> Result<()> {
// Validate the URI and name lengths
require!(uri.len() <= 200, RwaError::UriTooLong);
require!(name.len() <= 50, RwaError::NameTooLong);
// Set up the RWA metadata
let rwa_metadata = &mut ctx.accounts.rwa_metadata;
rwa_metadata.uri = uri;
rwa_metadata.name = name;
rwa_metadata.creator = *ctx.accounts.creator.key;
rwa_metadata.total_supply = total_supply;
rwa_metadata.price_per_fraction = price_per_fraction;
rwa_metadata.current_holders = 0;
rwa_metadata.mint = ctx.accounts.mint.key();
Ok(())
}
#[derive(Accounts)]
pub struct InitializeRwa<'info> {
#[account(
init,
payer = creator,
space = 8 + // discriminator
32 + // creator (Pubkey)
32 + // mint (Pubkey)
8 + // total_supply (u64)
8 + // price_per_fraction (u64)
8 + // current_holders (u64)
4 + 200 + // uri (String max 200 chars)
4 + 50 // name (String max 50 chars)
)]
pub rwa_metadata: Account<'info, RWAMetadata>,
#[account(mut)]
pub creator: Signer<'info>,
#[account(
init,
payer = creator,
mint::decimals = 2,
mint::authority = creator,
)]
pub mint: InterfaceAccount<'info, Mint>,
pub system_program: Program<'info, System>,
pub token_program: Program<'info, Token2022>,
pub rent: Sysvar<'info, Rent>,
}
#[account]
pub struct RWAMetadata {
pub uri: String, // Max 200 characters
pub name: String, // Max 50 characters
pub creator: Pubkey,
pub mint: Pubkey,
pub total_supply: u64,
pub price_per_fraction: u64,
pub current_holders: u64,
}
#[error_code]
pub enum RwaError {
#[msg("The amount exceeds the total supply")]
ExceedsTotalSupply,
#[msg("Calculation error")]
CalculationError,
#[msg("URI is too long (max 200 characters)")]
UriTooLong,
#[msg("Name is too long (max 50 characters)")]
NameTooLong,
}
Quote
Report
Jimii · External communityPost link
External answer — Solana Stack Exchange
Author: Jimii
Original post: https://solana.stackexchange.com/a/16191
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
unknown signer
error might occur when you try to send your transaction with a non-signer address.
In your test cases, is the
creator
address similar to that of your anchor workspace?
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Solana Stack Exchange Author: Jimii Source score (net votes, not local likes): 0 Original post: https://solana.stackexchange.com/a/16191 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. unknown signer error might occur when you try to send your transaction with a non-signer address. In your test cases, is the creator address similar to that of your anchor workspace?
Checking account access…