Skip to main content
6 votes
Accepted

Anchor IDL address missing from json

"metadata": {"address": "pubKey"} may disappear when running anchor build you will get it back once you run anchor deploy.
Abdullah Qureshi's user avatar
6 votes
Accepted

Fetch onChain IDL from Program ID

A published Anchor IDL is stored in a separate account, based on a PDA. So reading an Anchor IDL is essentially just a getAccountInfo RPC call. You just need to first find the PDA for it (locally). No ...
sohrab's user avatar
  • 1,781
6 votes

How do I interact with closed-source Solana programs with no public IDL?

Depending on whether the program is written in Native Rust or Anchor, your course of action may vary. A few options: Use Metaplex Shank: https://github.com/metaplex-foundation/shank If there's no ...
Joey Meere's user avatar
  • 1,445
6 votes
Accepted

Anchor IDL different (incorrect?) from Solana Playground IDL generated

This is because the IDL has been rewritten, and it's incompatible with the old IDL. There is also a new release (v0.30.0) which was released 2 days ago. Solana Playground has not yet upgraded to the ...
acheron's user avatar
  • 2,699
5 votes

VecDeque in Anchor

Not sure if it is supported, but you won't see much (really any) performance gain over Vec. Your on-chain memory usage is typically limited to a few hundred items at best and push/pop from the head ...
Whiteseal's user avatar
  • 3,214
5 votes

How to get the IDL of a Solana Program?

As far as I know, there are currently a few ways to get the IDL: Through the source code of the Program, if it's open source. Through Anchor CLI via anchor idl. Metaplex Shank: https://github.com/...
0xMertimus's user avatar
4 votes
Accepted

Anchor: does an account being initialized (not PDA) need to be a signer?

There's two steps to creating a program account send an instruction to the system program with the space required for the account and intended program owner of the account the owning program ...
Henry E's user avatar
  • 3,050
4 votes
Accepted

How do we call solana methods if program.rpc deprecated?

Try adding .rpc to the end of await program.methods to send the transaction Example format below, (signers([]) can be excluded if there are not additional signers required): // sends transaction await ...
john's user avatar
  • 7,487
4 votes

IDLs explorers - Curiosity

I've taken a look and this is an Explorer bug: https://github.com/solana-labs/explorer/issues/316 Sorry about that! There's an error being caught when we try to parse your IDL: "Tuple enum ...
Callum M's user avatar
  • 3,190
3 votes

How to deserialized Anchor accounts in Rust

Anchor will handle this if the struct is from your crate, pub my_acc: Account<'info, SomeStruct> will decode for you. If you are using a struct from another crate, you can use: pub fn ...
Whiteseal's user avatar
  • 3,214
3 votes

Is it possible to retrieve an IDL using getAccountInfo() without brute forcing anchor decode() on the accounts

If there's an IDL published on-chain you can use fetchIdl For example: const IDL = await anchor.Program.fetchIdl(new PublicKey("...program ID here..."), provider);
john's user avatar
  • 7,487
3 votes
Accepted

Intitalize Solana Program through IDL

Unfortunately, anchor_client is not IDL-aware. It is intended for scenarios where you have access to the source code (or crate) of the program you are calling. You can see an example of this the ...
sohrab's user avatar
  • 1,781
3 votes

Anchor: does an account being initialized (not PDA) need to be a signer?

Yes, pixel needs to be included in the signer's array. Wherever we init any account except PDAs, the account needs to sign for their account creation instruction. So that we can prove that we have the ...
0x Deep's user avatar
  • 161
3 votes
Accepted

Using Fs to fetch idl error: "Module not found: Can't resolve 'fs'"

The fs module doesn't exist in the browser, it's a built-in node module for reading from the file system. Instead, try to import the file. import idl from "../idl/BigBazaar_IDL_Devnet.json"; ...
C.OG's user avatar
  • 2,837
3 votes
Accepted

Anchor: Change Localnet to Devnet

