coinbase-sdk 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/coinbase/address.rb +113 -40
- data/lib/coinbase/asset.rb +18 -4
- data/lib/coinbase/authenticator.rb +1 -1
- data/lib/coinbase/client/api/server_signers_api.rb +429 -0
- data/lib/coinbase/client/api/stake_api.rb +86 -0
- data/lib/coinbase/client/api/trades_api.rb +342 -0
- data/lib/coinbase/client/models/broadcast_trade_request.rb +232 -0
- data/lib/coinbase/client/models/build_staking_operation_request.rb +291 -0
- data/lib/coinbase/client/models/create_address_request.rb +0 -14
- data/lib/coinbase/client/models/create_server_signer_request.rb +239 -0
- data/lib/coinbase/client/models/create_trade_request.rb +256 -0
- data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
- data/lib/coinbase/client/models/create_wallet_request_wallet.rb +233 -0
- data/lib/coinbase/client/models/feature.rb +42 -0
- data/lib/coinbase/client/models/request_faucet_funds200_response.rb +222 -0
- data/lib/coinbase/client/models/seed_creation_event.rb +240 -0
- data/lib/coinbase/client/models/seed_creation_event_result.rb +274 -0
- data/lib/coinbase/client/models/server_signer.rb +235 -0
- data/lib/coinbase/client/models/server_signer_event.rb +239 -0
- data/lib/coinbase/client/models/server_signer_event_event.rb +105 -0
- data/lib/coinbase/client/models/server_signer_event_list.rb +275 -0
- data/lib/coinbase/client/models/server_signer_list.rb +275 -0
- data/lib/coinbase/client/models/signature_creation_event.rb +363 -0
- data/lib/coinbase/client/models/signature_creation_event_result.rb +329 -0
- data/lib/coinbase/client/models/staking_operation.rb +222 -0
- data/lib/coinbase/client/models/trade.rb +365 -0
- data/lib/coinbase/client/models/trade_list.rb +275 -0
- data/lib/coinbase/client/models/transaction.rb +338 -0
- data/lib/coinbase/client/models/transaction_type.rb +39 -0
- data/lib/coinbase/client/models/transfer.rb +33 -1
- data/lib/coinbase/client/models/wallet.rb +74 -4
- data/lib/coinbase/client.rb +23 -0
- data/lib/coinbase/errors.rb +3 -0
- data/lib/coinbase/server_signer.rb +57 -0
- data/lib/coinbase/trade.rb +147 -0
- data/lib/coinbase/transaction.rb +125 -0
- data/lib/coinbase/transfer.rb +38 -71
- data/lib/coinbase/user.rb +14 -89
- data/lib/coinbase/wallet.rb +188 -27
- data/lib/coinbase.rb +19 -4
- metadata +43 -2
@@ -0,0 +1,338 @@
|
|
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.
|
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
|
+
|
25
|
+
# The unsigned payload of the transaction. This is the payload that needs to be signed by the sender.
|
26
|
+
attr_accessor :unsigned_payload
|
27
|
+
|
28
|
+
# The signed payload of the transaction. This is the payload that has been signed by the sender.
|
29
|
+
attr_accessor :signed_payload
|
30
|
+
|
31
|
+
# The hash of the transaction
|
32
|
+
attr_accessor :transaction_hash
|
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
|
+
|
37
|
+
# The status of the transaction
|
38
|
+
attr_accessor :status
|
39
|
+
|
40
|
+
class EnumAttributeValidator
|
41
|
+
attr_reader :datatype
|
42
|
+
attr_reader :allowable_values
|
43
|
+
|
44
|
+
def initialize(datatype, allowable_values)
|
45
|
+
@allowable_values = allowable_values.map do |value|
|
46
|
+
case datatype.to_s
|
47
|
+
when /Integer/i
|
48
|
+
value.to_i
|
49
|
+
when /Float/i
|
50
|
+
value.to_f
|
51
|
+
else
|
52
|
+
value
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def valid?(value)
|
58
|
+
!value || allowable_values.include?(value)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
63
|
+
def self.attribute_map
|
64
|
+
{
|
65
|
+
:'network_id' => :'network_id',
|
66
|
+
:'from_address_id' => :'from_address_id',
|
67
|
+
:'unsigned_payload' => :'unsigned_payload',
|
68
|
+
:'signed_payload' => :'signed_payload',
|
69
|
+
:'transaction_hash' => :'transaction_hash',
|
70
|
+
:'transaction_link' => :'transaction_link',
|
71
|
+
:'status' => :'status'
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
# Returns all the JSON keys this model knows about
|
76
|
+
def self.acceptable_attributes
|
77
|
+
attribute_map.values
|
78
|
+
end
|
79
|
+
|
80
|
+
# Attribute type mapping.
|
81
|
+
def self.openapi_types
|
82
|
+
{
|
83
|
+
:'network_id' => :'String',
|
84
|
+
:'from_address_id' => :'String',
|
85
|
+
:'unsigned_payload' => :'String',
|
86
|
+
:'signed_payload' => :'String',
|
87
|
+
:'transaction_hash' => :'String',
|
88
|
+
:'transaction_link' => :'String',
|
89
|
+
:'status' => :'String'
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
# List of attributes with nullable: true
|
94
|
+
def self.openapi_nullable
|
95
|
+
Set.new([
|
96
|
+
])
|
97
|
+
end
|
98
|
+
|
99
|
+
# Initializes the object
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
def initialize(attributes = {})
|
102
|
+
if (!attributes.is_a?(Hash))
|
103
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::Transaction` initialize method"
|
104
|
+
end
|
105
|
+
|
106
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
107
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
108
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
109
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::Transaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
110
|
+
end
|
111
|
+
h[k.to_sym] = v
|
112
|
+
}
|
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
|
+
|
126
|
+
if attributes.key?(:'unsigned_payload')
|
127
|
+
self.unsigned_payload = attributes[:'unsigned_payload']
|
128
|
+
else
|
129
|
+
self.unsigned_payload = nil
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'signed_payload')
|
133
|
+
self.signed_payload = attributes[:'signed_payload']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'transaction_hash')
|
137
|
+
self.transaction_hash = attributes[:'transaction_hash']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'transaction_link')
|
141
|
+
self.transaction_link = attributes[:'transaction_link']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'status')
|
145
|
+
self.status = attributes[:'status']
|
146
|
+
else
|
147
|
+
self.status = nil
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
152
|
+
# @return Array for valid properties with the reasons
|
153
|
+
def list_invalid_properties
|
154
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
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
|
+
|
164
|
+
if @unsigned_payload.nil?
|
165
|
+
invalid_properties.push('invalid value for "unsigned_payload", unsigned_payload cannot be nil.')
|
166
|
+
end
|
167
|
+
|
168
|
+
if @status.nil?
|
169
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
170
|
+
end
|
171
|
+
|
172
|
+
invalid_properties
|
173
|
+
end
|
174
|
+
|
175
|
+
# Check to see if the all the properties in the model are valid
|
176
|
+
# @return true if the model is valid
|
177
|
+
def valid?
|
178
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
179
|
+
return false if @network_id.nil?
|
180
|
+
return false if @from_address_id.nil?
|
181
|
+
return false if @unsigned_payload.nil?
|
182
|
+
return false if @status.nil?
|
183
|
+
status_validator = EnumAttributeValidator.new('String', ["pending", "broadcast", "complete", "failed"])
|
184
|
+
return false unless status_validator.valid?(@status)
|
185
|
+
true
|
186
|
+
end
|
187
|
+
|
188
|
+
# Custom attribute writer method checking allowed values (enum).
|
189
|
+
# @param [Object] status Object to be assigned
|
190
|
+
def status=(status)
|
191
|
+
validator = EnumAttributeValidator.new('String', ["pending", "broadcast", "complete", "failed"])
|
192
|
+
unless validator.valid?(status)
|
193
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
194
|
+
end
|
195
|
+
@status = status
|
196
|
+
end
|
197
|
+
|
198
|
+
# Checks equality by comparing each attribute.
|
199
|
+
# @param [Object] Object to be compared
|
200
|
+
def ==(o)
|
201
|
+
return true if self.equal?(o)
|
202
|
+
self.class == o.class &&
|
203
|
+
network_id == o.network_id &&
|
204
|
+
from_address_id == o.from_address_id &&
|
205
|
+
unsigned_payload == o.unsigned_payload &&
|
206
|
+
signed_payload == o.signed_payload &&
|
207
|
+
transaction_hash == o.transaction_hash &&
|
208
|
+
transaction_link == o.transaction_link &&
|
209
|
+
status == o.status
|
210
|
+
end
|
211
|
+
|
212
|
+
# @see the `==` method
|
213
|
+
# @param [Object] Object to be compared
|
214
|
+
def eql?(o)
|
215
|
+
self == o
|
216
|
+
end
|
217
|
+
|
218
|
+
# Calculates hash code according to all attributes.
|
219
|
+
# @return [Integer] Hash code
|
220
|
+
def hash
|
221
|
+
[network_id, from_address_id, unsigned_payload, signed_payload, transaction_hash, transaction_link, status].hash
|
222
|
+
end
|
223
|
+
|
224
|
+
# Builds the object from hash
|
225
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
226
|
+
# @return [Object] Returns the model itself
|
227
|
+
def self.build_from_hash(attributes)
|
228
|
+
return nil unless attributes.is_a?(Hash)
|
229
|
+
attributes = attributes.transform_keys(&:to_sym)
|
230
|
+
transformed_hash = {}
|
231
|
+
openapi_types.each_pair do |key, type|
|
232
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
233
|
+
transformed_hash["#{key}"] = nil
|
234
|
+
elsif type =~ /\AArray<(.*)>/i
|
235
|
+
# check to ensure the input is an array given that the attribute
|
236
|
+
# is documented as an array but the input is not
|
237
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
238
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
239
|
+
end
|
240
|
+
elsif !attributes[attribute_map[key]].nil?
|
241
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
242
|
+
end
|
243
|
+
end
|
244
|
+
new(transformed_hash)
|
245
|
+
end
|
246
|
+
|
247
|
+
# Deserializes the data based on type
|
248
|
+
# @param string type Data type
|
249
|
+
# @param string value Value to be deserialized
|
250
|
+
# @return [Object] Deserialized data
|
251
|
+
def self._deserialize(type, value)
|
252
|
+
case type.to_sym
|
253
|
+
when :Time
|
254
|
+
Time.parse(value)
|
255
|
+
when :Date
|
256
|
+
Date.parse(value)
|
257
|
+
when :String
|
258
|
+
value.to_s
|
259
|
+
when :Integer
|
260
|
+
value.to_i
|
261
|
+
when :Float
|
262
|
+
value.to_f
|
263
|
+
when :Boolean
|
264
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
265
|
+
true
|
266
|
+
else
|
267
|
+
false
|
268
|
+
end
|
269
|
+
when :Object
|
270
|
+
# generic object (usually a Hash), return directly
|
271
|
+
value
|
272
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
273
|
+
inner_type = Regexp.last_match[:inner_type]
|
274
|
+
value.map { |v| _deserialize(inner_type, v) }
|
275
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
276
|
+
k_type = Regexp.last_match[:k_type]
|
277
|
+
v_type = Regexp.last_match[:v_type]
|
278
|
+
{}.tap do |hash|
|
279
|
+
value.each do |k, v|
|
280
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
else # model
|
284
|
+
# models (e.g. Pet) or oneOf
|
285
|
+
klass = Coinbase::Client.const_get(type)
|
286
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
# Returns the string representation of the object
|
291
|
+
# @return [String] String presentation of the object
|
292
|
+
def to_s
|
293
|
+
to_hash.to_s
|
294
|
+
end
|
295
|
+
|
296
|
+
# to_body is an alias to to_hash (backward compatibility)
|
297
|
+
# @return [Hash] Returns the object in the form of hash
|
298
|
+
def to_body
|
299
|
+
to_hash
|
300
|
+
end
|
301
|
+
|
302
|
+
# Returns the object in the form of hash
|
303
|
+
# @return [Hash] Returns the object in the form of hash
|
304
|
+
def to_hash
|
305
|
+
hash = {}
|
306
|
+
self.class.attribute_map.each_pair do |attr, param|
|
307
|
+
value = self.send(attr)
|
308
|
+
if value.nil?
|
309
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
310
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
311
|
+
end
|
312
|
+
|
313
|
+
hash[param] = _to_hash(value)
|
314
|
+
end
|
315
|
+
hash
|
316
|
+
end
|
317
|
+
|
318
|
+
# Outputs non-array value in the form of hash
|
319
|
+
# For object, use to_hash. Otherwise, just return the value
|
320
|
+
# @param [Object] value Any valid value
|
321
|
+
# @return [Hash] Returns the value in the form of hash
|
322
|
+
def _to_hash(value)
|
323
|
+
if value.is_a?(Array)
|
324
|
+
value.compact.map { |v| _to_hash(v) }
|
325
|
+
elsif value.is_a?(Hash)
|
326
|
+
{}.tap do |hash|
|
327
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
328
|
+
end
|
329
|
+
elsif value.respond_to? :to_hash
|
330
|
+
value.to_hash
|
331
|
+
else
|
332
|
+
value
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
end
|
337
|
+
|
338
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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
|
+
class TransactionType
|
18
|
+
TRANSFER = "transfer".freeze
|
19
|
+
|
20
|
+
def self.all_vars
|
21
|
+
@all_vars ||= [TRANSFER].freeze
|
22
|
+
end
|
23
|
+
|
24
|
+
# Builds the enum from string
|
25
|
+
# @param [String] The enum value in the form of the string
|
26
|
+
# @return [String] The enum value
|
27
|
+
def self.build_from_hash(value)
|
28
|
+
new.build_from_hash(value)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Builds the enum from string
|
32
|
+
# @param [String] The enum value in the form of the string
|
33
|
+
# @return [String] The enum value
|
34
|
+
def build_from_hash(value)
|
35
|
+
return value if TransactionType.all_vars.include?(value)
|
36
|
+
raise "Invalid ENUM value #{value} for class #TransactionType"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -34,9 +34,13 @@ module Coinbase::Client
|
|
34
34
|
# The ID of the asset being transferred
|
35
35
|
attr_accessor :asset_id
|
36
36
|
|
37
|
+
attr_accessor :asset
|
38
|
+
|
37
39
|
# The ID of the transfer
|
38
40
|
attr_accessor :transfer_id
|
39
41
|
|
42
|
+
attr_accessor :transaction
|
43
|
+
|
40
44
|
# The unsigned payload of the transfer. This is the payload that needs to be signed by the sender.
|
41
45
|
attr_accessor :unsigned_payload
|
42
46
|
|
@@ -80,7 +84,9 @@ module Coinbase::Client
|
|
80
84
|
:'destination' => :'destination',
|
81
85
|
:'amount' => :'amount',
|
82
86
|
:'asset_id' => :'asset_id',
|
87
|
+
:'asset' => :'asset',
|
83
88
|
:'transfer_id' => :'transfer_id',
|
89
|
+
:'transaction' => :'transaction',
|
84
90
|
:'unsigned_payload' => :'unsigned_payload',
|
85
91
|
:'signed_payload' => :'signed_payload',
|
86
92
|
:'transaction_hash' => :'transaction_hash',
|
@@ -102,7 +108,9 @@ module Coinbase::Client
|
|
102
108
|
:'destination' => :'String',
|
103
109
|
:'amount' => :'String',
|
104
110
|
:'asset_id' => :'String',
|
111
|
+
:'asset' => :'Asset',
|
105
112
|
:'transfer_id' => :'String',
|
113
|
+
:'transaction' => :'Transaction',
|
106
114
|
:'unsigned_payload' => :'String',
|
107
115
|
:'signed_payload' => :'String',
|
108
116
|
:'transaction_hash' => :'String',
|
@@ -167,12 +175,24 @@ module Coinbase::Client
|
|
167
175
|
self.asset_id = nil
|
168
176
|
end
|
169
177
|
|
178
|
+
if attributes.key?(:'asset')
|
179
|
+
self.asset = attributes[:'asset']
|
180
|
+
else
|
181
|
+
self.asset = nil
|
182
|
+
end
|
183
|
+
|
170
184
|
if attributes.key?(:'transfer_id')
|
171
185
|
self.transfer_id = attributes[:'transfer_id']
|
172
186
|
else
|
173
187
|
self.transfer_id = nil
|
174
188
|
end
|
175
189
|
|
190
|
+
if attributes.key?(:'transaction')
|
191
|
+
self.transaction = attributes[:'transaction']
|
192
|
+
else
|
193
|
+
self.transaction = nil
|
194
|
+
end
|
195
|
+
|
176
196
|
if attributes.key?(:'unsigned_payload')
|
177
197
|
self.unsigned_payload = attributes[:'unsigned_payload']
|
178
198
|
else
|
@@ -223,10 +243,18 @@ module Coinbase::Client
|
|
223
243
|
invalid_properties.push('invalid value for "asset_id", asset_id cannot be nil.')
|
224
244
|
end
|
225
245
|
|
246
|
+
if @asset.nil?
|
247
|
+
invalid_properties.push('invalid value for "asset", asset cannot be nil.')
|
248
|
+
end
|
249
|
+
|
226
250
|
if @transfer_id.nil?
|
227
251
|
invalid_properties.push('invalid value for "transfer_id", transfer_id cannot be nil.')
|
228
252
|
end
|
229
253
|
|
254
|
+
if @transaction.nil?
|
255
|
+
invalid_properties.push('invalid value for "transaction", transaction cannot be nil.')
|
256
|
+
end
|
257
|
+
|
230
258
|
if @unsigned_payload.nil?
|
231
259
|
invalid_properties.push('invalid value for "unsigned_payload", unsigned_payload cannot be nil.')
|
232
260
|
end
|
@@ -248,7 +276,9 @@ module Coinbase::Client
|
|
248
276
|
return false if @destination.nil?
|
249
277
|
return false if @amount.nil?
|
250
278
|
return false if @asset_id.nil?
|
279
|
+
return false if @asset.nil?
|
251
280
|
return false if @transfer_id.nil?
|
281
|
+
return false if @transaction.nil?
|
252
282
|
return false if @unsigned_payload.nil?
|
253
283
|
return false if @status.nil?
|
254
284
|
status_validator = EnumAttributeValidator.new('String', ["pending", "broadcast", "complete", "failed"])
|
@@ -277,7 +307,9 @@ module Coinbase::Client
|
|
277
307
|
destination == o.destination &&
|
278
308
|
amount == o.amount &&
|
279
309
|
asset_id == o.asset_id &&
|
310
|
+
asset == o.asset &&
|
280
311
|
transfer_id == o.transfer_id &&
|
312
|
+
transaction == o.transaction &&
|
281
313
|
unsigned_payload == o.unsigned_payload &&
|
282
314
|
signed_payload == o.signed_payload &&
|
283
315
|
transaction_hash == o.transaction_hash &&
|
@@ -293,7 +325,7 @@ module Coinbase::Client
|
|
293
325
|
# Calculates hash code according to all attributes.
|
294
326
|
# @return [Integer] Hash code
|
295
327
|
def hash
|
296
|
-
[network_id, wallet_id, address_id, destination, amount, asset_id, transfer_id, unsigned_payload, signed_payload, transaction_hash, status].hash
|
328
|
+
[network_id, wallet_id, address_id, destination, amount, asset_id, asset, transfer_id, transaction, unsigned_payload, signed_payload, transaction_hash, status].hash
|
297
329
|
end
|
298
330
|
|
299
331
|
# Builds the object from hash
|
@@ -23,12 +23,42 @@ module Coinbase::Client
|
|
23
23
|
|
24
24
|
attr_accessor :default_address
|
25
25
|
|
26
|
+
# The features enabled for the wallet
|
27
|
+
attr_accessor :enabled_features
|
28
|
+
|
29
|
+
# The status of the Server-Signer for the wallet if present.
|
30
|
+
attr_accessor :server_signer_status
|
31
|
+
|
32
|
+
class EnumAttributeValidator
|
33
|
+
attr_reader :datatype
|
34
|
+
attr_reader :allowable_values
|
35
|
+
|
36
|
+
def initialize(datatype, allowable_values)
|
37
|
+
@allowable_values = allowable_values.map do |value|
|
38
|
+
case datatype.to_s
|
39
|
+
when /Integer/i
|
40
|
+
value.to_i
|
41
|
+
when /Float/i
|
42
|
+
value.to_f
|
43
|
+
else
|
44
|
+
value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def valid?(value)
|
50
|
+
!value || allowable_values.include?(value)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
26
54
|
# Attribute mapping from ruby-style variable name to JSON key.
|
27
55
|
def self.attribute_map
|
28
56
|
{
|
29
57
|
:'id' => :'id',
|
30
58
|
:'network_id' => :'network_id',
|
31
|
-
:'default_address' => :'default_address'
|
59
|
+
:'default_address' => :'default_address',
|
60
|
+
:'enabled_features' => :'enabled_features',
|
61
|
+
:'server_signer_status' => :'server_signer_status'
|
32
62
|
}
|
33
63
|
end
|
34
64
|
|
@@ -42,7 +72,9 @@ module Coinbase::Client
|
|
42
72
|
{
|
43
73
|
:'id' => :'String',
|
44
74
|
:'network_id' => :'String',
|
45
|
-
:'default_address' => :'Address'
|
75
|
+
:'default_address' => :'Address',
|
76
|
+
:'enabled_features' => :'Array<Feature>',
|
77
|
+
:'server_signer_status' => :'String'
|
46
78
|
}
|
47
79
|
end
|
48
80
|
|
@@ -69,6 +101,8 @@ module Coinbase::Client
|
|
69
101
|
|
70
102
|
if attributes.key?(:'id')
|
71
103
|
self.id = attributes[:'id']
|
104
|
+
else
|
105
|
+
self.id = nil
|
72
106
|
end
|
73
107
|
|
74
108
|
if attributes.key?(:'network_id')
|
@@ -80,6 +114,18 @@ module Coinbase::Client
|
|
80
114
|
if attributes.key?(:'default_address')
|
81
115
|
self.default_address = attributes[:'default_address']
|
82
116
|
end
|
117
|
+
|
118
|
+
if attributes.key?(:'enabled_features')
|
119
|
+
if (value = attributes[:'enabled_features']).is_a?(Array)
|
120
|
+
self.enabled_features = value
|
121
|
+
end
|
122
|
+
else
|
123
|
+
self.enabled_features = nil
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'server_signer_status')
|
127
|
+
self.server_signer_status = attributes[:'server_signer_status']
|
128
|
+
end
|
83
129
|
end
|
84
130
|
|
85
131
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -87,10 +133,18 @@ module Coinbase::Client
|
|
87
133
|
def list_invalid_properties
|
88
134
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
89
135
|
invalid_properties = Array.new
|
136
|
+
if @id.nil?
|
137
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
138
|
+
end
|
139
|
+
|
90
140
|
if @network_id.nil?
|
91
141
|
invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
|
92
142
|
end
|
93
143
|
|
144
|
+
if @enabled_features.nil?
|
145
|
+
invalid_properties.push('invalid value for "enabled_features", enabled_features cannot be nil.')
|
146
|
+
end
|
147
|
+
|
94
148
|
invalid_properties
|
95
149
|
end
|
96
150
|
|
@@ -98,10 +152,24 @@ module Coinbase::Client
|
|
98
152
|
# @return true if the model is valid
|
99
153
|
def valid?
|
100
154
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
155
|
+
return false if @id.nil?
|
101
156
|
return false if @network_id.nil?
|
157
|
+
return false if @enabled_features.nil?
|
158
|
+
server_signer_status_validator = EnumAttributeValidator.new('String', ["pending_seed_creation", "active_seed"])
|
159
|
+
return false unless server_signer_status_validator.valid?(@server_signer_status)
|
102
160
|
true
|
103
161
|
end
|
104
162
|
|
163
|
+
# Custom attribute writer method checking allowed values (enum).
|
164
|
+
# @param [Object] server_signer_status Object to be assigned
|
165
|
+
def server_signer_status=(server_signer_status)
|
166
|
+
validator = EnumAttributeValidator.new('String', ["pending_seed_creation", "active_seed"])
|
167
|
+
unless validator.valid?(server_signer_status)
|
168
|
+
fail ArgumentError, "invalid value for \"server_signer_status\", must be one of #{validator.allowable_values}."
|
169
|
+
end
|
170
|
+
@server_signer_status = server_signer_status
|
171
|
+
end
|
172
|
+
|
105
173
|
# Checks equality by comparing each attribute.
|
106
174
|
# @param [Object] Object to be compared
|
107
175
|
def ==(o)
|
@@ -109,7 +177,9 @@ module Coinbase::Client
|
|
109
177
|
self.class == o.class &&
|
110
178
|
id == o.id &&
|
111
179
|
network_id == o.network_id &&
|
112
|
-
default_address == o.default_address
|
180
|
+
default_address == o.default_address &&
|
181
|
+
enabled_features == o.enabled_features &&
|
182
|
+
server_signer_status == o.server_signer_status
|
113
183
|
end
|
114
184
|
|
115
185
|
# @see the `==` method
|
@@ -121,7 +191,7 @@ module Coinbase::Client
|
|
121
191
|
# Calculates hash code according to all attributes.
|
122
192
|
# @return [Integer] Hash code
|
123
193
|
def hash
|
124
|
-
[id, network_id, default_address].hash
|
194
|
+
[id, network_id, default_address, enabled_features, server_signer_status].hash
|
125
195
|
end
|
126
196
|
|
127
197
|
# Builds the object from hash
|
data/lib/coinbase/client.rb
CHANGED
@@ -22,12 +22,32 @@ Coinbase::Client.autoload :AddressBalanceList, 'coinbase/client/models/address_b
|
|
22
22
|
Coinbase::Client.autoload :AddressList, 'coinbase/client/models/address_list'
|
23
23
|
Coinbase::Client.autoload :Asset, 'coinbase/client/models/asset'
|
24
24
|
Coinbase::Client.autoload :Balance, 'coinbase/client/models/balance'
|
25
|
+
Coinbase::Client.autoload :BroadcastTradeRequest, 'coinbase/client/models/broadcast_trade_request'
|
25
26
|
Coinbase::Client.autoload :BroadcastTransferRequest, 'coinbase/client/models/broadcast_transfer_request'
|
27
|
+
Coinbase::Client.autoload :BuildStakingOperationRequest, 'coinbase/client/models/build_staking_operation_request'
|
26
28
|
Coinbase::Client.autoload :CreateAddressRequest, 'coinbase/client/models/create_address_request'
|
29
|
+
Coinbase::Client.autoload :CreateServerSignerRequest, 'coinbase/client/models/create_server_signer_request'
|
30
|
+
Coinbase::Client.autoload :CreateTradeRequest, 'coinbase/client/models/create_trade_request'
|
27
31
|
Coinbase::Client.autoload :CreateTransferRequest, 'coinbase/client/models/create_transfer_request'
|
28
32
|
Coinbase::Client.autoload :CreateWalletRequest, 'coinbase/client/models/create_wallet_request'
|
33
|
+
Coinbase::Client.autoload :CreateWalletRequestWallet, 'coinbase/client/models/create_wallet_request_wallet'
|
29
34
|
Coinbase::Client.autoload :Error, 'coinbase/client/models/error'
|
30
35
|
Coinbase::Client.autoload :FaucetTransaction, 'coinbase/client/models/faucet_transaction'
|
36
|
+
Coinbase::Client.autoload :Feature, 'coinbase/client/models/feature'
|
37
|
+
Coinbase::Client.autoload :SeedCreationEvent, 'coinbase/client/models/seed_creation_event'
|
38
|
+
Coinbase::Client.autoload :SeedCreationEventResult, 'coinbase/client/models/seed_creation_event_result'
|
39
|
+
Coinbase::Client.autoload :ServerSigner, 'coinbase/client/models/server_signer'
|
40
|
+
Coinbase::Client.autoload :ServerSignerEvent, 'coinbase/client/models/server_signer_event'
|
41
|
+
Coinbase::Client.autoload :ServerSignerEventEvent, 'coinbase/client/models/server_signer_event_event'
|
42
|
+
Coinbase::Client.autoload :ServerSignerEventList, 'coinbase/client/models/server_signer_event_list'
|
43
|
+
Coinbase::Client.autoload :ServerSignerList, 'coinbase/client/models/server_signer_list'
|
44
|
+
Coinbase::Client.autoload :SignatureCreationEvent, 'coinbase/client/models/signature_creation_event'
|
45
|
+
Coinbase::Client.autoload :SignatureCreationEventResult, 'coinbase/client/models/signature_creation_event_result'
|
46
|
+
Coinbase::Client.autoload :StakingOperation, 'coinbase/client/models/staking_operation'
|
47
|
+
Coinbase::Client.autoload :Trade, 'coinbase/client/models/trade'
|
48
|
+
Coinbase::Client.autoload :TradeList, 'coinbase/client/models/trade_list'
|
49
|
+
Coinbase::Client.autoload :Transaction, 'coinbase/client/models/transaction'
|
50
|
+
Coinbase::Client.autoload :TransactionType, 'coinbase/client/models/transaction_type'
|
31
51
|
Coinbase::Client.autoload :Transfer, 'coinbase/client/models/transfer'
|
32
52
|
Coinbase::Client.autoload :TransferList, 'coinbase/client/models/transfer_list'
|
33
53
|
Coinbase::Client.autoload :User, 'coinbase/client/models/user'
|
@@ -36,6 +56,9 @@ Coinbase::Client.autoload :WalletList, 'coinbase/client/models/wallet_list'
|
|
36
56
|
|
37
57
|
# APIs
|
38
58
|
Coinbase::Client.autoload :AddressesApi, 'coinbase/client/api/addresses_api'
|
59
|
+
Coinbase::Client.autoload :ServerSignersApi, 'coinbase/client/api/server_signers_api'
|
60
|
+
Coinbase::Client.autoload :StakeApi, 'coinbase/client/api/stake_api'
|
61
|
+
Coinbase::Client.autoload :TradesApi, 'coinbase/client/api/trades_api'
|
39
62
|
Coinbase::Client.autoload :TransfersApi, 'coinbase/client/api/transfers_api'
|
40
63
|
Coinbase::Client.autoload :UsersApi, 'coinbase/client/api/users_api'
|
41
64
|
Coinbase::Client.autoload :WalletsApi, 'coinbase/client/api/wallets_api'
|
data/lib/coinbase/errors.rb
CHANGED
@@ -76,6 +76,8 @@ module Coinbase
|
|
76
76
|
InvalidSignedPayloadError.new(err)
|
77
77
|
when 'invalid_transfer_status'
|
78
78
|
InvalidTransferStatusError.new(err)
|
79
|
+
when 'network_feature_unsupported'
|
80
|
+
NetworkFeatureUnsupportedError.new(err)
|
79
81
|
else
|
80
82
|
APIError.new(err)
|
81
83
|
end
|
@@ -117,4 +119,5 @@ module Coinbase
|
|
117
119
|
class FaucetLimitReachedError < APIError; end
|
118
120
|
class InvalidSignedPayloadError < APIError; end
|
119
121
|
class InvalidTransferStatusError < APIError; end
|
122
|
+
class NetworkFeatureUnsupportedError < APIError; end
|
120
123
|
end
|