Questions tagged [cpi]
Questions using Cross-Program Invocation (CPI) to make calls between on-chain programs
113
questions
0
votes
1
answer
33
views
Transfer SOL out of PDA owned wallet account
Basically I'm trying to figure out to transfer SOL out of a wallet account which is owned by a PDA. the PDA is in turn owned by my program.
I've tried invoke_signed, my seeds are all correct, and I ...
0
votes
1
answer
14
views
MPL token metadata via CPI — cannot provide verified creators, signing error
I'm trying to create a token and its metadata using CPI (anchor lang). Everything works except verifying creators.
Transaction is first created in backend, on client side it is signed and backend ...
3
votes
1
answer
76
views
Anchor CPI invalid program argument
I want to transfer some lamports (100) froma a PDA to an account.
This is the Rust code:
pub fn test(ctx: Context<ApproveEscrow>) -> Result<()> {
// PDA already initilized in ...
1
vote
1
answer
33
views
How to use spl_token account with solana-program-test crate?
I am trying to write a test with the solana-program-test crate for a solana program. This program makes a CPI to a token program:
let ix = Instruction {
program_id: *token_program.key,
...
0
votes
1
answer
20
views
Mutate account data of a program by another program
I have a sender program, and a receiver program. What I want to do is,
sender program has a account, data_account. I want sender program to call modify_data of receiver program, which in turn mutates ...
0
votes
1
answer
52
views
Get a Solana TX to trigger another TX on chain, and wait for that to complete before proceeding to next instruction/step
i know it is possible, but not exactly sure the best implementation currently, whether to use CPI or not, to have a solana tx, execute on chain and have 1 instruction in there effectively execute ...
0
votes
0
answers
74
views
Panic on Solana cross program invocation
Program log: panicked at 'range end index 64 out of range for slice of length 0', src/token.rs:551:38,
failed: SBF program panicked
Where can I investigate 551:38 line of code, or any help on ...
0
votes
1
answer
45
views
Tx Reverting Even If Internal CPI Fails
Creating a CPI call, since it returns a Result. If the internal call throws an error, err should have an err() field as per the definition. The whole transaction should not revert, but it is reverting....
0
votes
1
answer
30
views
Error: memory allocation failed, out of memory [CPI vs invoke_signed]
When I am creating CPI using the anchor CPI feature, I do not encounter a memory allocation failure. However, when using program::invoke_signed, I do encounter this issue.
let mut ireceive_ctx = ...
3
votes
2
answers
62
views
CpiContext with_remaining_accounts is not working because of lifetimes
I'm writing a Solana program with Anchor 0.29.0 and Solana 1.18.9.
I want to invoke through CPI another program. It all worked well until I realised that, the called program needs the remaining ...
0
votes
1
answer
165
views
how to pass `remaining_accounts` from my program to closed-source third-party program?
From on-chain program, calling a normal third-party program (without source code, but has IDL) instruction would be like this:
let accounts_meta = vec![
// ...
];
...
1
vote
1
answer
161
views
CPI "Unknown program 11111111111111111111111111111111" error
yo
im experiementing with CPI calls on devnet (running test validator locally), and I get this "Unknown program 11111111111111111111111111111111" error with An account required by the ...
0
votes
1
answer
37
views
Error processing Instruction 2: Cross-program invocation with unauthorized signer or writable account
I am trying to transfer tokens in a PDA and withdraw from that program, deposit works fine but it throws the error when I withdraw.
pub fn withdraw_token(
ctx: Context<TokenPaymentAccounts&...
1
vote
1
answer
184
views
how to swap between spl tokens inside rust anchor program
I'm going to implement spl token swap with rust inside Anchor project.
Basically it's about compounding logic in staking project, so I have to swap reward tokens into stake token and add it to staking ...
1
vote
2
answers
38
views
Does a CPI method to a program leave any special footprint on the blockchain?
Firstly, do I understand correctly that CPI call is one of the ways to call a method of program?
If so, only by examining a TX on the blockchain, will it be possible to distinguish a CPI call to a ...