Module: SolanaRuby::HttpMethods::TokenMethods

Defined in:
lib/solana_ruby/http_methods/token_methods.rb

Overview

Token Related HTTP Methods

Constant Summary collapse

FINALIZED_OPTIONS =
{ commitment: "finalized" }.freeze

Instance Method Summary collapse

Instance Method Details

#get_token_accounts_by_owner(owner_pubkey, filters = {}, options = {}) ⇒ Object



19
20
21
22
23
# File 'lib/solana_ruby/http_methods/token_methods.rb', line 19

def get_token_accounts_by_owner(owner_pubkey, filters = {}, options = {})
  params = [owner_pubkey, filters, options]
  response = request("getTokenAccountsByOwner", params)
  response["result"]
end

#get_token_balance(pubkey, options = FINALIZED_OPTIONS) ⇒ Object



9
10
11
12
# File 'lib/solana_ruby/http_methods/token_methods.rb', line 9

def get_token_balance(pubkey, options = FINALIZED_OPTIONS)
  balance_info = request("getTokenAccountBalance", [pubkey, options])
  balance_info["result"]["value"]
end

#get_token_largest_accounts(mint_pubkey, options = {}) ⇒ Object



25
26
27
28
29
# File 'lib/solana_ruby/http_methods/token_methods.rb', line 25

def get_token_largest_accounts(mint_pubkey, options = {})
  params = [mint_pubkey, options]
  response = request("getTokenLargestAccounts", params)
  response["result"]
end

#get_token_supply(pubkey) ⇒ Object



14
15
16
17
# File 'lib/solana_ruby/http_methods/token_methods.rb', line 14

def get_token_supply(pubkey)
  balance_info = request("getTokenSupply", [pubkey])
  balance_info["result"]["value"]
end