solana-go
solana-go copied to clipboard
How to use filters with rpc.GetProgramAccountsOpts
Ask - Do you have an example of using GetProgramAccountsWithOpts that includes the dataslice and memcmp filters?
I am trying to use DataSlice and Filters with GetProgramAccountsWithOpts and I'm sure I'm making some rookie mistake here with the format but I can't figure out the proper format to include the memcmp filter. Thank you.
out, err := client.GetProgramAccountsWithOpts(
context.TODO(),
solana.MustPublicKeyFromBase58("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),
&rpc.GetProgramAccountsOpts{
Encoding: solana.EncodingBase64Zstd,
Commitment: rpc.CommitmentFinalized,
DataSlice: &rpc.DataSlice{
Offset: pointer.ToUint64(0),
Length: pointer.ToUint64(1024),
},
//TODO: what is the correct format for filters
Filters: ,
},
)