coinbase-sdk 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address.rb +73 -19
  3. data/lib/coinbase/asset.rb +80 -56
  4. data/lib/coinbase/balance.rb +10 -6
  5. data/lib/coinbase/client/api/assets_api.rb +91 -0
  6. data/lib/coinbase/client/api/balances_api.rb +97 -0
  7. data/lib/coinbase/client/api/external_addresses_api.rb +242 -0
  8. data/lib/coinbase/client/api/server_signers_api.rb +13 -3
  9. data/lib/coinbase/client/api/stake_api.rb +236 -0
  10. data/lib/coinbase/client/api/transfer_api.rb +114 -0
  11. data/lib/coinbase/client/models/broadcast_trade_request.rb +14 -4
  12. data/lib/coinbase/client/models/build_staking_operation_request.rb +291 -0
  13. data/lib/coinbase/client/models/feature.rb +42 -0
  14. data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +258 -0
  15. data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +343 -0
  16. data/lib/coinbase/client/models/get_staking_context_request.rb +274 -0
  17. data/lib/coinbase/client/models/partial_eth_staking_context.rb +257 -0
  18. data/lib/coinbase/client/models/request_faucet_funds200_response.rb +222 -0
  19. data/lib/coinbase/client/models/server_signer_list.rb +275 -0
  20. data/lib/coinbase/client/models/staking_context.rb +222 -0
  21. data/lib/coinbase/client/models/staking_context_context.rb +104 -0
  22. data/lib/coinbase/client/models/staking_operation.rb +222 -0
  23. data/lib/coinbase/client/models/staking_reward.rb +308 -0
  24. data/lib/coinbase/client/models/trade.rb +13 -4
  25. data/lib/coinbase/client/models/transaction.rb +45 -1
  26. data/lib/coinbase/client/models/transfer.rb +33 -1
  27. data/lib/coinbase/client/models/wallet.rb +20 -1
  28. data/lib/coinbase/client.rb +14 -0
  29. data/lib/coinbase/constants.rb +2 -27
  30. data/lib/coinbase/errors.rb +50 -62
  31. data/lib/coinbase/network.rb +6 -20
  32. data/lib/coinbase/server_signer.rb +57 -0
  33. data/lib/coinbase/trade.rb +147 -0
  34. data/lib/coinbase/transaction.rb +125 -0
  35. data/lib/coinbase/transfer.rb +22 -55
  36. data/lib/coinbase/wallet.rb +14 -3
  37. data/lib/coinbase.rb +11 -11
  38. metadata +22 -2
@@ -0,0 +1,222 @@
1
+ =begin
2
+ #Coinbase Platform API
3
+
4
+ #This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
5
+
6
+ The version of the OpenAPI document: 0.0.1-alpha
7
+ Contact: yuga.cohler@coinbase.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.5.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Coinbase::Client
17
+ # An onchain transaction to help realize a staking action.
18
+ class StakingOperation
19
+ attr_accessor :transaction
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'transaction' => :'transaction'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'transaction' => :'Transaction'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::StakingOperation` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::StakingOperation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'transaction')
62
+ self.transaction = attributes[:'transaction']
63
+ else
64
+ self.transaction = nil
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
72
+ invalid_properties = Array.new
73
+ if @transaction.nil?
74
+ invalid_properties.push('invalid value for "transaction", transaction cannot be nil.')
75
+ end
76
+
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ warn '[DEPRECATED] the `valid?` method is obsolete'
84
+ return false if @transaction.nil?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ transaction == o.transaction
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [transaction].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ attributes = attributes.transform_keys(&:to_sym)
114
+ transformed_hash = {}
115
+ openapi_types.each_pair do |key, type|
116
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = nil
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[attribute_map[key]].is_a?(Array)
122
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
123
+ end
124
+ elsif !attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
126
+ end
127
+ end
128
+ new(transformed_hash)
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def self._deserialize(type, value)
136
+ case type.to_sym
137
+ when :Time
138
+ Time.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :Boolean
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ # models (e.g. Pet) or oneOf
169
+ klass = Coinbase::Client.const_get(type)
170
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+
222
+ end
@@ -0,0 +1,308 @@
1
+ =begin
2
+ #Coinbase Platform API
3
+
4
+ #This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
5
+
6
+ The version of the OpenAPI document: 0.0.1-alpha
7
+ Contact: yuga.cohler@coinbase.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.5.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Coinbase::Client
17
+ # The staking rewards for an address
18
+ class StakingReward
19
+ # The onchain address for which the staking rewards are being fetched
20
+ attr_accessor :address_id
21
+
22
+ # The date of the reward in format 'YYYY-MM-DD' in UTC.
23
+ attr_accessor :date
24
+
25
+ # The reward amount in requested \"format\". Default is USD.
26
+ attr_accessor :amount
27
+
28
+ # The state of the reward
29
+ attr_accessor :state
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'address_id' => :'address_id',
57
+ :'date' => :'date',
58
+ :'amount' => :'amount',
59
+ :'state' => :'state'
60
+ }
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'address_id' => :'String',
72
+ :'date' => :'Date',
73
+ :'amount' => :'String',
74
+ :'state' => :'String'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::StakingReward` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!self.class.attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::StakingReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'address_id')
100
+ self.address_id = attributes[:'address_id']
101
+ else
102
+ self.address_id = nil
103
+ end
104
+
105
+ if attributes.key?(:'date')
106
+ self.date = attributes[:'date']
107
+ else
108
+ self.date = nil
109
+ end
110
+
111
+ if attributes.key?(:'amount')
112
+ self.amount = attributes[:'amount']
113
+ else
114
+ self.amount = nil
115
+ end
116
+
117
+ if attributes.key?(:'state')
118
+ self.state = attributes[:'state']
119
+ else
120
+ self.state = nil
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
128
+ invalid_properties = Array.new
129
+ if @address_id.nil?
130
+ invalid_properties.push('invalid value for "address_id", address_id cannot be nil.')
131
+ end
132
+
133
+ if @date.nil?
134
+ invalid_properties.push('invalid value for "date", date cannot be nil.')
135
+ end
136
+
137
+ if @amount.nil?
138
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
139
+ end
140
+
141
+ if @state.nil?
142
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
143
+ end
144
+
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ warn '[DEPRECATED] the `valid?` method is obsolete'
152
+ return false if @address_id.nil?
153
+ return false if @date.nil?
154
+ return false if @amount.nil?
155
+ return false if @state.nil?
156
+ state_validator = EnumAttributeValidator.new('String', ["pending", "distributed"])
157
+ return false unless state_validator.valid?(@state)
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method checking allowed values (enum).
162
+ # @param [Object] state Object to be assigned
163
+ def state=(state)
164
+ validator = EnumAttributeValidator.new('String', ["pending", "distributed"])
165
+ unless validator.valid?(state)
166
+ fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
167
+ end
168
+ @state = state
169
+ end
170
+
171
+ # Checks equality by comparing each attribute.
172
+ # @param [Object] Object to be compared
173
+ def ==(o)
174
+ return true if self.equal?(o)
175
+ self.class == o.class &&
176
+ address_id == o.address_id &&
177
+ date == o.date &&
178
+ amount == o.amount &&
179
+ state == o.state
180
+ end
181
+
182
+ # @see the `==` method
183
+ # @param [Object] Object to be compared
184
+ def eql?(o)
185
+ self == o
186
+ end
187
+
188
+ # Calculates hash code according to all attributes.
189
+ # @return [Integer] Hash code
190
+ def hash
191
+ [address_id, date, amount, state].hash
192
+ end
193
+
194
+ # Builds the object from hash
195
+ # @param [Hash] attributes Model attributes in the form of hash
196
+ # @return [Object] Returns the model itself
197
+ def self.build_from_hash(attributes)
198
+ return nil unless attributes.is_a?(Hash)
199
+ attributes = attributes.transform_keys(&:to_sym)
200
+ transformed_hash = {}
201
+ openapi_types.each_pair do |key, type|
202
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
203
+ transformed_hash["#{key}"] = nil
204
+ elsif type =~ /\AArray<(.*)>/i
205
+ # check to ensure the input is an array given that the attribute
206
+ # is documented as an array but the input is not
207
+ if attributes[attribute_map[key]].is_a?(Array)
208
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
209
+ end
210
+ elsif !attributes[attribute_map[key]].nil?
211
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
212
+ end
213
+ end
214
+ new(transformed_hash)
215
+ end
216
+
217
+ # Deserializes the data based on type
218
+ # @param string type Data type
219
+ # @param string value Value to be deserialized
220
+ # @return [Object] Deserialized data
221
+ def self._deserialize(type, value)
222
+ case type.to_sym
223
+ when :Time
224
+ Time.parse(value)
225
+ when :Date
226
+ Date.parse(value)
227
+ when :String
228
+ value.to_s
229
+ when :Integer
230
+ value.to_i
231
+ when :Float
232
+ value.to_f
233
+ when :Boolean
234
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
235
+ true
236
+ else
237
+ false
238
+ end
239
+ when :Object
240
+ # generic object (usually a Hash), return directly
241
+ value
242
+ when /\AArray<(?<inner_type>.+)>\z/
243
+ inner_type = Regexp.last_match[:inner_type]
244
+ value.map { |v| _deserialize(inner_type, v) }
245
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
246
+ k_type = Regexp.last_match[:k_type]
247
+ v_type = Regexp.last_match[:v_type]
248
+ {}.tap do |hash|
249
+ value.each do |k, v|
250
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
251
+ end
252
+ end
253
+ else # model
254
+ # models (e.g. Pet) or oneOf
255
+ klass = Coinbase::Client.const_get(type)
256
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
257
+ end
258
+ end
259
+
260
+ # Returns the string representation of the object
261
+ # @return [String] String presentation of the object
262
+ def to_s
263
+ to_hash.to_s
264
+ end
265
+
266
+ # to_body is an alias to to_hash (backward compatibility)
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_body
269
+ to_hash
270
+ end
271
+
272
+ # Returns the object in the form of hash
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_hash
275
+ hash = {}
276
+ self.class.attribute_map.each_pair do |attr, param|
277
+ value = self.send(attr)
278
+ if value.nil?
279
+ is_nullable = self.class.openapi_nullable.include?(attr)
280
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
281
+ end
282
+
283
+ hash[param] = _to_hash(value)
284
+ end
285
+ hash
286
+ end
287
+
288
+ # Outputs non-array value in the form of hash
289
+ # For object, use to_hash. Otherwise, just return the value
290
+ # @param [Object] value Any valid value
291
+ # @return [Hash] Returns the value in the form of hash
292
+ def _to_hash(value)
293
+ if value.is_a?(Array)
294
+ value.compact.map { |v| _to_hash(v) }
295
+ elsif value.is_a?(Hash)
296
+ {}.tap do |hash|
297
+ value.each { |k, v| hash[k] = _to_hash(v) }
298
+ end
299
+ elsif value.respond_to? :to_hash
300
+ value.to_hash
301
+ else
302
+ value
303
+ end
304
+ end
305
+
306
+ end
307
+
308
+ end
@@ -40,6 +40,8 @@ module Coinbase::Client
40
40
 
