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 answers only not deleted user 84
0 votes

How can we make comparisons using clock.unix_timestamps and the time provided by the instruc...

It looks like your logic on checking for poll start might be backwards. Try flipping the check: require!(poll.poll_start as i64 < clock.unix_timestamp, ErrorCode::PollNotStarted); Assuming that the …
Jon C's user avatar
  • 19.6k
0 votes

could not find `instruction` in `self` when putting code in a separate file

There's actually two issues in that error message: using the correct Borrow. It looks like there's crate::Borrow and crate::accounts::Borrow in the local context, and I think crate::Borrow is the one …
Jon C's user avatar
  • 19.6k
0 votes

Initialized accounts aren't getting recognised when testing on localnet using anchor

This is just a guess, but since there's both owner_account and owner_init_account, is it possible that only owner_init_account is getting initialized, and not owner_account? Also, note that if you cre …
Jon C's user avatar
  • 19.6k
3 votes
Accepted

What exactly are `Interface<'info, T>` and `InterfaceAccount<'info, T>`

The Anchor account types documentation says: Interface: Type validating that the account is one of a set of given Programs This just means that the given account is one of a set. For example, if you …
mikemaccana's user avatar
  • 2,754
1 vote

struct takes 0 lifetime arguments but 1 lifetime argument was supplied expected 0 lifetime a...

You've imported the Account from the SPL Token account, and not the Anchor account. Try to remove use anchor_spl::token::spl_token::state::Account; since the Anchor Account is part of the Anchor prelu …
Jon C's user avatar
  • 19.6k
1 vote

Anchor build not working

This looks like a bug in the typenum crate that you're using. You're using Windows, which doesn't allow for / in the paths, but the code is trying to include a file directly at https://github.com/paho …
Jon C's user avatar
  • 19.6k
1 vote

Is there a way to get program id of CPI call?

The information about the caller program is not provided to a callee program during CPI, but there's a workaround. You could verify the caller program id by: including the caller program id as instru …
Jon C's user avatar
  • 19.6k
1 vote

cannot transmute between types of different sizes, or dependently-sized types

This is a guess, since the error message is confusing, but you should try to make sure that your type aligns on an address of 1 using arrays, ie: #[zero_copy] #[repr(C)] #[derive(Debug, Default)] pub …
Jon C's user avatar
  • 19.6k
2 votes

Is it possible to figure out which instruction is causing the stack access violation

The function is given in the error message: _ZN112_$LT$solana_program..instruction..InstructionError$u20$as$u20$solana_frozen_abi..abi_example..AbiEnumVisitor$GT$13visit_for_abi17h14ef924a4ab59970E A …
Jon C's user avatar
  • 19.6k
1 vote

anchor_lang::AccountDeserialize

If you're doing it by hand, your implementation of AnchorDeserialize is entirely up to you! The idea is that, given a bunch of bytes, you try to create an instance of Example out of it. So in your exa …
Jon C's user avatar
  • 19.6k
0 votes

How to transfer SOL to remaining_accounts from the signer account

This is a Rust issue. There isn't enough information given about the error in the question, but I think it might be borrowing parts of ctx.accounts.user: using key() and to_account_info(). Try changin …
Jon C's user avatar
  • 19.6k
1 vote

Validate secp256k1 ethereum signature?

The instruction expects it'll receive raw bytes, and not a hex string, so you'll also need to decode the hex strings as bytes: let recovered_pubkey = secp256k1_recover( &hex::decod …
Jon C's user avatar
  • 19.6k
1 vote

NFTs on anchor tests

Most likely, the Metaplex metadata program is not present in your testing environment. You can dump the program by running: solana program dump metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s mpl_token_me …
Jon C's user avatar
  • 19.6k
1 vote

What is the meaning of "custom program error: 0x1771" erro?

0x1771 translates to 6001 in decimal. Anchor appears to start its error codes at 6000, so this would be the second error in the program. If you look at the IDL for the invoked program, you should be …
Jon C's user avatar
  • 19.6k
1 vote

Is there any rust function available for getParsedAccountInfo similar to typescript from sol...

Yes! The rpc client provided by solana-rpc-client has get_account_with_config that lets you specify it: let account_address = Pubkey::new(...); let rpc_client = solana_rpc_client::rpc_client::RpcClien …
Jon C's user avatar
  • 19.6k

15 30 50 per page