Sha256: 6c00ad3138047e4b71125b0c909cb4f196cd1d5af9419d38d45471d7167b75f0

Contents?: true

Size: 977 Bytes

Versions: 14

Compression:

Stored size: 977 Bytes

Contents

# frozen_string_literal: true

module SolanaRuby
  module HttpMethods
    # Token Related HTTP Methods
    module TokenMethods
      FINALIZED_OPTIONS = { commitment: "finalized" }.freeze

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

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

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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
solana-ruby-web3js-2.1.1 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-2.1.0 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-2.0.2 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-2.0.1 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-2.0.0beta2 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-2.0.0beta1 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-2.0.0 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-1.0.1.beta4 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-1.0.1.beta3 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-1.0.1.beta2 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-1.0.1.beta1 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-1.0.0.beta lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-1.0.1 lib/solana_ruby/http_methods/token_methods.rb
solana-ruby-web3js-1.0.0 lib/solana_ruby/http_methods/token_methods.rb