41
41
  attr_accessor :transaction
42
42
 
43
+ attr_accessor :approve_transaction
44
+
43
45
  # Attribute mapping from ruby-style variable name to JSON key.
44
46
  def self.attribute_map
45
47
  {
@@ -51,7 +53,8 @@ module Coinbase::Client
51
53
  :'from_asset' => :'from_asset',
52
54
  :'to_amount' => :'to_amount',
53
55
  :'to_asset' => :'to_asset',
54
- :'transaction' => :'transaction'
56
+ :'transaction' => :'transaction',
57
+ :'approve_transaction' => :'approve_transaction'
55
58
  }
56
59
  end
57
60
 
@@ -71,7 +74,8 @@ module Coinbase::Client
71
74
  :'from_asset' => :'Asset',
72
75
  :'to_amount' => :'String',
73
76
  :'to_asset' => :'Asset',
74
- :'transaction' => :'Transaction'
77
+ :'transaction' => :'Transaction',
78
+ :'approve_transaction' => :'Transaction'
75
79
  }
76
80
  end
77
81
 
@@ -149,6 +153,10 @@ module Coinbase::Client
149
153
  else
150
154
  self.transaction = nil
151
155
  end
156
+
157
+ if attributes.key?(:'approve_transaction')
158
+ self.approve_transaction = attributes[:'approve_transaction']
159
+ end
152
160
  end
153
161
 
154
162
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -224,7 +232,8 @@ module Coinbase::Client
224
232
  from_asset == o.from_asset &&
225
233
  to_amount == o.to_amount &&
226
234
  to_asset == o.to_asset &&
227
- transaction == o.transaction
235
+ transaction == o.transaction &&
236
+ approve_transaction == o.approve_transaction
228
237
  end
229
238
 
230
239
  # @see the `==` method
@@ -236,7 +245,7 @@ module Coinbase::Client
236
245
  # Calculates hash code according to all attributes.
237
246
  # @return [Integer] Hash code
238
247
  def hash
239
- [network_id, wallet_id, address_id, trade_id, from_amount, from_asset, to_amount, to_asset, transaction].hash
248
+ [network_id, wallet_id, address_id, trade_id, from_amount, from_asset, to_amount, to_asset, transaction, approve_transaction].hash
240
249
  end
241
250
 
242
251
  # Builds the object from hash
@@ -16,6 +16,12 @@ require 'time'
16
16
  module Coinbase::Client
17
17
  # An onchain transaction.
18
18
  class Transaction
19
+ # The ID of the blockchain network
20
+ attr_accessor :network_id
21
+
22
+ # The onchain address of the sender
23
+ attr_accessor :from_address_id
24
+
19
25
  # The unsigned payload of the transaction. This is the payload that needs to be signed by the sender.
20
26
  attr_accessor :unsigned_payload
21
27
 
@@ -25,6 +31,9 @@ module Coinbase::Client
25
31
  # The hash of the transaction
26
32
  attr_accessor :transaction_hash
27
33
 
34
+ # The link to view the transaction on a block explorer. This is optional and may not be present for all transactions.
35
+ attr_accessor :transaction_link
36
+
28
37
  # The status of the transaction
29
38
  attr_accessor :status
30
39
 
@@ -53,9 +62,12 @@ module Coinbase::Client
53
62
  # Attribute mapping from ruby-style variable name to JSON key.
54
63
  def self.attribute_map
55
64
  {
65
+ :'network_id' => :'network_id',
66
+ :'from_address_id' => :'from_address_id',
56
67
  :'unsigned_payload' => :'unsigned_payload',
57
68
  :'signed_payload' => :'signed_payload',
58
69
  :'transaction_hash' => :'transaction_hash',
70
+ :'transaction_link' => :'transaction_link',
59
71
  :'status' => :'status'
60
72
  }
61
73
  end
@@ -68,9 +80,12 @@ module Coinbase::Client
68
80
  # Attribute type mapping.
69
81
  def self.openapi_types
70
82
  {
83
+ :'network_id' => :'String',
84
+ :'from_address_id' => :'String',
71
85
  :'unsigned_payload' => :'String',
72
86
  :'signed_payload' => :'String',
73
87
  :'transaction_hash' => :'String',
88
+ :'transaction_link' => :'String',
74
89
  :'status' => :'String'
75
90
  }
76
91
  end
@@ -96,6 +111,18 @@ module Coinbase::Client
96
111
  h[k.to_sym] = v
97
112
  }
98
113
 
114
+ if attributes.key?(:'network_id')
115
+ self.network_id = attributes[:'network_id']
116
+ else
117
+ self.network_id = nil
118
+ end
119
+
120
+ if attributes.key?(:'from_address_id')
121
+ self.from_address_id = attributes[:'from_address_id']
122
+ else
123
+ self.from_address_id = nil
124
+ end
125
+
99
126
  if attributes.key?(:'unsigned_payload')
100
127
  self.unsigned_payload = attributes[:'unsigned_payload']
101
128
  else
@@ -110,6 +137,10 @@ module Coinbase::Client
110
137
  self.transaction_hash = attributes[:'transaction_hash']
111
138
  end
112
139
 
140
+ if attributes.key?(:'transaction_link')
141
+ self.transaction_link = attributes[:'transaction_link']
142
+ end
143
+
113
144
  if attributes.key?(:'status')
114
145
  self.status = attributes[:'status']
115
146
  else
@@ -122,6 +153,14 @@ module Coinbase::Client
122
153
  def list_invalid_properties
123
154
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
124
155
  invalid_properties = Array.new
156
+ if @network_id.nil?
157
+ invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
158
+ end
159
+
160
+ if @from_address_id.nil?
161
+ invalid_properties.push('invalid value for "from_address_id", from_address_id cannot be nil.')
162
+ end
163
+
125
164
  if @unsigned_payload.nil?
126
165
  invalid_properties.push('invalid value for "unsigned_payload", unsigned_payload cannot be nil.')
127
166
  end
@@ -137,6 +176,8 @@ module Coinbase::Client
137
176
  # @return true if the model is valid
138
177
  def valid?
139
178
  warn '[DEPRECATED] the `valid?` method is obsolete'
179
+ return false if @network_id.nil?
180
+ return false if @from_address_id.nil?
140
181
  return false if @unsigned_payload.nil?
141
182
  return false if @status.nil?
142
183
  status_validator = EnumAttributeValidator.new('String', ["pending", "broadcast", "complete", "failed"])
@@ -159,9 +200,12 @@ module Coinbase::Client
159
200
  def ==(o)
160
201
  return true if self.equal?(o)
161
202
  self.class == o.class &&
203
+ network_id == o.network_id &&
204
+ from_address_id == o.from_address_id &&
162
205
  unsigned_payload == o.unsigned_payload &&
163
206
  signed_payload == o.signed_payload &&
164
207
  transaction_hash == o.transaction_hash &&
208
+ transaction_link == o.transaction_link &&
165
209
  status == o.status
166
210
  end
167
211
 
@@ -174,7 +218,7 @@ module Coinbase::Client
174
218
  # Calculates hash code according to all attributes.
175
219
  # @return [Integer] Hash code
176
220
  def hash
177
- [unsigned_payload, signed_payload, transaction_hash, status].hash
221
+ [network_id, from_address_id, unsigned_payload, signed_payload, transaction_hash, transaction_link, status].hash
178
222
  end
179
223
 
180
224
  # Builds the object from hash