Questions tagged [solana-web3js]
322 questions
2
votes
0 answers
Solana Rust - Failed to serialize or deserialize account data: Unknown
I'm new to Solana and Rust. I've done some modifications with solana js hello world example and the error with borsh serialize and deserialize occurs.
Here is my rust program:
use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{
…

umaid ashraf
- 79
- 5
2
votes
3 answers
How to get token id for solana NFT
Is there a solana/web3 function to return the token id of a NFT?
I'm not sure if that's a thing on Solana or if Opensea is adding those.
For example, opensea says this one is #52

pguardiario
- 53,827
- 19
- 119
- 159
2
votes
1 answer
How can I fix the issue of "TypeError: mint.toBuffer is not a function"?
Solana, and I use this function:
const fromTokenAccount = await getOrCreateAssociatedTokenAccount(
connection,
fromWallet,
mintPublickey,
fromWallet.publicKey
);
and version is:
…

Jun Shi Yan
- 81
- 9
2
votes
1 answer
Solana program to send multiple lamport transfers and emit event
I’m building a program intended to manage multiple payments with one call. The program needs to complete the following steps:
Accept a certain amount of lamports
Pay a portion of the received lamports to specified wallets, such that the amount…

Robert May
- 799
- 6
- 13
2
votes
1 answer
the trait `anchor_lang::AccountDeserialize` is not implemented for `anchor_spl::token::Mint`
I am trying to CPI the Token Program to send spl-tokens to a wallet. For this the derive accounts in the context struct has three accounts without any attribute over them:
mint_token_out: Account<'info, Mint> (which is the mint address)
token_out:…

Vipul
- 21
- 3
2
votes
3 answers
Use PDA account as shared Storage solana
My intent here is to have account that can store data to be used by program. I will be passing this account in every call I make to my onchain program. And if I try to call allocate from onchain, then it's results in 's writable…

Sudip Ghimire
- 677
- 6
- 15
2
votes
0 answers
how to specify web3 provider/wallet in javascript
If you have multiple wallets installed how do you specify which one to "connect" on following this given example:
function getProviders() {
if ("solana" in window) {
const provider = window.solana;
if (provider.isPhantom) {
// handle…

Ari
- 5,301
- 8
- 46
- 120
2
votes
2 answers
Update Hidden Settings After Initial Upload
I'd like to change my Candy Machine from having hidden settings to no longer be hidden.
Initially, the Candy Machine is created with hidden settings like these:
hiddenSettings: {
name: "Name",
uri: "uri..."
hash:…

joshyai
- 23
- 3
2
votes
1 answer
How to request transfer of NFT using @solana/web3.js
I am working on a web application where a NFT owner can stake their NFT and earn rewards.
In my application I need to create a transfer request of the NFT from the users wallet to my applications wallet.
Code Example:
import { Connection, PublicKey…

Duppie
- 93
- 1
- 9
2
votes
0 answers
Transfer NFT using Token.createTransferInstruction
We have a transaction that transfers SOL & an NFT from the wallet's owner to our wallet.
The transaction contains simple instructions:
Token.createAssociatedTokenAccountInstruction
Conditionnal, depending on the destination (our…

user2517028
- 784
- 1
- 11
- 25
2
votes
1 answer
How do i fetch the idl of any program deployed on solana mainnet by its program address?
I want to fetch the IDL that anchor normally generates for any deployed solana program by just its program address on the client side
How to do this?
UPDATE:
My bad I didnt take the time to research this properly, you can use this line of code const…

Anoushk
- 551
- 7
- 20
2
votes
1 answer
Getting error: failed to download `solana-frozen-abi v1.9.9` while running anchor test on macbook m1
Guys while i was running anchor test on macbook m1, i am getting this error. Does anybody have a fix for this.
BPF SDK: /Users/dhruvjain/solana/bin/sdk/bpf
Running: rustup toolchain list -v
Running: cargo +bpf build --target bpfel-unknown-unknown…

Dhruv D Jain
- 33
- 5
2
votes
1 answer
How can I pass enum as parameter using solana/web3.js?
I defined UserAction enum in the Solana program.
#[derive(AnchorDeserialize)]
#[derive(AnchorSerialize)]
pub enum UserAction {
VIEW,
LIKE,
SHARE,
COMMENT,
DOWNLOAD,
}
Using this in an entry point.
pub fn my_fun(ctx:…

Xueming
- 168
- 1
- 1
- 11
2
votes
1 answer
How can I see the contract code in Solana?
On Ethereum, I can go to the Etherscan link for a contract address and view the code and Read/Write ABIs. I can't seem to find this on Solana Explorer, Solscan, or anything. What's the best way for me to see IDL signatures and/or the Rust code in…

Edward Sun
- 1,541
- 3
- 15
- 26
2
votes
2 answers
Instruction 0: incorrect program id for instruction. Works on devnet but not mainnet
I am trying to make a spl-token transfer from a user wallet. The code below works perfectly on the devnet but throws Transaction simulation failed: Error processing Instruction 0: incorrect program id for instruction . It creates an associated token…

Mike O
- 85
- 6