Questions tagged [rust]
The rust tag has no usage guidance.
282
questions
0
votes
1
answer
16
views
Warning! Token names and logos are not unique
I mistakenly minted the same token on the mainnet twice, with the same name, symbol, and logo. A warning message appeared in response to this.
Warning! Token names and logos are not unique. This token ...
0
votes
1
answer
33
views
can't create Pool on Raydium
I'm facing issues creating a pool on Raydium. I make a market ID and then want to create a pool with my token paired with USDC(myToken/USDC), it shows an error that the freeze authority can't be ...
0
votes
0
answers
50
views
custom program error: 0x64:
I'm facing an issue while breeding the NFTs. The first test case for initializing the parent and the second test case for computing the child run successfully. This means that the child generation is ...
0
votes
0
answers
13
views
CNFT Lock/Freeze possible?
It is possible to freeze/freezeDelegated for metaplex NFTs. Also pNFTs can be locked in user wallet. I am not able to find any such feature for cNFT, is it possible to freeze/lock cNFT in user wallet?
1
vote
1
answer
64
views
How to organize program's anchor code properly
I have a program with around 10/15 methods, all in the same file which represents 2K lines of code +/-.
I would like to have one file with the method pub fn my_method and the struct #[derive(Accounts)]...
2
votes
0
answers
48
views
Get owner from PDA if the owner is off-curve - DAS API
Is it somehow possible to get and deserialize the owner of the token account if the owner is a PDA and off-curve around this line - https://github.com/metaplex-foundation/digital-asset-rpc-...
1
vote
1
answer
33
views
Send SOL from PDA account to PubKey in anchor
I want to send SOL from PDA to Pubkey. I have saved some addresses in a Vec and now I want to send SOL on these accounts from the PDA account which holds the SOL. How can I send SOL on to these ...
0
votes
1
answer
27
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 ...
0
votes
2
answers
37
views
I need to understand the escrow flow in Rust on Solana
I want to create an escrow program in Rust on Solana with the following requirements: Anyone can send an amount to the escrow, a lottery function runs on the backend to select a winner, and the NFT is ...
0
votes
1
answer
29
views
Error: failed to send transaction: Transaction simulation failed: Attempt to load a program that does not exist
I was working on this repository to breed NFTs on Solana. However, I encountered an error while attempting to mint a new generation. The first two test cases, "Initialize" and "Compute,&...
0
votes
1
answer
24
views
Error in installing anchor?
I don't know what is the problem here ?!
0
votes
1
answer
26
views
Accounts struct composition error: use of undeclared crate or module `__client_accounts_{}`
The following code results in "error[E0433]: failed to resolve: use of undeclared crate or module __client_accounts_test_common". I've seen other programs that use struct composition in this ...
0
votes
0
answers
13
views
Implement get_program_accounts using BanksClient
BanksClient doesn't have a get_program_accounts method. Is there a way to mimic it?
0
votes
1
answer
66
views
How to get accounts data from solana snapshot file?
I need to get accounts information at the given snapshot. For that I untarred the snapshot archive and read account files from the extracted folder. I am not sure how to deserialize the data that is ...
1
vote
1
answer
45
views
Solana deploy gets an error: "Error: Data writes to account failed: Custom error: Max retries exceeded"!
I follow the following instructions to deploy the program: https://docs.solana.com/getstarted/rust
Here are my steps:
solana-keygen new
solana config set --url https://api.testnet.solana.com (or https:...
1
vote
2
answers
57
views
After I add mpl-token-metadata I'm not able to build the program
|
28 | #[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)]
| ^^^^^^^^^^^^^^^^ the trait borsh::BorshDeserialize is not implemented for ...
1
vote
1
answer
21
views
Bad CPU type in executable
Problem
I have a problem on build Rust Solana contract on processor M1. I used a simple example hello world.
use solana_program::{
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, ...
2
votes
1
answer
56
views
Global variables in a Solana program
Is it possible to create global mutable variables in a Solana program? I want to have a global mutable variable that stores some integer, and I'm getting a compilation error when doing so
1
vote
3
answers
58
views
How do I ge the `Token Record` account for a pNFT
Is there a way to access a programmable NFT's Token Record Data using anchor in Rust?
Is there a function for this provided by the Metaplex SDK? I have the address of the account and I just need to ...
0
votes
1
answer
46
views
How to CPI into token_metadata_program with optional accounts
I am aiming to Cross Program Invoke the transfer method of token_metadata_program.
The method takes optional parameters:
...
#[account(6, optional, name="edition", desc="Edition of ...
2
votes
1
answer
44
views
solana play ground - too much SOL for initial deployment and RPC error
I'm trying to deploy some program locally with solana playground, when trying to deploy the program on dev-net the initial deployment costs 4.40 SOL, and when requesting more than 1 SOL(with "...
2
votes
2
answers
125
views
cargo build-bpf rustc version
I'm trying to use "cargo build-bpf" on a simple rust file, I'm using the "solana_program" dependency and the next error occurs:
"error: package solana-program v1.16.5 cannot ...
1
vote
1
answer
30
views
Error: Invalid option while trying to fetch account data with anchor
I'm getting this error
Error: Invalid option endTime
at OptionLayout.decode (node_modules/@project-serum/borsh/src/index.ts:148:11)
at Structure.decode (node_modules/buffer-layout/lib/...
5
votes
1
answer
65
views
Borsh dependency issue with latest versions of crates
I am getting this type of errors
the trait bound `Pubkey: BorshSerialize` is not satisfied
--> src/system_program.rs:343:10
|
343 | #[derive(Accounts)]
| ^^^^^^^^ the trait `...
0
votes
1
answer
95
views
failed to complete: Instruction passed to inner instruction is too large (12884932868 > 1280)
I am trying to optimize size of my code by moving logic to freeze and approve in a separate file. However when I deploy and try to call my contract, I am getting error:
'Program ...
1
vote
0
answers
29
views
Is there any JS library that support slip0023(BIP32 - EDD25519)?
Is there any JS library that support slip0023(BIP32 - EDD25519)?
I know about that Rust support slip0023, but I wanna know about JS library.
2
votes
1
answer
69
views
An Account signing off on all transactions
I need to create a program where only 1 wallet signs and pays all transactions.
Example:
#[derive(Accounts)]
pub struct SignupUser<'info> {
#[account(init, payer = authority, space = 8 + 40 +...
1
vote
0
answers
34
views
How do I test a single function on the Solana VM?
Say I have a test function like this:
#[test]
fn my_test() {
assert_eq!(2 + 2, 4)
}
I could test this with regular cargo test but that will run the function on my OS, not as it would run in a ...
0
votes
1
answer
186
views
WSL_Ubuntu: 'hello-solana': error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
I have seen much around this libssl.so.1.1 issue but no resolution so starting a new thread. Does anyone have line of sight into this issue? I have attempted all suggested fixes in related posts ...
1
vote
1
answer
36
views
How can any program in Solana read an account of another program? Give an example
The Solana docs states that Any program can read or credit another account.
Ref: https://docs.solana.com/developing/intro/programs.
Please explain this line. Does that mean I can extract all past ...
0
votes
1
answer
59
views
Is solana_sdk wasm incompatible with @solana/web3.js?
I'm trying to create a rust wasm crate that takes a TransactionInstruction from js, mutates it, and return it.
I'm trying to use serde-wasm-bindgen to handle the js-wasm interop.
As a test, I have ...
0
votes
0
answers
37
views
How to invoke mpl_token_metadata::processor::lock from custom onchain program?
I have been working with pNFT lock function but I can't figure out how to invoke the mpl-token-metadta function.
Anyone has an experience with lock function?
Here is references.
https://github.com/...
1
vote
3
answers
141
views
Program logged: "Error: memory allocation failed, out of memory"
Program logged: "Error: memory allocation failed, out of memory". ( The error occurs in line data.extend(checkpoint_data_init_data.serialize_struct()) )
This is function in my programA:
pub ...
0
votes
2
answers
209
views
error: package toml_datetime v0.6.2 cannot be built because it requires rustc 1.64.0 or newer, while the currently active rustc version is 1.62.0-dev
I have been scouring my issue all over the internet and stack exchange but nothing that I have found works.
I am using Anchor to manage my Solana programs but keep getting the error:
error: package `...
0
votes
0
answers
21
views
Moving my app on NEAR to Solana
I have an application in NEAR (developed with smart contracts in Rust). Is there any way that I can deploy it in Solana without having to create everything from scratch? Because both use Rust as the ...
5
votes
3
answers
605
views
Program failed to complete: Instruction passed to inner instruction is too large (12884933924 > 1280)
I'm getting an error while executing an initialise code in my smart contract. I'm using Anchor Framework for my code. Below is the struct and the account:
#[derive(Accounts)]
pub struct ...
0
votes
0
answers
29
views
Solana Program: Solana token exchange program errors and warning
I am writing code for a Solana program that exchanges the qgem token with usdc & usdt and I am having errors and warnings I cannot solve. If you will be kind enough to assist me on the project: ...
0
votes
1
answer
28
views
How to ensure unique u16 IDs for accounts?
I'm storing a vector of u16 user IDs. I decided not to store public keys in vector, which I can use as ids or get rid of ids completely instead, however public keys are 32 bytes and will have limited ...
1
vote
1
answer
36
views
BanksClient: should I prefer `process_transaction_with_metadata` over `process_transaction?`
I've noticed that process_transaction (and process_transaction_with_preflight_and_commitment) hangs when a program is missing from BanksServer or when it encounters an AccountInUse error. It probably ...
0
votes
0
answers
27
views
Anchor build error: cannot find version of aho-corasick dependency
I am having trouble building my Anchor project. I first got the error message "cargo pbf require libssl1.0.0". I installed the dependency libssl1.0.0 with the command sudo nano /etc/apt/...
0
votes
0
answers
18
views
Rust Transaction History
I am trying to access the post_token_balances from a transaction in Rust but am having issues trying to get the Vec so that I can iterate through it.
3
votes
2
answers
284
views
Lifetime may not live long enough when passing account into anchor function
I am getting this error when I try to pass an account info into a function and then want to use it in a spl transfer:
pub fn move_in_direction(
&mut self,
direction: u8,
player: ...
2
votes
2
answers
35
views
Is it possible to perform action/calculation in instruction/program and get the returned result directly?
Suppose I am developing an application that allows users to input their current portfolio amount and the annual percentage gains they receive. In Solidity, I can create a function called get_portfolio,...
2
votes
2
answers
87
views
Can I send signed message into a smart contract?
I was wondering If I can sign a message offchain with privatekey, for example using tweetnacl and then send it as an argument to a smart contract. The contract would decide if the message is legit and ...
1
vote
1
answer
113
views
Error: failed to send transaction: Transaction simulation failed: Attempt to debit an account but found no record of a prior credit
i am trying to pay for a transaction to post a title to my anchor code, but we get the error Error: failed to send transaction: Transaction simulation failed: Attempt to debit an account but found no ...
0
votes
0
answers
68
views
Transaction simulation failed: Error processing Instruction 1: custom program error: 0xbbf
I get the following error when trying to execute an instruction:
Transaction simulation failed: Error processing Instruction 1: custom program error: 0xbbf
This is the account:
#[derive(Accounts)]
pub ...
0
votes
1
answer
122
views
failed to send transaction: Transaction simulation failed: Error processing Instruction 0: insufficient account keys for instruction
i am trying to post a title to my program by using the tweetAccount which is the payer and signer of the transaction , but when i run the program i get this error
bigint: Failed to load bindings, pure ...
10
votes
2
answers
2k
views
error: package `winnow v0.4.4` cannot be built because it requires rustc 1.64.0 or newer, while the currently active rustc version is 1.62.0-dev
When trying to run "anchor build" I get this error. I noticed I can run other programs but it seems as soon as i implement the anchor-spl crate i run into this problem. I've tried updating ...
0
votes
1
answer
48
views
Why we need to pass all that accounts into functions in native solana?
I am go through the solana course and I am not understand that basics of writing solana native programs. Why do we need to pass to the functions some AccountInfo slice? Where this adressess should ...
3
votes
1
answer
194
views
Why Vec::push giving memory allocation failed, out of memory error?
For example: I have a struct named Item
#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub struct Item {
...fields
}
and I am storing those items inside a PDA account named UserAccount
#[...