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.
- checksums.yaml +4 -4
- data/lib/coinbase/address/external_address.rb +173 -0
- data/lib/coinbase/address/wallet_address.rb +219 -0
- data/lib/coinbase/address.rb +32 -219
- data/lib/coinbase/asset.rb +76 -66
- data/lib/coinbase/authenticator.rb +2 -0
- data/lib/coinbase/balance.rb +10 -6
- data/lib/coinbase/client/api/addresses_api.rb +1 -1
- data/lib/coinbase/client/api/assets_api.rb +91 -0
- data/lib/coinbase/client/api/external_addresses_api.rb +242 -0
- data/lib/coinbase/client/api/server_signers_api.rb +1 -1
- data/lib/coinbase/client/api/stake_api.rb +157 -7
- data/lib/coinbase/client/api/trades_api.rb +1 -1
- data/lib/coinbase/client/api/transfers_api.rb +1 -1
- data/lib/coinbase/client/api/users_api.rb +1 -1
- data/lib/coinbase/client/api/wallets_api.rb +1 -1
- data/lib/coinbase/client/api_client.rb +3 -3
- data/lib/coinbase/client/api_error.rb +1 -1
- data/lib/coinbase/client/configuration.rb +1 -1
- data/lib/coinbase/client/models/address.rb +1 -1
- data/lib/coinbase/client/models/address_balance_list.rb +1 -1
- data/lib/coinbase/client/models/address_list.rb +1 -1
- data/lib/coinbase/client/models/asset.rb +1 -1
- data/lib/coinbase/client/models/balance.rb +1 -1
- data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
- data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
- data/lib/coinbase/client/models/build_staking_operation_request.rb +1 -1
- data/lib/coinbase/client/models/create_address_request.rb +1 -1
- data/lib/coinbase/client/models/create_server_signer_request.rb +22 -5
- data/lib/coinbase/client/models/create_trade_request.rb +1 -1
- data/lib/coinbase/client/models/create_transfer_request.rb +1 -1
- data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
- data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
- data/lib/coinbase/client/models/error.rb +1 -1
- data/lib/coinbase/client/models/faucet_transaction.rb +23 -5
- data/lib/coinbase/client/models/feature.rb +1 -1
- data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +258 -0
- data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +330 -0
- data/lib/coinbase/client/models/get_staking_context_request.rb +274 -0
- data/lib/coinbase/client/models/partial_eth_staking_context.rb +254 -0
- data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
- data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
- data/lib/coinbase/client/models/server_signer.rb +22 -5
- data/lib/coinbase/client/models/server_signer_event.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
- data/lib/coinbase/client/models/server_signer_list.rb +1 -1
- data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
- data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
- data/lib/coinbase/client/models/{request_faucet_funds200_response.rb → staking_context.rb} +16 -16
- data/lib/coinbase/client/models/staking_context_context.rb +104 -0
- data/lib/coinbase/client/models/staking_operation.rb +15 -12
- data/lib/coinbase/client/models/staking_reward.rb +324 -0
- data/lib/coinbase/client/models/staking_reward_format.rb +40 -0
- data/lib/coinbase/client/models/trade.rb +1 -1
- data/lib/coinbase/client/models/trade_list.rb +1 -1
- data/lib/coinbase/client/models/transaction.rb +1 -1
- data/lib/coinbase/client/models/transaction_type.rb +1 -1
- data/lib/coinbase/client/models/transfer.rb +1 -1
- data/lib/coinbase/client/models/transfer_list.rb +1 -1
- data/lib/coinbase/client/models/user.rb +1 -1
- data/lib/coinbase/client/models/wallet.rb +1 -1
- data/lib/coinbase/client/models/wallet_list.rb +1 -1
- data/lib/coinbase/client/version.rb +1 -1
- data/lib/coinbase/client.rb +11 -1
- data/lib/coinbase/constants.rb +2 -27
- data/lib/coinbase/errors.rb +56 -64
- data/lib/coinbase/faucet_transaction.rb +5 -4
- data/lib/coinbase/network.rb +6 -20
- data/lib/coinbase/pagination.rb +26 -0
- data/lib/coinbase/staking_operation.rb +29 -0
- data/lib/coinbase/staking_reward.rb +79 -0
- data/lib/coinbase/transaction.rb +6 -0
- data/lib/coinbase/user.rb +5 -51
- data/lib/coinbase/wallet.rb +97 -102
- data/lib/coinbase.rb +19 -11
- 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.
|
9
|
+
Generator version: 7.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -16,12 +16,13 @@ require 'time'
|
|
16
16
|
module Coinbase::Client
|
17
17
|
# An onchain transaction to help realize a staking action.
|
18
18
|
class StakingOperation
|
19
|
-
|
19
|
+
# The transaction(s) that will execute the staking operation onchain
|
20
|
+
attr_accessor :transactions
|
20
21
|
|
21
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
23
|
def self.attribute_map
|
23
24
|
{
|
24
|
-
:'
|
25
|
+
:'transactions' => :'transactions'
|
25
26
|
}
|
26
27
|
end
|
27
28
|
|
@@ -33,7 +34,7 @@ module Coinbase::Client
|
|
33
34
|
# Attribute type mapping.
|
34
35
|
def self.openapi_types
|
35
36
|
{
|
36
|
-
:'
|
37
|
+
:'transactions' => :'Array<Transaction>'
|
37
38
|
}
|
38
39
|
end
|
39
40
|
|
@@ -58,10 +59,12 @@ module Coinbase::Client
|
|
58
59
|
h[k.to_sym] = v
|
59
60
|
}
|
60
61
|
|
61
|
-
if attributes.key?(:'
|
62
|
-
|
62
|
+
if attributes.key?(:'transactions')
|
63
|
+
if (value = attributes[:'transactions']).is_a?(Array)
|
64
|
+
self.transactions = value
|
65
|
+
end
|
63
66
|
else
|
64
|
-
self.
|
67
|
+
self.transactions = nil
|
65
68
|
end
|
66
69
|
end
|
67
70
|
|
@@ -70,8 +73,8 @@ module Coinbase::Client
|
|
70
73
|
def list_invalid_properties
|
71
74
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
72
75
|
invalid_properties = Array.new
|
73
|
-
if @
|
74
|
-
invalid_properties.push('invalid value for "
|
76
|
+
if @transactions.nil?
|
77
|
+
invalid_properties.push('invalid value for "transactions", transactions cannot be nil.')
|
75
78
|
end
|
76
79
|
|
77
80
|
invalid_properties
|
@@ -81,7 +84,7 @@ module Coinbase::Client
|
|
81
84
|
# @return true if the model is valid
|
82
85
|
def valid?
|
83
86
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
84
|
-
return false if @
|
87
|
+
return false if @transactions.nil?
|
85
88
|
true
|
86
89
|
end
|
87
90
|
|
@@ -90,7 +93,7 @@ module Coinbase::Client
|
|
90
93
|
def ==(o)
|
91
94
|
return true if self.equal?(o)
|
92
95
|
self.class == o.class &&
|
93
|
-
|
96
|
+
transactions == o.transactions
|
94
97
|
end
|
95
98
|
|
96
99
|
# @see the `==` method
|
@@ -102,7 +105,7 @@ module Coinbase::Client
|
|
102
105
|
# Calculates hash code according to all attributes.
|
103
106
|
# @return [Integer] Hash code
|
104
107
|
def hash
|
105
|
-
[
|
108
|
+
[transactions].hash
|
106
109
|
end
|
107
110
|
|
108
111
|
# Builds the object from hash
|
@@ -0,0 +1,324 @@
|
|
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
|
+
# 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
|
+
attr_accessor :format
|
32
|
+
|
33
|
+
class EnumAttributeValidator
|
34
|
+
attr_reader :datatype
|
35
|
+
attr_reader :allowable_values
|
36
|
+
|
37
|
+
def initialize(datatype, allowable_values)
|
38
|
+
@allowable_values = allowable_values.map do |value|
|
39
|
+
case datatype.to_s
|
40
|
+
when /Integer/i
|
41
|
+
value.to_i
|
42
|
+
when /Float/i
|
43
|
+
value.to_f
|
44
|
+
else
|
45
|
+
value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def valid?(value)
|
51
|
+
!value || allowable_values.include?(value)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
56
|
+
def self.attribute_map
|
57
|
+
{
|
58
|
+
:'address_id' => :'address_id',
|
59
|
+
:'date' => :'date',
|
60
|
+
:'amount' => :'amount',
|
61
|
+
:'state' => :'state',
|
62
|
+
:'format' => :'format'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns all the JSON keys this model knows about
|
67
|
+
def self.acceptable_attributes
|
68
|
+
attribute_map.values
|
69
|
+
end
|
70
|
+
|
71
|
+
# Attribute type mapping.
|
72
|
+
def self.openapi_types
|
73
|
+
{
|
74
|
+
:'address_id' => :'String',
|
75
|
+
:'date' => :'Date',
|
76
|
+
:'amount' => :'String',
|
77
|
+
:'state' => :'String',
|
78
|
+
:'format' => :'StakingRewardFormat'
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
# List of attributes with nullable: true
|
83
|
+
def self.openapi_nullable
|
84
|
+
Set.new([
|
85
|
+
])
|
86
|
+
end
|
87
|
+
|
88
|
+
# Initializes the object
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
90
|
+
def initialize(attributes = {})
|
91
|
+
if (!attributes.is_a?(Hash))
|
92
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::StakingReward` initialize method"
|
93
|
+
end
|
94
|
+
|
95
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
96
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
97
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
98
|
+
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
|
99
|
+
end
|
100
|
+
h[k.to_sym] = v
|
101
|
+
}
|
102
|
+
|
103
|
+
if attributes.key?(:'address_id')
|
104
|
+
self.address_id = attributes[:'address_id']
|
105
|
+
else
|
106
|
+
self.address_id = nil
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'date')
|
110
|
+
self.date = attributes[:'date']
|
111
|
+
else
|
112
|
+
self.date = nil
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'amount')
|
116
|
+
self.amount = attributes[:'amount']
|
117
|
+
else
|
118
|
+
self.amount = nil
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'state')
|
122
|
+
self.state = attributes[:'state']
|
123
|
+
else
|
124
|
+
self.state = nil
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'format')
|
128
|
+
self.format = attributes[:'format']
|
129
|
+
else
|
130
|
+
self.format = 'usd'
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
135
|
+
# @return Array for valid properties with the reasons
|
136
|
+
def list_invalid_properties
|
137
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
138
|
+
invalid_properties = Array.new
|
139
|
+
if @address_id.nil?
|
140
|
+
invalid_properties.push('invalid value for "address_id", address_id cannot be nil.')
|
141
|
+
end
|
142
|
+
|
143
|
+
if @date.nil?
|
144
|
+
invalid_properties.push('invalid value for "date", date cannot be nil.')
|
145
|
+
end
|
146
|
+
|
147
|
+
if @amount.nil?
|
148
|
+
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
149
|
+
end
|
150
|
+
|
151
|
+
if @state.nil?
|
152
|
+
invalid_properties.push('invalid value for "state", state cannot be nil.')
|
153
|
+
end
|
154
|
+
|
155
|
+
if @format.nil?
|
156
|
+
invalid_properties.push('invalid value for "format", format cannot be nil.')
|
157
|
+
end
|
158
|
+
|
159
|
+
invalid_properties
|
160
|
+
end
|
161
|
+
|
162
|
+
# Check to see if the all the properties in the model are valid
|
163
|
+
# @return true if the model is valid
|
164
|
+
def valid?
|
165
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
166
|
+
return false if @address_id.nil?
|
167
|
+
return false if @date.nil?
|
168
|
+
return false if @amount.nil?
|
169
|
+
return false if @state.nil?
|
170
|
+
state_validator = EnumAttributeValidator.new('String', ["pending", "distributed"])
|
171
|
+
return false unless state_validator.valid?(@state)
|
172
|
+
return false if @format.nil?
|
173
|
+
true
|
174
|
+
end
|
175
|
+
|
176
|
+
# Custom attribute writer method checking allowed values (enum).
|
177
|
+
# @param [Object] state Object to be assigned
|
178
|
+
def state=(state)
|
179
|
+
validator = EnumAttributeValidator.new('String', ["pending", "distributed"])
|
180
|
+
unless validator.valid?(state)
|
181
|
+
fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
|
182
|
+
end
|
183
|
+
@state = state
|
184
|
+
end
|
185
|
+
|
186
|
+
# Checks equality by comparing each attribute.
|
187
|
+
# @param [Object] Object to be compared
|
188
|
+
def ==(o)
|
189
|
+
return true if self.equal?(o)
|
190
|
+
self.class == o.class &&
|
191
|
+
address_id == o.address_id &&
|
192
|
+
date == o.date &&
|
193
|
+
amount == o.amount &&
|
194
|
+
state == o.state &&
|
195
|
+
format == o.format
|
196
|
+
end
|
197
|
+
|
198
|
+
# @see the `==` method
|
199
|
+
# @param [Object] Object to be compared
|
200
|
+
def eql?(o)
|
201
|
+
self == o
|
202
|
+
end
|
203
|
+
|
204
|
+
# Calculates hash code according to all attributes.
|
205
|
+
# @return [Integer] Hash code
|
206
|
+
def hash
|
207
|
+
[address_id, date, amount, state, format].hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Builds the object from hash
|
211
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
212
|
+
# @return [Object] Returns the model itself
|
213
|
+
def self.build_from_hash(attributes)
|
214
|
+
return nil unless attributes.is_a?(Hash)
|
215
|
+
attributes = attributes.transform_keys(&:to_sym)
|
216
|
+
transformed_hash = {}
|
217
|
+
openapi_types.each_pair do |key, type|
|
218
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
219
|
+
transformed_hash["#{key}"] = nil
|
220
|
+
elsif type =~ /\AArray<(.*)>/i
|
221
|
+
# check to ensure the input is an array given that the attribute
|
222
|
+
# is documented as an array but the input is not
|
223
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
224
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
225
|
+
end
|
226
|
+
elsif !attributes[attribute_map[key]].nil?
|
227
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
228
|
+
end
|
229
|
+
end
|
230
|
+
new(transformed_hash)
|
231
|
+
end
|
232
|
+
|
233
|
+
# Deserializes the data based on type
|
234
|
+
# @param string type Data type
|
235
|
+
# @param string value Value to be deserialized
|
236
|
+
# @return [Object] Deserialized data
|
237
|
+
def self._deserialize(type, value)
|
238
|
+
case type.to_sym
|
239
|
+
when :Time
|
240
|
+
Time.parse(value)
|
241
|
+
when :Date
|
242
|
+
Date.parse(value)
|
243
|
+
when :String
|
244
|
+
value.to_s
|
245
|
+
when :Integer
|
246
|
+
value.to_i
|
247
|
+
when :Float
|
248
|
+
value.to_f
|
249
|
+
when :Boolean
|
250
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
251
|
+
true
|
252
|
+
else
|
253
|
+
false
|
254
|
+
end
|
255
|
+
when :Object
|
256
|
+
# generic object (usually a Hash), return directly
|
257
|
+
value
|
258
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
259
|
+
inner_type = Regexp.last_match[:inner_type]
|
260
|
+
value.map { |v| _deserialize(inner_type, v) }
|
261
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
262
|
+
k_type = Regexp.last_match[:k_type]
|
263
|
+
v_type = Regexp.last_match[:v_type]
|
264
|
+
{}.tap do |hash|
|
265
|
+
value.each do |k, v|
|
266
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
267
|
+
end
|
268
|
+
end
|
269
|
+
else # model
|
270
|
+
# models (e.g. Pet) or oneOf
|
271
|
+
klass = Coinbase::Client.const_get(type)
|
272
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
# Returns the string representation of the object
|
277
|
+
# @return [String] String presentation of the object
|
278
|
+
def to_s
|
279
|
+
to_hash.to_s
|
280
|
+
end
|
281
|
+
|
282
|
+
# to_body is an alias to to_hash (backward compatibility)
|
283
|
+
# @return [Hash] Returns the object in the form of hash
|
284
|
+
def to_body
|
285
|
+
to_hash
|
286
|
+
end
|
287
|
+
|
288
|
+
# Returns the object in the form of hash
|
289
|
+
# @return [Hash] Returns the object in the form of hash
|
290
|
+
def to_hash
|
291
|
+
hash = {}
|
292
|
+
self.class.attribute_map.each_pair do |attr, param|
|
293
|
+
value = self.send(attr)
|
294
|
+
if value.nil?
|
295
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
296
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
297
|
+
end
|
298
|
+
|
299
|
+
hash[param] = _to_hash(value)
|
300
|
+
end
|
301
|
+
hash
|
302
|
+
end
|
303
|
+
|
304
|
+
# Outputs non-array value in the form of hash
|
305
|
+
# For object, use to_hash. Otherwise, just return the value
|
306
|
+
# @param [Object] value Any valid value
|
307
|
+
# @return [Hash] Returns the value in the form of hash
|
308
|
+
def _to_hash(value)
|
309
|
+
if value.is_a?(Array)
|
310
|
+
value.compact.map { |v| _to_hash(v) }
|
311
|
+
elsif value.is_a?(Hash)
|
312
|
+
{}.tap do |hash|
|
313
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
314
|
+
end
|
315
|
+
elsif value.respond_to? :to_hash
|
316
|
+
value.to_hash
|
317
|
+
else
|
318
|
+
value
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
end
|
323
|
+
|
324
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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
|
+
class StakingRewardFormat
|
18
|
+
USD = "usd".freeze
|
19
|
+
NATIVE = "native".freeze
|
20
|
+
|
21
|
+
def self.all_vars
|
22
|
+
@all_vars ||= [USD, NATIVE].freeze
|
23
|
+
end
|
24
|
+
|
25
|
+
# Builds the enum from string
|
26
|
+
# @param [String] The enum value in the form of the string
|
27
|
+
# @return [String] The enum value
|
28
|
+
def self.build_from_hash(value)
|
29
|
+
new.build_from_hash(value)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Builds the enum from string
|
33
|
+
# @param [String] The enum value in the form of the string
|
34
|
+
# @return [String] The enum value
|
35
|
+
def build_from_hash(value)
|
36
|
+
return value if StakingRewardFormat.all_vars.include?(value)
|
37
|
+
raise "Invalid ENUM value #{value} for class #StakingRewardFormat"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/coinbase/client.rb
CHANGED
@@ -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.
|
9
|
+
Generator version: 7.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -34,6 +34,10 @@ Coinbase::Client.autoload :CreateWalletRequestWallet, 'coinbase/client/models/cr
|
|
34
34
|
Coinbase::Client.autoload :Error, 'coinbase/client/models/error'
|
35
35
|
Coinbase::Client.autoload :FaucetTransaction, 'coinbase/client/models/faucet_transaction'
|
36
36
|
Coinbase::Client.autoload :Feature, 'coinbase/client/models/feature'
|
37
|
+
Coinbase::Client.autoload :FetchStakingRewards200Response, 'coinbase/client/models/fetch_staking_rewards200_response'
|
38
|
+
Coinbase::Client.autoload :FetchStakingRewardsRequest, 'coinbase/client/models/fetch_staking_rewards_request'
|
39
|
+
Coinbase::Client.autoload :GetStakingContextRequest, 'coinbase/client/models/get_staking_context_request'
|
40
|
+
Coinbase::Client.autoload :PartialEthStakingContext, 'coinbase/client/models/partial_eth_staking_context'
|
37
41
|
Coinbase::Client.autoload :SeedCreationEvent, 'coinbase/client/models/seed_creation_event'
|
38
42
|
Coinbase::Client.autoload :SeedCreationEventResult, 'coinbase/client/models/seed_creation_event_result'
|
39
43
|
Coinbase::Client.autoload :ServerSigner, 'coinbase/client/models/server_signer'
|
@@ -43,7 +47,11 @@ Coinbase::Client.autoload :ServerSignerEventList, 'coinbase/client/models/server
|
|
43
47
|
Coinbase::Client.autoload :ServerSignerList, 'coinbase/client/models/server_signer_list'
|
44
48
|
Coinbase::Client.autoload :SignatureCreationEvent, 'coinbase/client/models/signature_creation_event'
|
45
49
|
Coinbase::Client.autoload :SignatureCreationEventResult, 'coinbase/client/models/signature_creation_event_result'
|
50
|
+
Coinbase::Client.autoload :StakingContext, 'coinbase/client/models/staking_context'
|
51
|
+
Coinbase::Client.autoload :StakingContextContext, 'coinbase/client/models/staking_context_context'
|
46
52
|
Coinbase::Client.autoload :StakingOperation, 'coinbase/client/models/staking_operation'
|
53
|
+
Coinbase::Client.autoload :StakingReward, 'coinbase/client/models/staking_reward'
|
54
|
+
Coinbase::Client.autoload :StakingRewardFormat, 'coinbase/client/models/staking_reward_format'
|
47
55
|
Coinbase::Client.autoload :Trade, 'coinbase/client/models/trade'
|
48
56
|
Coinbase::Client.autoload :TradeList, 'coinbase/client/models/trade_list'
|
49
57
|
Coinbase::Client.autoload :Transaction, 'coinbase/client/models/transaction'
|
@@ -56,6 +64,8 @@ Coinbase::Client.autoload :WalletList, 'coinbase/client/models/wallet_list'
|
|
56
64
|
|
57
65
|
# APIs
|
58
66
|
Coinbase::Client.autoload :AddressesApi, 'coinbase/client/api/addresses_api'
|
67
|
+
Coinbase::Client.autoload :AssetsApi, 'coinbase/client/api/assets_api'
|
68
|
+
Coinbase::Client.autoload :ExternalAddressesApi, 'coinbase/client/api/external_addresses_api'
|
59
69
|
Coinbase::Client.autoload :ServerSignersApi, 'coinbase/client/api/server_signers_api'
|
60
70
|
Coinbase::Client.autoload :StakeApi, 'coinbase/client/api/stake_api'
|
61
71
|
Coinbase::Client.autoload :TradesApi, 'coinbase/client/api/trades_api'
|
data/lib/coinbase/constants.rb
CHANGED
@@ -4,41 +4,16 @@ require_relative 'asset'
|
|
4
4
|
require_relative 'network'
|
5
5
|
|
6
6
|
module Coinbase
|
7
|
-
# The Assets supported on Base Sepolia by the Coinbase SDK.
|
8
|
-
ETH = Asset.new(network_id: :base_sepolia, asset_id: :eth, display_name: 'Ether')
|
9
|
-
USDC = Asset.new(network_id: :base_sepolia, asset_id: :usdc, display_name: 'USD Coin',
|
10
|
-
address_id: '0x036CbD53842c5426634e7929541eC2318f3dCF7e')
|
11
|
-
WETH = Asset.new(network_id: :base_sepolia, asset_id: :weth, display_name: 'Wrapped Ether',
|
12
|
-
address_id: '0x4200000000000000000000000000000000000006')
|
13
7
|
# The Base Sepolia Network.
|
14
8
|
BASE_SEPOLIA = Network.new(
|
15
9
|
network_id: :base_sepolia,
|
16
10
|
display_name: 'Base Sepolia',
|
17
11
|
protocol_family: :evm,
|
18
12
|
is_testnet: true,
|
19
|
-
assets: [ETH, USDC],
|
20
13
|
native_asset_id: :eth,
|
21
14
|
chain_id: 84_532
|
22
15
|
)
|
23
16
|
|
24
|
-
# The
|
25
|
-
|
26
|
-
|
27
|
-
# The amount of Wei per Gwei.
|
28
|
-
WEI_PER_GWEI = 1_000_000_000
|
29
|
-
|
30
|
-
# The amount of Gwei per Ether.
|
31
|
-
GWEI_PER_ETHER = 1_000_000_000
|
32
|
-
|
33
|
-
# The amount of atomic units of USDC per USDC.
|
34
|
-
ATOMIC_UNITS_PER_USDC = 1_000_000
|
35
|
-
|
36
|
-
# A map of supported Asset IDs.
|
37
|
-
SUPPORTED_ASSET_IDS = {
|
38
|
-
eth: true, # Ether, the native asset of most EVM networks.
|
39
|
-
gwei: true, # A medium denomination of Ether, typically used in gas prices.
|
40
|
-
wei: true, # The smallest denomination of Ether.
|
41
|
-
usdc: true, # USD Coin, a stablecoin pegged to the US Dollar.
|
42
|
-
weth: true # Wrapped Ether, the ERC-20 compatible version of Ether.
|
43
|
-
}.freeze
|
17
|
+
# The number of decimal places in Gwei.
|
18
|
+
GWEI_DECIMALS = 9
|
44
19
|
end
|