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 not deleted user 1591

Should be used for all things relating to the Anchor Framework.

1 vote

Error: memory allocation failed, out of memory. When using dynamic seed in anchor

You need to match arguments in your #[instruction(....)] macro above the context to what is being provided in the function arguments in the same order. I'm guessing that this would work: #[derive(Acco …
mega_creamery's user avatar
1 vote
Accepted

How to sign a transaction with keypair?

You add signers like this as well as system program since you are creating a new account: await program.methods .createUserAccount("reasje", "091445685177", "") .accounts({ user: provider.wallet.pub …
mega_creamery's user avatar
2 votes
Accepted

Mismatched types on custom error

The following code snippet illustrates the implementation of custom errors within a program. use anchor_lang::prelude::*; declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); #[program] p …
mega_creamery's user avatar
1 vote
2 answers
153 views

Are enums with associated values permitted?

Not sure if this is really an anchor or solana related question, since I am able to compile, just not to run tests. …
mega_creamery's user avatar
2 votes

Are enums with associated values permitted?

So try/catching Loading of the IDL in my unit test: let program; try { program = anchor.workspace.ProgramA as Program<ProgramA>; } catch (err) { console.log("err: ", err); } Gives me: e …
mega_creamery's user avatar
3 votes

How to create a mint account on anchor test?

If you are intending to test much of SPL related logic within your smart contract, you can set it up for each test manually. This is (roughly) the script I used at the start of my test file. It is qui …
mega_creamery's user avatar
1 vote
1 answer
61 views

How to fetch constants from a program?

So to fetch the current state of given account I'd do: let acc = await program.account.<ACCOUNT_TYPE>.fetch(<ADDRESS>); Programs can have hardcoded constants (which can be changed upon contract redep …
mega_creamery's user avatar
3 votes
3 answers
285 views

Extending struct fields in a PDA and ensuring compatibility

I need to extend the fields I have within a PDA. Some accounts are already live, so I want those to still be compatible with the new layout. As a simple illustrative example, consider this account str …
mega_creamery's user avatar
1 vote

NFT Breeding Alogrithm

The problem with accomplishing what you want is that metaplex metadata is stored off-chain so you can't really use it on-chain, or at least in a trustless manner. Raindrops extends functionality of me …
mega_creamery's user avatar
3 votes
1 answer
279 views

How do you repopen a closed account?

If an account has been closed with the following anchor context: #[account( mut, close = user, seeds = [ SEED_SCHEMA.as_bytes(), &user.key().as_ref(), …
mega_creamery's user avatar
0 votes
0 answers
13 views

Strange error from adding account address validation

I am working on a program that invokes drift. It all works fine, just adding assertions now. I have changed this account: #[account(mut)] pub user_stats: AccountInfo<'info>, To this: #[account( m …
mega_creamery's user avatar