Class: CcipDirectoryAndConfigurationRestApiV1::TokenChainData
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CcipDirectoryAndConfigurationRestApiV1::TokenChainData
- Defined in:
- lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb
Overview
TokenChainData Model.
Instance Attribute Summary collapse
-
#chain_id ⇒ Object
Identifier of the chain (numeric for EVM chains, string for Solana/Aptos chains).
-
#chain_name ⇒ String
Human-readable name of the chain.
-
#decimals ⇒ Integer
Number of decimals used for the token.
-
#destinations ⇒ Array[String]
Destination chains this token can be sent to.
-
#name ⇒ String
Name of the token.
-
#pool_address ⇒ String
Token pool contract address (if applicable).
-
#pool_type ⇒ PoolType
Type of pool for this token.
-
#symbol ⇒ String
Symbol of the token.
-
#token_address ⇒ String
Token contract address on this chain.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(chain_id:, chain_name:, token_address:, decimals:, pool_type:, pool_address:, name: SKIP, symbol: SKIP, destinations: SKIP, additional_properties: nil) ⇒ TokenChainData
constructor
A new instance of TokenChainData.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(chain_id:, chain_name:, token_address:, decimals:, pool_type:, pool_address:, name: SKIP, symbol: SKIP, destinations: SKIP, additional_properties: nil) ⇒ TokenChainData
Returns a new instance of TokenChainData.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 78 def initialize(chain_id:, chain_name:, token_address:, decimals:, pool_type:, pool_address:, name: SKIP, symbol: SKIP, destinations: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @chain_id = chain_id @chain_name = chain_name @token_address = token_address @decimals = decimals @pool_type = pool_type @pool_address = pool_address @name = name unless name == SKIP @symbol = symbol unless symbol == SKIP @destinations = destinations unless destinations == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#chain_id ⇒ Object
Identifier of the chain (numeric for EVM chains, string for Solana/Aptos chains)
15 16 17 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 15 def chain_id @chain_id end |
#chain_name ⇒ String
Human-readable name of the chain
19 20 21 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 19 def chain_name @chain_name end |
#decimals ⇒ Integer
Number of decimals used for the token
27 28 29 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 27 def decimals @decimals end |
#destinations ⇒ Array[String]
Destination chains this token can be sent to
47 48 49 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 47 def destinations @destinations end |
#name ⇒ String
Name of the token
39 40 41 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 39 def name @name end |
#pool_address ⇒ String
Token pool contract address (if applicable)
35 36 37 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 35 def pool_address @pool_address end |
#pool_type ⇒ PoolType
Type of pool for this token
31 32 33 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 31 def pool_type @pool_type end |
#symbol ⇒ String
Symbol of the token
43 44 45 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 43 def symbol @symbol end |
#token_address ⇒ String
Token contract address on this chain
23 24 25 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 23 def token_address @token_address end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 97 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. chain_id = hash.key?('chainId') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:TokenChainDataChainId), hash['chainId'] ) : nil chain_name = hash.key?('chainName') ? hash['chainName'] : nil token_address = hash.key?('tokenAddress') ? hash['tokenAddress'] : nil decimals = hash.key?('decimals') ? hash['decimals'] : nil pool_type = hash.key?('poolType') ? hash['poolType'] : nil pool_address = hash.key?('poolAddress') ? hash['poolAddress'] : nil name = hash.key?('name') ? hash['name'] : SKIP symbol = hash.key?('symbol') ? hash['symbol'] : SKIP destinations = hash.key?('destinations') ? hash['destinations'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. TokenChainData.new(chain_id: chain_id, chain_name: chain_name, token_address: token_address, decimals: decimals, pool_type: pool_type, pool_address: pool_address, name: name, symbol: symbol, destinations: destinations, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 50 def self.names @_hash = {} if @_hash.nil? @_hash['chain_id'] = 'chainId' @_hash['chain_name'] = 'chainName' @_hash['token_address'] = 'tokenAddress' @_hash['decimals'] = 'decimals' @_hash['pool_type'] = 'poolType' @_hash['pool_address'] = 'poolAddress' @_hash['name'] = 'name' @_hash['symbol'] = 'symbol' @_hash['destinations'] = 'destinations' @_hash end |
.nullables ⇒ Object
An array for nullable fields
74 75 76 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 74 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
65 66 67 68 69 70 71 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 65 def self.optionals %w[ name symbol destinations ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 135 def self.validate(value) if value.instance_of? self return ( UnionTypeLookUp.get(:TokenChainDataChainId) .validate(value.chain_id) and APIHelper.valid_type?(value.chain_name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.token_address, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.decimals, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.pool_type, ->(val) { PoolType.validate(val) }) and APIHelper.valid_type?(value.pool_address, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( UnionTypeLookUp.get(:TokenChainDataChainId) .validate(value['chainId']) and APIHelper.valid_type?(value['chainName'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['tokenAddress'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['decimals'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['poolType'], ->(val) { PoolType.validate(val) }) and APIHelper.valid_type?(value['poolAddress'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
181 182 183 184 185 186 187 188 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 181 def inspect class_name = self.class.name.split('::').last "<#{class_name} chain_id: #{@chain_id.inspect}, chain_name: #{@chain_name.inspect},"\ " token_address: #{@token_address.inspect}, decimals: #{@decimals.inspect}, pool_type:"\ " #{@pool_type.inspect}, pool_address: #{@pool_address.inspect}, name: #{@name.inspect},"\ " symbol: #{@symbol.inspect}, destinations: #{@destinations.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
172 173 174 175 176 177 178 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/token_chain_data.rb', line 172 def to_s class_name = self.class.name.split('::').last "<#{class_name} chain_id: #{@chain_id}, chain_name: #{@chain_name}, token_address:"\ " #{@token_address}, decimals: #{@decimals}, pool_type: #{@pool_type}, pool_address:"\ " #{@pool_address}, name: #{@name}, symbol: #{@symbol}, destinations: #{@destinations},"\ " additional_properties: #{@additional_properties}>" end |