Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 868
4 votes
1 answer
1k views

Add timestamp to current time

I need to implement a time-bound function to get the current_time and set an end_time The function should add add_time to the current_time let's say 2 years, 3 months and 4 days if add_time in UTC is …
Abdullah Qureshi's user avatar
4 votes
2 answers
71 views

Charge SOL Fee Before Minting NFT

I want user to pay some fixed SOL fee per NFT before minting. Any code snippet or reference will be helpful. I am using the following NFT minting code. pub fn mint_nft( ctx: Context<MintNF …
Abdullah Qureshi's user avatar
2 votes
1 answer
35 views

Keep record of NFTs minted counter by each user

I want to keep record of NFTs minted by each user separately. I am currently maintaining a counter to keep record of all NFTs minted. Account: #[account] pub struct NFTsMinted { //net NFTs minted …
Abdullah Qureshi's user avatar
2 votes
1 answer
86 views

Stress Testing: 1000 Tranactions at the same Time

I need to know how many transactions the Solana blockchain can handle at a time. Currently, my app can handle around 10-20 transactions at once, but if I send around 50 transactions, let's say 50 NFT …
Abdullah Qureshi's user avatar
5 votes
1 answer
341 views

Solana Program 1 time initialization Issue

I want to add a check that once a function is called it should never be called again. I want initialization to be one-time only. Is this a good approach if I take a bool value and set it to false afte …
Abdullah Qureshi's user avatar
7 votes
2 answers
554 views

Use any Random Function in anchor lang

Rand lib is supported in rust but not supported in anchor lang. I want to generate a random number lets say between a range of 0-10. Is there is a way I can do in anchor lang. Or alternatively, if the …
Abdullah Qureshi's user avatar
6 votes
1 answer
230 views

How to use Tuples in Anchor lang

What am I doing wrong? Is that not how we use tuples in rust? Account: #[account] pub struct UserLedger { pub list: Vec<(String, u32)>, } Error Message: Error: Type not found: {"type":{"defined": …
Abdullah Qureshi's user avatar
7 votes
3 answers
462 views

Error Code: AccountDidNotSerialize. Error Number: 3004. Error Message: Failed to serialize t...

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 …
Abdullah Qureshi's user avatar
5 votes
1 answer
910 views

Error Code: AccountDidNotSerialize. Error Number: 3004. Error Message: Failed to serialize t...

I am facing an error on adding line Vec<String>, type or String type. Error: #[derive(Accounts)] pub struct ModifyLedger<'info> { #[account(mut)] pub ledger_account: Account<'info, Ledger>, …
Abdullah Qureshi's user avatar
4 votes
1 answer
56 views

Reveal URL on mint Solana Anchor Lang

I want to hide the minting URL and reveal it later once a user has minted NFTs. let path = "http://abc.com"; let new_uri = format!("http://abc.com/1.json"); invoke( &crea …
Abdullah Qureshi's user avatar
2 votes
2 answers
201 views

Update NFT metadata after mint

Just need to know how to update NFT metadata after minting NFT. I am trying to use mpl_token_metadata::instruction::update_metadata_accounts_v2 for this. Don't know the correct way to use it or if th …
Abdullah Qureshi's user avatar
4 votes
1 answer
105 views

Add a counter to track NFTs minted

I am trying to create a counter and increment it on every mint. On adding the counter code after deploying when I test it gives me an error on anchor run test: lib.rs snippets: #[account] pub struct …
Abdullah Qureshi's user avatar