Module: Phantasma::API

Defined in:
lib/phantasma/API/api.rb,
lib/phantasma/API/request.rb

Defined Under Namespace

Classes: Request

Constant Summary collapse

ALLOWED_METHODS =

API endpoints are autogenerated now Phantasma::Helpers.test_api_endpoints Special case is GetValidators/type => GetValidatorByType

%w[GetAccount GetAccounts GetAddressesBySymbol LookUpName GetAuction GetAuctionsCount GetAuctions
GetBlockByHash GetBlockByHeight GetBlockHeight GetBlockTransactionCountByHash GetLatestBlock GetRawBlockByHash GetRawBlockByHeight
GetRawLatestBlock GetChains GetChain abci_query GetValidatorsSettings health net_info request_block status GetContractByAddress GetContract GetContracts
GetLeaderboard GetNexus GetOrganizationByName GetOrganization GetOrganizations GetInterop GetPlatform GetPlatforms rpc
GetLatestSaleHash GetSale ReadImage GetNFT GetNFTs GetTokenBalance GetTokenData GetToken GetTokens GetAddressTransactionCount
GetAddressTransactions GetTransactionByBlockHashAndIndex GetTransaction InvokeRawScript SendRawTransaction GetValidators GetValidatorByType].freeze

Class Method Summary collapse

Class Method Details

.allowed_methods_hashObject



19
20
21
22
23
# File 'lib/phantasma/API/api.rb', line 19

def self.allowed_methods_hash
  hash = {}
  ALLOWED_METHODS.each { |value| hash["#{Phantasma::Helpers.camel_to_snake(value.strip)}"] = "#{value}" }
  hash
end

.find_deprecated_endpointsObject



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/phantasma/API/api.rb', line 32

def self.find_deprecated_endpoints
  endpoints = []
  test_endpoints = Phantasma::Helpers.test_api_endpoints
  ALLOWED_METHODS.each do |endpoint|
    next if endpoint == 'GetValidatorByType'
    unless test_endpoints.include?(endpoint.to_s)
      endpoints << endpoint
    end
  end
  endpoints
end

.find_missing_endpointsObject



25
26
27
28
29
30
# File 'lib/phantasma/API/api.rb', line 25

def self.find_missing_endpoints
  endpoints = (Phantasma::Helpers.test_api_endpoints - ALLOWED_METHODS)
  # Special case, defined as GetValidatorByType int this gem
  endpoints.delete('GetValidators/{type}')
  endpoints
end