Class: CcipDirectoryAndConfigurationRestApiV1::ChainsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/ccip_directory_and_configuration_rest_api_v1/apis/chains_api.rb

Overview

ChainsApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from CcipDirectoryAndConfigurationRestApiV1::BaseApi

Instance Method Details

#get_chains(environment, chain_id: nil, selector: nil, internal_id: nil, output_key: OutputKey::CHAINID, enrich_fee_tokens: EnrichFeeTokens::ENUM_FALSE, search: nil, family: nil) ⇒ ApiResponse

Returns information about Cross-Chain Interoperability Protocol (CCIP) chains across different blockchain families (EVM, Solana, Aptos) environment to query for Ethereum, “56” for BSC, or a Solana pubkey) selector. Multiple selectors can be specified using comma-separated values identifier. Multiple IDs can be specified using comma-separated values (e.g., “ethereum-mainnet,bsc-mainnet”) organizing the response data ‘true’, returns detailed fee token information including addresses, names, and decimals instead of just symbol strings Automatically detects query type: selector (>17 digits), chainId (≤17 digits or Solana base58 hash), internalId (kebab-case), or displayName (fuzzy text search). Cannot be combined with chainId, selector, or internalId filters. Only effective when using the search parameter.

Parameters:

  • environment (Environment3)

    Required parameter: The network

  • chain_id (String) (defaults to: nil)

    Optional parameter: Filter by chain ID (e.g., “1”

  • selector (String) (defaults to: nil)

    Optional parameter: Filter by CCIP chain

  • internal_id (String) (defaults to: nil)

    Optional parameter: Filter by internal chain

  • output_key (OutputKey) (defaults to: OutputKey::CHAINID)

    Optional parameter: Key to use for

  • enrich_fee_tokens (EnrichFeeTokens) (defaults to: EnrichFeeTokens::ENUM_FALSE)

    Optional parameter: When set to

  • search (String) (defaults to: nil)

    Optional parameter: Unified search query.

  • family (Family) (defaults to: nil)

    Optional parameter: Filter results by chain family.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/ccip_directory_and_configuration_rest_api_v1/apis/chains_api.rb', line 34

def get_chains(environment,
               chain_id: nil,
               selector: nil,
               internal_id: nil,
               output_key: OutputKey::CHAINID,
               enrich_fee_tokens: EnrichFeeTokens::ENUM_FALSE,
               search: nil,
               family: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/chains',
                                 Server::DEFAULT)
               .query_param(new_parameter(environment, key: 'environment')
                             .is_required(true))
               .query_param(new_parameter(chain_id, key: 'chainId'))
               .query_param(new_parameter(selector, key: 'selector'))
               .query_param(new_parameter(internal_id, key: 'internalId'))
               .query_param(new_parameter(output_key, key: 'outputKey'))
               .query_param(new_parameter(enrich_fee_tokens, key: 'enrichFeeTokens'))
               .query_param(new_parameter(search, key: 'search'))
               .query_param(new_parameter(family, key: 'family'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChainApiResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request parameters',
                             ErrorResponseException)
                .local_error('500',
                             'Internal server error',
                             ErrorResponseException))
    .execute
end