In your frontend try setting up AnchorProvider like this: const { connection } = useConnection() const wallet = useAnchorWallet() const provider = new anchor.AnchorProvider(connection, wallet, {...
john's user avatar
  • 7,487
3 votes

How do I interact with closed-source Solana programs with no public IDL?

In addition to Joeys answer: Not quite sure how much it will help you, but you can decompile solana programs like so if you have the .so file. Not sure if that will also work when you download it from ...
Jonas H.'s user avatar
  • 5,787
3 votes
Accepted

What is an IDL?

Answering my own question to help others: IDL stands for Interface Definition Language. They are a way for a Solana Program to define it's public interfaces i.e. it's instructions, account formats, ...
Ahri's user avatar
  • 4,727
3 votes

Type 'SolanaNftAnchor' is missing the following properties from type 'Idl': address, metadata

As per this answer, it's because the IDL spec was rewritten with the 0.0.30 release and it's incompatible with previous versions of anchor. Please update your anchor TS client version to 0.0.29 "@...
Jimii's user avatar
  • 3,770
3 votes
Accepted

Are there any security risks by adding the program IDL in client side code?

No. The IDL just gives you an easy way to parse what data is stored and what instructions exist for an onchain program. If you have some data/instruction in there that is security critical and you don'...
Ahri's user avatar
  • 4,727
2 votes

Is there any way to fetch all anchor idl's?

Such call is a bit of an edge case and very heavy. If you really need to find all IDLs you can craft this manually but make sure you are using your own RPC provider, this would probably not work and ...
Arowana's user avatar
  • 2,273
2 votes
Accepted

Can I get magicEden's escrow program IDL?

You can extract the price by analyzing instruction data. In your example, you know from the logs that listing price is 9050000000. Using any decimal to hex converter, we can see that in hex this ...
Vladyslav Melnychenko's user avatar
2 votes
Accepted

Anchor IdlError: Type not Found for usize

in Solana eBPF usize and isize are equivalent to u64 and i64 respectively. Change the following to { "name": "size", "docs": ...
vicyyn's user avatar
  • 4,095
2 votes

How to get the IDL of a Solana Program?

The easiest way that I know of is fetching the IDLs that Anchor generates (if the program you're interested in uses Anchor) See this example code snippet: const anchor = require('@project-serum/anchor'...
NHeinDev's user avatar
  • 306
2 votes

Reference for supported IDL types

Try using a u8 slice instead of usize, the latter has a variable size depending the system. All primitives are supported, and your own structs made of primitives, and a few other types like Pubkey, ...
Whiteseal's user avatar
  • 3,214
2 votes

IdlError: Type not found for custom struct

When defining the struct, you need to use #[derive(Debug, Clone, AnchorSerialize, AnchorDeserialize)] so the struct can be properly deserialized and serialized to be used in the anchor account macro
brimigs's user avatar
  • 196
2 votes

How to get full IDL for a Solana program?

Just doing some digging, looks like ArAA6CZC123yMJLUe4uisBEgvfuw2WEvex9iFmFCYiXv is not actually the Metaplex Candy Machine. It's a modified version maintained by Launch My NFT platform. The IDL on ...
AMilz's user avatar
  • 1,566
2 votes

how to make a proper schema for the arguments

Pubkey is not part of the borsh specification. It can be represented as a [u8; 32] instead. Should look something like: class MyArgs { decimals: u8; mintAuthority: PublicKey; freezeAuthority: ...
Ademola's user avatar
  • 3,853
1 vote

Converting JS IDL to Python

IDL is just JSON data. You can simply use Python's json module to load it as a dictionary in your Python code. For example: import json with open('idl.json') as f: data = json.loads(f) print(...
Syed Aabis Akhtar's user avatar
1 vote

How to parse the inner instructions of the transaction's instruction?

Off the top of my head but should be close enough: for (const inner of tx.meta.innerInstructions) { for (const i of inner.instructions) { if (i.parsed.type === "transfer") { const amount = i....
spaghetti's user avatar
  • 321
1 vote
Accepted

Unable to upload Solang generated idl

As a temporary workaround, since idl files are simple .json files you can bundle it within the web-app and load it with a simple: import idl from "./testprogram.json"; ... new anchor.Program(...
CrossedCarpet's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible