4
votes
Accepted
How can I convert a number to a base58 string?
As per the documentation for bs58:
encode(input) input must be a Uint8Array, Buffer, or an Array. It
returns a string
const bs58_string = bs58.encode(Uint8Array.from([2]))
3
votes
OR logic in memcmp filter
It's not possible to do it one call, since the filters are always additive in get_program_accounts. For OR behavior, you'll need to make two separate calls.
More information on get_program_accounts at ...
2
votes
How to find the exact location of a string on an account using memcpm offset
Referencing one of the answers in this question: How the scope for memcmp works when the struct has multiple strings?
Seems like you would need to add padding for any unused space:
You would have to ...
1
vote
Accepted
memcmp filter similar to LIKE %
base58 is simply the encoding used when sending data, it doesn't affect things otherwise.
Your logic is correct and I managed to reproduce the client code and I can confirm this works:
// number to ...
1
vote
How to calculate offset for the Stake Program in getProgramAccounts
The Anchor book has this great space reference, which gives a good guide on how much space each data type takes up:
https://book.anchor-lang.com/anchor_references/space.html
So once you know the types ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
memcmp × 5getprogramaccounts × 3
anchor × 2
offset × 2
solana-program × 1
rpc × 1
web3.js × 1
base58 × 1