Skip to main content
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]))
Frank C.'s user avatar
  • 656
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 ...
Jon C's user avatar
  • 19.6k
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 ...
john's user avatar
  • 7,794
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 ...
Serban's user avatar
  • 1,486
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 ...
HelmetFace's user avatar
  • 1,807

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