All Questions
14
questions
0
votes
0
answers
7
views
want to what's wrong in my contract as i can't able to call my deposit function
use anchor_lang::prelude::*;
use anchor_spl::token::{self, Token, TokenAccount, Transfer as SplTransfer};
// use solana_program::system_instruction;
use solana_program::{account_info::AccountInfo, ...
1
vote
1
answer
95
views
get transactions/logs from different program, on a span of blocks
Here is the situation:
I'm using Rust.
I need to be able to "listen" to transaction, or at least logs from a list of solana program. I cannot use Websocket's "logsubscribe" ...
1
vote
1
answer
245
views
"package solana-program v1.18.7 cannot be built" error [duplicate]
I have a new Rust project that gives the following error when I compile it.
package `solana-program v1.18.7` cannot be built because it requires rustc 1.72.0 or newer, while the currently active rustc ...
1
vote
1
answer
66
views
How to pause program on Solana?
How can I pause program in Anchor on Solana like pause provided by Solidity?
I know programs on Solana is stateless, but I need to achieve this function.
2
votes
1
answer
130
views
Deserialise getAccountInfo data from Rust rpcclient for a PDA from drift protocol
Basically I have the following code in devnet. I want to call getAccountInfo to get some account information.
I have a PDA: JD71QyQpAJvoyq4p6mfwyaw4rY9qaDLk4CQpHeuPSpEK created by the programId: ...
2
votes
1
answer
48
views
How is the PDA created for this program?
in this code example:
use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{
account_info::{next_account_info, AccountInfo},
declare_id,
entrypoint::ProgramResult,
msg,
...
0
votes
1
answer
31
views
CustomAccount deserialization issue
I have this piece of code, it skips the first 8 bytes of the account data as that's the descriminator
pub struct CustomProgramAccountStruct {
pub pubkey: Pubkey,
pub authority: Pubkey,
pub ...
1
vote
1
answer
143
views
Cannot perform a CPI call using anchor
I tried to make a CPI call from puppret_master to puppet program exactly like the anchor document and i did everything right but "program" AND "cpi" keywords are still unkown for ...
2
votes
1
answer
41
views
On-chain program security related question (non-anchor)
What checks or kind of security should I implement if I'm developing an onchain program without using Anchor-lang?
4
votes
1
answer
481
views
How to deal with floating point arithmetic in solana programs
Let us suppose an item A costs 5 USD and I want to purchase this item with the equivalent SOL amount inside my solana program.
For robustness, I am fetching the price from within the program using an ...
3
votes
2
answers
110
views
What Rust Crates are allowed in Solana Smart contract?
I'm wondering if it is possible to implement a federated averaging function on solana. But im not sure if I can use the crates that would allow me to do that.
Here are the crates i wanna use.
Numpy
...
5
votes
1
answer
683
views
Create Token Account only if not Initialized yet in program (Native Rust)
Doing this in Typescript is pretty straightforward by making an RPC call or getOrCreateAssociatedAccount, but I am wondering if there is a way to do this program side as well without using Anchor.
For ...
2
votes
1
answer
205
views
Avoiding "Stack offset of X exceeded max offset" error
I'm trying to understand how to best avoid this Stack error. At first I thought this was just related to serialising/deserialising data as if i tried to get more than 4096 in one chunk I got the ...
8
votes
2
answers
749
views
How do I create an NFT using Anchor?
What is the simplest way to create an NFT using Anchor, without using the candy machine.
The goal is to be able to mint a token and corresponding metadata. Ideally with a single instruction.