Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Should be used for all things relating to the Anchor Framework.
1
vote
AccountInfo -> Signer for CPI calls
Maybe this will do the trick:
Signer::try_from(&self.my_account.to_account_info()).unwrap()
1
vote
1
answer
166
views
How do I prevent logs from being truncated?
'Program log: Instruction: PositionSwap',
'Program log: a_to_b: true',
'Program log: amount: 0',
... 15 more items
],
programErrorStack: ProgramErrorStack { stack: [ [PublicKey], [ …
0
votes
Accepted
How do I prevent logs from being truncated?
Simple fix:
} catch (e){
console.log(e)
}
} catch (e){
console.log(e.logs.slice(-50))
}
0
votes
1
answer
51
views
How do I throw an error if there are other instructions in a transaction?
I'm using anchor, and would like a handler call to error if there are other instructions within the same transaction. How can I accomplish this? …
6
votes
1
answer
702
views
How can I read custom return data from a transaction?
I have a program (using Anchor), and a I wish to return a value from an RPC call. … Edit: example here: https://github.com/coral-xyz/anchor/blob/master/tests/cpi-returns/tests/cpi-return.ts#L45-L68 …
4
votes
2
answers
122
views
AccountInfo -> Signer for CPI calls
What is the best way to transform an AccountInfo into a Signer for CPI calls?
Is there another way I should be thinking about this?
My signer in this case is a PDA, which cannot sign the initial call …
1
vote
1
answer
388
views
how do I use Token2022 with local Anchor tests?
I've downloaded and built the token 2022 program, and added to the Anchor.toml like this:
[[test.genesis]]
address = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
program = "spl_token_2022.so"
Howeve …
6
votes
Accepted
how do I use Token2022 with local Anchor tests?
The issue ended up being init for an associated token account. As of 0.27.0 init uses the regular Token program, so it was trying to create a regular Token ATA when it needed a Token2022 ATA. There is …
0
votes
1
answer
157
views
program return data to client error
I'm using anchor, and attempting to use the functions below:
const getReturnLog = (confirmedTransaction) => {
const data = confirmedTransaction.meta.returnData.data
const buffer = Buffer.from(data … error:
Error: Expected buffer length 8 isn't within bounds
with console.log (as printed in the function above):
[ 'c9an9AM=', 'base64' ]
<Buffer 73 d6 a7 f4 03>
Also see:
https://github.com/coral-xyz/anchor …
0
votes
1
answer
448
views
Intermittent "Invalid Account Discriminator" Error
I have a few dozen "position" accounts for a user's positions in my AMM program.
I previously had been getting these with a getProgramAccounts filter, which I understand is not very performant. So I t …