Search Results
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 |
3
votes
Accepted
Communication between front end and smart contract
So typically how an Anchor application works is that you have the smart contract, a frontend for the user to interact with, and in-between that are calls to the smart contract using the @project-serum …
2
votes
Accepted
Error in compiling an anchor program
You forgot to add a <'info> for your Initialize accounts struct.
#[derive(Accounts)]
pub struct Initialize <'info> {
#[account(init, payer = signer, space = 8 + 8)]
pub new_account: Account<'i …
1
vote
How can a Solana Rust smart contract get block height or Unix time?
What you have above is how the smart contract "itself" gets the current time.
When you add anchor.web3.SYSVAR_CLOCK_PUBKEY to your accounts, you're not passing in time from the frontend. You're simply …
1
vote
How to create Global authority for pool
Your seeds for global_authority in the validator are [GLOBAL_AUTHORITY_SEED.as_ref()]. Your signer seeds are [GLOBAL_AUTHORITY_SEED.as_bytes()]. These don't match and that's why you're getting that er …
1
vote
Accepted
Problem after anchor build
This is an issue with Anchor 0.26. It won't actually stop your project from being built so you should just ignore it.
3
votes
is it possible to make automatic transaction on solana?
Clockwork lets you do this. It's an automation engine that lets you schedule transactions.
Check out this repo for an example of on-chain usage. Here a Pda is given delegation over a token account, ma …
5
votes
How can I receive SOL from an account into a program?
You’ll have to make sure that both the sending and receiving account are marked as mut on the client side.
If you’re using anchor, you can do this by annotating the account field with the #[account(mu …
6
votes
Accepted
What does #[account] do in Anchor beside adding constraints?
Short answer:
The answer is that there's no difference. In this case, #[account] has no effect in the generated code. The reason for this is that the parsing logic for the #[account] macro in this spe …
0
votes
Error: failed to send transaction: Transaction simulation failed: Error processing Instructi...
0x0 means that you're attempting to initialize an already initialized account. If tx initializes your vote account then tx1 fails because it tries to initialize it again.
1
vote
How do pass Context into multiple helper functions?
Try this:
impl<'info> BuyIn<'info> {
pub fn transfer_to_vault(&self, amount: u64) -> Result<()> {
let cpi_context = CpiContext::new(
ctx.accounts.system_program.to_account_info …
3
votes
Lifetime may not live long enough when passing account into anchor function
'info is a lifetime, a rust concept. tldr is that a struct A that holds a reference to some type B must specify a lifetime. This lets the compiler enforce that A isn't "alive" after B has "died". …
3
votes
How to define constant Pubkeys while developing with Anchor?
A way to do it is to define the key as a const with type &str. To use it in your program as a Pubkey you'd only need to parse it into a Pubkey. For example:
const MINT: &str = "2TPExuywxs4K7J2WAE8N8Fi …
3
votes
InstructionFallbackNotFound. Error Number: 101. Error Message: Fallback functions are not su...
You can only conveniently access code written in Anchor with the interface Anchor provides through its ts package.
This is because the entrypoint to an Anchor program first attempts to strip any instr …
1
vote
How to define a public key variable for use in the instruction with a lifetime of the Contex...
Simply deriving or hardcoding a public key on-chain is not enough to make it acceptable as an account. Any accounts you need must be passed in from the client-side. In this case the right move would i …
2
votes
0x0 error when trying to send NFT into PDA vault
Quoting an answer to this exact issue as shown here, with minor changes:
"0x0 means you're attempting to initialize an already initialized account. What's happening here is that because your vaultAcco …