Add RPC/getTokenSupply
This commit is contained in:
parent
6b85f242c7
commit
e24be63947
|
@ -0,0 +1,28 @@
|
|||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/dfuse-io/solana-go"
|
||||
)
|
||||
|
||||
type GetTokenSupplyResult struct {
|
||||
RPCContext
|
||||
Value *UiTokenAmount `json:"value"`
|
||||
}
|
||||
|
||||
// GetTokenSupply returns the total supply of an SPL Token type.
|
||||
func (cl *Client) GetTokenSupply(
|
||||
ctx context.Context,
|
||||
tokenMint solana.PublicKey, // Pubkey of token Mint to query
|
||||
commitment CommitmentType,
|
||||
) (out *GetTokenSupplyResult, err error) {
|
||||
params := []interface{}{tokenMint}
|
||||
if commitment != "" {
|
||||
params = append(params,
|
||||
M{"commitment": commitment},
|
||||
)
|
||||
}
|
||||
err = cl.rpcClient.CallFor(&out, "getTokenSupply", params)
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue