coinbase-sdk 0.0.7 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/external_address.rb +173 -0
  3. data/lib/coinbase/address/wallet_address.rb +219 -0
  4. data/lib/coinbase/address.rb +32 -219
  5. data/lib/coinbase/asset.rb +76 -66
  6. data/lib/coinbase/authenticator.rb +2 -0
  7. data/lib/coinbase/balance.rb +10 -6
  8. data/lib/coinbase/client/api/addresses_api.rb +1 -1
  9. data/lib/coinbase/client/api/assets_api.rb +91 -0
  10. data/lib/coinbase/client/api/external_addresses_api.rb +242 -0
  11. data/lib/coinbase/client/api/server_signers_api.rb +1 -1
  12. data/lib/coinbase/client/api/stake_api.rb +157 -7
  13. data/lib/coinbase/client/api/trades_api.rb +1 -1
  14. data/lib/coinbase/client/api/transfers_api.rb +1 -1
  15. data/lib/coinbase/client/api/users_api.rb +1 -1
  16. data/lib/coinbase/client/api/wallets_api.rb +1 -1
  17. data/lib/coinbase/client/api_client.rb +3 -3
  18. data/lib/coinbase/client/api_error.rb +1 -1
  19. data/lib/coinbase/client/configuration.rb +1 -1
  20. data/lib/coinbase/client/models/address.rb +1 -1
  21. data/lib/coinbase/client/models/address_balance_list.rb +1 -1
  22. data/lib/coinbase/client/models/address_list.rb +1 -1
  23. data/lib/coinbase/client/models/asset.rb +1 -1
  24. data/lib/coinbase/client/models/balance.rb +1 -1
  25. data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
  26. data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
  27. data/lib/coinbase/client/models/build_staking_operation_request.rb +1 -1
  28. data/lib/coinbase/client/models/create_address_request.rb +1 -1
  29. data/lib/coinbase/client/models/create_server_signer_request.rb +22 -5
  30. data/lib/coinbase/client/models/create_trade_request.rb +1 -1
  31. data/lib/coinbase/client/models/create_transfer_request.rb +1 -1
  32. data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
  33. data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
  34. data/lib/coinbase/client/models/error.rb +1 -1
  35. data/lib/coinbase/client/models/faucet_transaction.rb +23 -5
  36. data/lib/coinbase/client/models/feature.rb +1 -1
  37. data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +258 -0
  38. data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +330 -0
  39. data/lib/coinbase/client/models/get_staking_context_request.rb +274 -0
  40. data/lib/coinbase/client/models/partial_eth_staking_context.rb +254 -0
  41. data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
  42. data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
  43. data/lib/coinbase/client/models/server_signer.rb +22 -5
  44. data/lib/coinbase/client/models/server_signer_event.rb +1 -1
  45. data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
  46. data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
  47. data/lib/coinbase/client/models/server_signer_list.rb +1 -1
  48. data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
  49. data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
  50. data/lib/coinbase/client/models/{request_faucet_funds200_response.rb → staking_context.rb} +16 -16
  51. data/lib/coinbase/client/models/staking_context_context.rb +104 -0
  52. data/lib/coinbase/client/models/staking_operation.rb +15 -12
  53. data/lib/coinbase/client/models/staking_reward.rb +324 -0
  54. data/lib/coinbase/client/models/staking_reward_format.rb +40 -0
  55. data/lib/coinbase/client/models/trade.rb +1 -1
  56. data/lib/coinbase/client/models/trade_list.rb +1 -1
  57. data/lib/coinbase/client/models/transaction.rb +1 -1
  58. data/lib/coinbase/client/models/transaction_type.rb +1 -1
  59. data/lib/coinbase/client/models/transfer.rb +1 -1
  60. data/lib/coinbase/client/models/transfer_list.rb +1 -1
  61. data/lib/coinbase/client/models/user.rb +1 -1
  62. data/lib/coinbase/client/models/wallet.rb +1 -1
  63. data/lib/coinbase/client/models/wallet_list.rb +1 -1
  64. data/lib/coinbase/client/version.rb +1 -1
  65. data/lib/coinbase/client.rb +11 -1
  66. data/lib/coinbase/constants.rb +2 -27
  67. data/lib/coinbase/errors.rb +56 -64
  68. data/lib/coinbase/faucet_transaction.rb +5 -4
  69. data/lib/coinbase/network.rb +6 -20
  70. data/lib/coinbase/pagination.rb +26 -0
  71. data/lib/coinbase/staking_operation.rb +29 -0
  72. data/lib/coinbase/staking_reward.rb +79 -0
  73. data/lib/coinbase/transaction.rb +6 -0
  74. data/lib/coinbase/user.rb +5 -51
  75. data/lib/coinbase/wallet.rb +97 -102
  76. data/lib/coinbase.rb +19 -11
  77. metadata +17 -17
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
  Contact: yuga.cohler@coinbase.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.5.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -21,11 +21,15 @@ module Coinbase::Client
21
21
  # The enrollment data of the server signer. This will be the base64 encoded server-signer-id.
22
22
  attr_accessor :enrollment_data
23
23
 
24
+ # Whether the Server-Signer uses MPC.
25
+ attr_accessor :is_mpc
26
+
24
27
  # Attribute mapping from ruby-style variable name to JSON key.
25
28
  def self.attribute_map
26
29
  {
27
30
  :'server_signer_id' => :'server_signer_id',
28
- :'enrollment_data' => :'enrollment_data'
31
+ :'enrollment_data' => :'enrollment_data',
32
+ :'is_mpc' => :'is_mpc'
29
33
  }
30
34
  end
31
35
 
@@ -38,7 +42,8 @@ module Coinbase::Client
38
42
  def self.openapi_types
39
43
  {
40
44
  :'server_signer_id' => :'String',
41
- :'enrollment_data' => :'String'
45
+ :'enrollment_data' => :'String',
46
+ :'is_mpc' => :'Boolean'
42
47
  }
43
48
  end
44
49
 
@@ -74,6 +79,12 @@ module Coinbase::Client
74
79
  else
75
80
  self.enrollment_data = nil
76
81
  end
82
+
83
+ if attributes.key?(:'is_mpc')
84
+ self.is_mpc = attributes[:'is_mpc']
85
+ else
86
+ self.is_mpc = nil
87
+ end
77
88
  end
78
89
 
79
90
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -89,6 +100,10 @@ module Coinbase::Client
89
100
  invalid_properties.push('invalid value for "enrollment_data", enrollment_data cannot be nil.')
90
101
  end
91
102
 
103
+ if @is_mpc.nil?
104
+ invalid_properties.push('invalid value for "is_mpc", is_mpc cannot be nil.')
105
+ end
106
+
92
107
  invalid_properties
93
108
  end
94
109
 
@@ -98,6 +113,7 @@ module Coinbase::Client
98
113
  warn '[DEPRECATED] the `valid?` method is obsolete'
99
114
  return false if @server_signer_id.nil?
100
115
  return false if @enrollment_data.nil?
116
+ return false if @is_mpc.nil?
101
117
  true
102
118
  end
103
119
 
@@ -107,7 +123,8 @@ module Coinbase::Client
107
123
  return true if self.equal?(o)
108
124
  self.class == o.class &&
109
125
  server_signer_id == o.server_signer_id &&
110
- enrollment_data == o.enrollment_data
126
+ enrollment_data == o.enrollment_data &&
127
+ is_mpc == o.is_mpc
111
128
  end
112
129
 
113
130
  # @see the `==` method
@@ -119,7 +136,7 @@ module Coinbase::Client
119
136
  # Calculates hash code according to all attributes.
120
137
  # @return [Integer] Hash code
121
138
  def hash
122
- [server_signer_id, enrollment_data].hash
139
+ [server_signer_id, enrollment_data, is_mpc].hash
123
140
  end
124
141
 
125
142
  # Builds the object from hash
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
  Contact: yuga.cohler@coinbase.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.5.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
  Contact: yuga.cohler@coinbase.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.5.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
  Contact: yuga.cohler@coinbase.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.5.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
  Contact: yuga.cohler@coinbase.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.5.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
  Contact: yuga.cohler@coinbase.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.5.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
  Contact: yuga.cohler@coinbase.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.5.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -14,14 +14,19 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Coinbase::Client
17
+ # The faucet transaction
17
18
  class FaucetTransaction
18
19
  # The transaction hash of the transaction the faucet created.
19
20
  attr_accessor :transaction_hash
20
21
 
22
+ # Link to the transaction on the blockchain explorer.
23
+ attr_accessor :transaction_link
24
+
21
25
  # Attribute mapping from ruby-style variable name to JSON key.
22
26
  def self.attribute_map
23
27
  {
24
- :'transaction_hash' => :'transaction_hash'
28
+ :'transaction_hash' => :'transaction_hash',
29
+ :'transaction_link' => :'transaction_link'
25
30
  }
26
31
  end
27
32
 
@@ -33,7 +38,8 @@ module Coinbase::Client
33
38
  # Attribute type mapping.
34
39
  def self.openapi_types
35
40
  {
36
- :'transaction_hash' => :'String'
41
+ :'transaction_hash' => :'String',
42
+ :'transaction_link' => :'String'
37
43
  }
38
44
  end
39
45
 
@@ -63,6 +69,12 @@ module Coinbase::Client
63
69
  else
64
70
  self.transaction_hash = nil
65
71
  end
72
+
73
+ if attributes.key?(:'transaction_link')
74
+ self.transaction_link = attributes[:'transaction_link']
75
+ else
76
+ self.transaction_link = nil
77
+ end
66
78
  end
67
79
 
68
80
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -74,6 +86,10 @@ module Coinbase::Client
74
86
  invalid_properties.push('invalid value for "transaction_hash", transaction_hash cannot be nil.')
75
87
  end
76
88
 
89
+ if @transaction_link.nil?
90
+ invalid_properties.push('invalid value for "transaction_link", transaction_link cannot be nil.')
91
+ end
92
+
77
93
  invalid_properties
78
94
  end
79
95
 
@@ -82,6 +98,7 @@ module Coinbase::Client
82
98
  def valid?
83
99
  warn '[DEPRECATED] the `valid?` method is obsolete'
84
100
  return false if @transaction_hash.nil?
101
+ return false if @transaction_link.nil?
85
102
  true
86
103
  end
87
104
 
@@ -90,7 +107,8 @@ module Coinbase::Client
90
107
  def ==(o)
91
108
  return true if self.equal?(o)
92
109
  self.class == o.class &&
93
- transaction_hash == o.transaction_hash
110
+ transaction_hash == o.transaction_hash &&
111
+ transaction_link == o.transaction_link
94
112
  end
95
113
 
96
114
  # @see the `==` method
@@ -102,7 +120,7 @@ module Coinbase::Client
102
120
  # Calculates hash code according to all attributes.
103
121
  # @return [Integer] Hash code
104
122
  def hash
105
- [transaction_hash].hash
123
+ [transaction_hash, transaction_link].hash
106
124
  end
107
125
 
108
126
  # Builds the object from hash
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
  Contact: yuga.cohler@coinbase.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.5.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,258 @@
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.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Coinbase::Client
17
+ #
18
+ class FetchStakingRewards200Response
19
+ attr_accessor :data
20
+
21
+ # True if this list has another page of items after this one that can be fetched.
22
+ attr_accessor :has_more
23
+
24
+ # The page token to be used to fetch the next page.
25
+ attr_accessor :next_page
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'data' => :'data',
31
+ :'has_more' => :'has_more',
32
+ :'next_page' => :'next_page'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'data' => :'Array<StakingReward>',
45
+ :'has_more' => :'Boolean',
46
+ :'next_page' => :'String'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::FetchStakingRewards200Response` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::FetchStakingRewards200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'data')
72
+ if (value = attributes[:'data']).is_a?(Array)
73
+ self.data = value
74
+ end
75
+ else
76
+ self.data = nil
77
+ end
78
+
79
+ if attributes.key?(:'has_more')
80
+ self.has_more = attributes[:'has_more']
81
+ else
82
+ self.has_more = nil
83
+ end
84
+
85
+ if attributes.key?(:'next_page')
86
+ self.next_page = attributes[:'next_page']
87
+ else
88
+ self.next_page = nil
89
+ end
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
96
+ invalid_properties = Array.new
97
+ if @data.nil?
98
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
99
+ end
100
+
101
+ if @has_more.nil?
102
+ invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
103
+ end
104
+
105
+ if @next_page.nil?
106
+ invalid_properties.push('invalid value for "next_page", next_page cannot be nil.')
107
+ end
108
+
109
+ invalid_properties
110
+ end
111
+
112
+ # Check to see if the all the properties in the model are valid
113
+ # @return true if the model is valid
114
+ def valid?
115
+ warn '[DEPRECATED] the `valid?` method is obsolete'
116
+ return false if @data.nil?
117
+ return false if @has_more.nil?
118
+ return false if @next_page.nil?
119
+ true
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ data == o.data &&
128
+ has_more == o.has_more &&
129
+ next_page == o.next_page
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [data, has_more, next_page].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ attributes = attributes.transform_keys(&:to_sym)
150
+ transformed_hash = {}
151
+ openapi_types.each_pair do |key, type|
152
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = nil
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[attribute_map[key]].is_a?(Array)
158
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
159
+ end
160
+ elsif !attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
162
+ end
163
+ end
164
+ new(transformed_hash)
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def self._deserialize(type, value)
172
+ case type.to_sym
173
+ when :Time
174
+ Time.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :Boolean
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ # models (e.g. Pet) or oneOf
205
+ klass = Coinbase::Client.const_get(type)
206
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
207
+ end
208
+ end
209
+
210
+ # Returns the string representation of the object
211
+ # @return [String] String presentation of the object
212
+ def to_s
213
+ to_hash.to_s
214
+ end
215
+
216
+ # to_body is an alias to to_hash (backward compatibility)
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_body
219
+ to_hash
220
+ end
221
+
222
+ # Returns the object in the form of hash
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_hash
225
+ hash = {}
226
+ self.class.attribute_map.each_pair do |attr, param|
227
+ value = self.send(attr)
228
+ if value.nil?
229
+ is_nullable = self.class.openapi_nullable.include?(attr)
230
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
231
+ end
232
+
233
+ hash[param] = _to_hash(value)
234
+ end
235
+ hash
236
+ end
237
+
238
+ # Outputs non-array value in the form of hash
239
+ # For object, use to_hash. Otherwise, just return the value
240
+ # @param [Object] value Any valid value
241
+ # @return [Hash] Returns the value in the form of hash
242
+ def _to_hash(value)
243
+ if value.is_a?(Array)
244
+ value.compact.map { |v| _to_hash(v) }
245
+ elsif value.is_a?(Hash)
246
+ {}.tap do |hash|
247
+ value.each { |k, v| hash[k] = _to_hash(v) }
248
+ end
249
+ elsif value.respond_to? :to_hash
250
+ value.to_hash
251
+ else
252
+ value
253
+ end
254
+ end
255
+
256
+ end
257
+
258
+ end