Class: Mudbase::CalculateWalletFee200ResponseData

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/mudbase/models/calculate_wallet_fee200_response_data.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ CalculateWalletFee200ResponseData

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 148

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Mudbase::CalculateWalletFee200ResponseData` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Mudbase::CalculateWalletFee200ResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.key?(:'network')
    self.network = attributes[:'network']
  end

  if attributes.key?(:'amount')
    self.amount = attributes[:'amount']
  end

  if attributes.key?(:'chain')
    self.chain = attributes[:'chain']
  end

  if attributes.key?(:'network_fee')
    self.network_fee = attributes[:'network_fee']
  end

  if attributes.key?(:'estimated_time')
    self.estimated_time = attributes[:'estimated_time']
  end

  if attributes.key?(:'congestion')
    self.congestion = attributes[:'congestion']
  end

  if attributes.key?(:'gas_limit')
    self.gas_limit = attributes[:'gas_limit']
  end

  if attributes.key?(:'gas_price')
    self.gas_price = attributes[:'gas_price']
  end

  if attributes.key?(:'gas_price_gwei')
    self.gas_price_gwei = attributes[:'gas_price_gwei']
  end

  if attributes.key?(:'estimated_cost')
    self.estimated_cost = attributes[:'estimated_cost']
  end

  if attributes.key?(:'sat_per_vb')
    self.sat_per_vb = attributes[:'sat_per_vb']
  end

  if attributes.key?(:'fee_sat')
    self.fee_sat = attributes[:'fee_sat']
  end

  if attributes.key?(:'lamports')
    self.lamports = attributes[:'lamports']
  end

  if attributes.key?(:'fee_tiers')
    if (value = attributes[:'fee_tiers']).is_a?(Hash)
      self.fee_tiers = value
    end
  end

  if attributes.key?(:'gas_spike_warning')
    self.gas_spike_warning = attributes[:'gas_spike_warning']
  end
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



23
24
25
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 23

def amount
  @amount
end

#chainObject

Chain id used for estimation



26
27
28
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 26

def chain
  @chain
end

#congestionObject

Network congestion level (EVM from gas price; UTXO from sat/vB)



34
35
36
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 34

def congestion
  @congestion
end

#currencyObject

Request currency / native currency for the chain



19
20
21
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 19

def currency
  @currency
end

#estimated_costObject

(EVM only) Cost in wei



46
47
48
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 46

def estimated_cost
  @estimated_cost
end

#estimated_timeObject

Returns the value of attribute estimated_time.



31
32
33
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 31

def estimated_time
  @estimated_time
end

#fee_satObject

(UTXO only) Fee in satoshis



52
53
54
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 52

def fee_sat
  @fee_sat
end

#fee_tiersObject

(EVM only) slow / normal / fast tiers; each has gasPriceGwei, networkFee



58
59
60
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 58

def fee_tiers
  @fee_tiers
end

#gas_limitObject

(EVM only) Gas limit



37
38
39
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 37

def gas_limit
  @gas_limit
end

#gas_priceObject

(EVM only) Gas price in wei



40
41
42
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 40

def gas_price
  @gas_price
end

#gas_price_gweiObject

(EVM only) Gas price in Gwei



43
44
45
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 43

def gas_price_gwei
  @gas_price_gwei
end

#gas_spike_warningObject

True when current gas is ≥5× chain minimum (consider warning user)



61
62
63
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 61

def gas_spike_warning
  @gas_spike_warning
end

#lamportsObject

(Solana only) Fee in lamports



55
56
57
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 55

def lamports
  @lamports
end

#networkObject

Returns the value of attribute network.



21
22
23
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 21

def network
  @network
end

#network_feeObject

Human-readable network fee from blockchain



29
30
31
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 29

def network_fee
  @network_fee
end

#sat_per_vbObject

(UTXO only) Satoshis per vbyte



49
50
51
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 49

def sat_per_vb
  @sat_per_vb
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



108
109
110
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 108

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



113
114
115
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 113

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 86

def self.attribute_map
  {
    :'currency' => :'currency',
    :'network' => :'network',
    :'amount' => :'amount',
    :'chain' => :'chain',
    :'network_fee' => :'networkFee',
    :'estimated_time' => :'estimatedTime',
    :'congestion' => :'congestion',
    :'gas_limit' => :'gasLimit',
    :'gas_price' => :'gasPrice',
    :'gas_price_gwei' => :'gasPriceGwei',
    :'estimated_cost' => :'estimatedCost',
    :'sat_per_vb' => :'satPerVb',
    :'fee_sat' => :'feeSat',
    :'lamports' => :'lamports',
    :'fee_tiers' => :'feeTiers',
    :'gas_spike_warning' => :'gasSpikeWarning'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 294

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



140
141
142
143
144
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 140

def self.openapi_nullable
  Set.new([
    :'network',
  ])
end

.openapi_typesObject

Attribute type mapping.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 118

def self.openapi_types
  {
    :'currency' => :'String',
    :'network' => :'String',
    :'amount' => :'Float',
    :'chain' => :'String',
    :'network_fee' => :'String',
    :'estimated_time' => :'String',
    :'congestion' => :'String',
    :'gas_limit' => :'String',
    :'gas_price' => :'String',
    :'gas_price_gwei' => :'Float',
    :'estimated_cost' => :'String',
    :'sat_per_vb' => :'Integer',
    :'fee_sat' => :'Integer',
    :'lamports' => :'Integer',
    :'fee_tiers' => :'Hash<String, CalculateWalletFee200ResponseDataFeeTiersValue>',
    :'gas_spike_warning' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 258

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      currency == o.currency &&
      network == o.network &&
      amount == o.amount &&
      chain == o.chain &&
      network_fee == o.network_fee &&
      estimated_time == o.estimated_time &&
      congestion == o.congestion &&
      gas_limit == o.gas_limit &&
      gas_price == o.gas_price &&
      gas_price_gwei == o.gas_price_gwei &&
      estimated_cost == o.estimated_cost &&
      sat_per_vb == o.sat_per_vb &&
      fee_sat == o.fee_sat &&
      lamports == o.lamports &&
      fee_tiers == o.fee_tiers &&
      gas_spike_warning == o.gas_spike_warning
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


281
282
283
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 281

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



287
288
289
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 287

def hash
  [currency, network, amount, chain, network_fee, estimated_time, congestion, gas_limit, gas_price, gas_price_gwei, estimated_cost, sat_per_vb, fee_sat, lamports, fee_tiers, gas_spike_warning].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



231
232
233
234
235
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 231

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 316

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



239
240
241
242
243
244
# File 'lib/mudbase/models/calculate_wallet_fee200_response_data.rb', line 239

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  congestion_validator = EnumAttributeValidator.new('String', ["low", "normal", "high"])
  return false unless congestion_validator.valid?(@congestion)
  true
end