All Questions
29 questions
0
votes
1
answer
29
views
will it fail if the program tried to create an account with the same seeds multiple times , although the bump exists ? using anchor
#[account(
init,
seeds = [
AMM_CONFIG_SEED.as_bytes()
],
bump,
payer = admin,
space = 8 + AmmConfig::INIT_SPACE,
)]
pub amm_config: ...
1
vote
1
answer
59
views
Avoid unnecessary account generation
For context, I am trying to implement a contract I have on solidity to solana.
On solidity, I have a function like this, which writes data to state based on a condition.
function handleMessage(bytes ...
0
votes
1
answer
70
views
Who gets to create token associated accounts on Solana?
I understand the differences between token mint accounts and token associated accounts. As I'm building a web-app allowing people to mint spl tokens on our website, we are facing a question about who ...
2
votes
2
answers
278
views
Zero_copy not working , Getting `Zeroable` is not implemented for `[Event; 25000]`, while trying example
I'm trying This example by anchor to initialize large accounts and using zero_copy on them.
https://github.com/coral-xyz/anchor/blob/master/tests/zero-copy/programs/zero-copy/src/lib.rs#L156-L165
I'm ...
0
votes
1
answer
92
views
why "Transaction references a signature that is unnecessary" warning, and value of 'isSigner' is false in IDL?
I was playing with counter program in program-example repo.
When run test, I got warning: Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts ...
1
vote
1
answer
489
views
"Access violation in stack frame 3 at address 0x200003ff0 of size 8 by instruction #35516" , even though I use zero copy on my account struct
This is my account struct
pub struct ClaimRewards<'info> {
#[account(init_if_needed, payer = payer, seeds = [OKUSEED.as_ref()], bump, mint::decimals = 6, mint::authority = mint)]
pub ...
1
vote
0
answers
48
views
'Program failed to complete: Instruction passed to inner instruction is too large (12884933932 > 1280)', Getting this error [duplicate]
I'm getting this error
Program logged: "Instruction: CreateVester"
> Program consumed: 5565 of 200000 compute units
> Program returned error: "Instruction passed to inner ...
2
votes
1
answer
317
views
How to create an account in any other program using CPI in which PDA is used as signer and payer
I just want to invoke initialize method of callee program from caller program in which pda account should be signer.
Callee Program
#[program]
mod callee {
use super::*;
// I want to call ...
0
votes
2
answers
2k
views
How to define a variable to a public key in anchor? [duplicate]
I want to hardcode a public key in my anchor Solana program and then compare it with the public keys passed to the functions of the program. Can someone please tell me how can I declare a variable ...
1
vote
1
answer
1k
views
Can we change the owner of a Solana account?
I have a solana account created by a solana program deployed on the devnet. Is it possible to change the owner of the account? If yes then can you please tell how to do it?
0
votes
1
answer
198
views
Can solana accounts be made immutable?
I have recently started learning about solana development and realised that solana accounts created by solana programs are mutable. Is there any way we can make them immutable? Also can you please ...
1
vote
1
answer
1k
views
Error: AnchorError: AnchorError caused by account: base_account. Error Code: AccountNotInitialized
I wrote a Solana Program with two functions, one for the initialization of an account and a second to upload data to the account. While testing on localhost it was working fine, but when I uploaded it ...
3
votes
1
answer
641
views
Can Solana Accounts be accessed by any Solana Program using its address?
If I have a deployed Solana Program which creates some Solana accounts for storing data in it. Can these Solana accounts be accessed by any other Solana program using the account addresses? I am ...
1
vote
0
answers
45
views
How to call another instruction from the same Anchor program (No CPI) [duplicate]
Is there a way to invoke an instruction within the same program? just for the sake of code reusability, I know we can achieve this easily with CPI when invoking different programs instructions, but I ...
1
vote
2
answers
515
views
How do you deal with a changing account state?
Let us suppose that you want to update an account state to include a new field.
pub struct MyState {
pub a: u8,
pub new_field: u8
}
This means that fetching and decoding the old accounts prior to ...
1
vote
1
answer
229
views
How to handle multiple tokens + SOL in a payments program?
Context
Depending on the item price in USD, users should be able to pay for items with different tokens/currencies (this is made possible with Switchboard Oracles). The payments then go towards a ...
1
vote
2
answers
187
views
What happens to old program-owned-accounts when adding a new field to the account structure?
Let us suppose users are able to create a program-owned-account: PurchaseItemAccount, which is deployed as:
{
id: u64
price: u64
}
After some time, I then decide to add a field, ...
1
vote
3
answers
146
views
How much of a PDA can a program control
How much of a PDA is under the control of its owner program? For example, could the program block the account from signing certain instructions on transactions? Or could the program add a fee to every ...
2
votes
1
answer
1k
views
Handling multiple accounts
I'm having a hard time trying to understand the best way (even better, trying to fully understand a way) to handle multiple accounts (both client(js / ts) and program(anchor/rust) side).
If I want to ...
3
votes
1
answer
282
views
Fetching transaction ID that created account
Background:
In my application I am creating an account to store some arbitrary information.
I then want to display the transaction id/address of the transaction that created such an account.
Question:
...
5
votes
2
answers
2k
views
How do I fix 'please minimize large stack variables' error while testing my anchor program?
I'm getting the following error using Anchor 0.25.0 Stack offset of 11792 exceeded max offset of 4096 by 7696 bytes, please minimize large stack variables initializing my accounts on local testing.
I'...
2
votes
1
answer
168
views
Walllet is "locked". Can't pay transaction fees to close/update program
I am currently facing this issue that doesnt let me close my program (I don't really want to loose all the rent right now)
https://forums.solana.com/t/help-me-my-wallet-was-locked-unable-to-pay-a-...
1
vote
2
answers
288
views
Solana/Anchor, what are the differences between types Account and ProgramAccount?
https://github.com/coral-xyz/anchor/blob/master/CHANGELOG.md#0150---2021-09-07
Account is introduced to replace ProgramAccount and CpiAccount.
ProgramAccount checks if the account owner is the program ...
3
votes
2
answers
514
views
Store text as string vs. bytes
Is there any advantage to using Vec<u8> over String to store text in storage account fields? And if so, why? From a storage perspective, they are nearly handled identically as far as I can tell ...
1
vote
2
answers
1k
views
Account size calculation when using vectors
I just measured account size with std::mem::size_of because I was curious how space is calculated for vectors. Following the docs, I would have assumed that size_of would add 4 bytes for each vector, ...
1
vote
2
answers
61
views
How likely is it that no bump will be found when searching for a PDA given some seeds and program_id?
The rust docs outline that
The processes of finding a valid program address is by trial and error, and even though it is deterministic given a set of inputs it can take a variable amount of time to ...
3
votes
1
answer
2k
views
How to close a PDA account?
#[account(
init,
seeds =
[
b"config".as_ref(),
mint.key().as_ref(),
],
bump,
payer = sender,
space = 90
...
5
votes
3
answers
658
views
how to fetch list of all pda accounts in frontend? like sale account instance to display in the market? or should i be fetching from token account?
i have a sale order account defined like this..
#[account]
pub struct Order {
pub creator: Pubkey,
pub mint_key: Pubkey,
pub memo: String,
pub price: u64,
pub bump: u8,
}
And this ...
0
votes
0
answers
26
views
Possible to accept/pass in a list of accounts to program API? [duplicate]
pub struct Example<'info>{
pub mint: Account<'info, Mint>,
pub system_program: Program<'info, System>,
pub token_program: Program<'info, Token>,
pub rent: ...