Add RPC/getTokenLargestAccounts
This commit is contained in:
parent
ff5aa5449d
commit
6b85f242c7
|
@ -0,0 +1,32 @@
|
|||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/dfuse-io/solana-go"
|
||||
)
|
||||
|
||||
type GetTokenLargestAccountsResult struct {
|
||||
RPCContext
|
||||
Value []*TokenLargestAccountsResult `json:"value"`
|
||||
}
|
||||
type TokenLargestAccountsResult struct {
|
||||
Address string `json:"address"` // the address of the token account
|
||||
UiTokenAmount
|
||||
}
|
||||
|
||||
// GetTokenLargestAccounts returns the 20 largest accounts of a particular SPL Token type.
|
||||
func (cl *Client) GetTokenLargestAccounts(
|
||||
ctx context.Context,
|
||||
tokenMint solana.PublicKey, // Pubkey of token Mint to query
|
||||
commitment CommitmentType,
|
||||
) (out *GetTokenLargestAccountsResult, err error) {
|
||||
params := []interface{}{tokenMint}
|
||||
if commitment != "" {
|
||||
params = append(params,
|
||||
M{"commitment": commitment},
|
||||
)
|
||||
}
|
||||
err = cl.rpcClient.CallFor(&out, "getTokenLargestAccounts", params)
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue