coinbase-sdk 0.0.14 → 0.1.0
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/wallet_address.rb +31 -21
- data/lib/coinbase/address.rb +51 -17
- data/lib/coinbase/asset.rb +11 -8
- data/lib/coinbase/client/api/contract_events_api.rb +17 -9
- data/lib/coinbase/client/api/external_addresses_api.rb +85 -0
- data/lib/coinbase/client/api/networks_api.rb +85 -0
- data/lib/coinbase/client/api/stake_api.rb +74 -195
- data/lib/coinbase/client/api/validators_api.rb +2 -2
- data/lib/coinbase/client/api/wallet_stake_api.rb +263 -0
- data/lib/coinbase/client/models/address.rb +21 -4
- data/lib/coinbase/client/models/{native_eth_staking_context.rb → address_historical_balance_list.rb} +39 -35
- data/lib/coinbase/client/models/contract_event.rb +99 -8
- data/lib/coinbase/client/models/create_address_request.rb +14 -4
- data/lib/coinbase/client/models/create_transfer_request.rb +14 -4
- data/lib/coinbase/client/models/ethereum_validator_metadata.rb +11 -11
- data/lib/coinbase/client/models/feature.rb +2 -1
- data/lib/coinbase/client/models/feature_set.rb +307 -0
- data/lib/coinbase/client/models/{partial_eth_staking_context.rb → fetch_historical_staking_balances200_response.rb} +39 -35
- data/lib/coinbase/client/models/historical_balance.rb +273 -0
- data/lib/coinbase/client/models/network.rb +365 -0
- data/lib/coinbase/client/models/network_identifier.rb +44 -0
- data/lib/coinbase/client/models/sponsored_send.rb +338 -0
- data/lib/coinbase/client/models/staking_balance.rb +289 -0
- data/lib/coinbase/client/models/staking_context_context.rb +222 -74
- data/lib/coinbase/client/models/staking_operation.rb +2 -2
- data/lib/coinbase/client/models/staking_reward.rb +22 -6
- data/lib/coinbase/client/models/staking_reward_format.rb +2 -1
- data/lib/coinbase/client/models/staking_reward_usd_value.rb +257 -0
- data/lib/coinbase/client/models/transaction.rb +17 -7
- data/lib/coinbase/client/models/transaction_type.rb +2 -1
- data/lib/coinbase/client/models/transfer.rb +101 -8
- data/lib/coinbase/client/models/validator.rb +23 -2
- data/lib/coinbase/client/models/validator_status.rb +52 -0
- data/lib/coinbase/client/models/wallet.rb +13 -16
- data/lib/coinbase/client/models/webhook_event_type.rb +2 -1
- data/lib/coinbase/client.rb +12 -3
- data/lib/coinbase/constants.rb +0 -10
- data/lib/coinbase/contract_event.rb +104 -0
- data/lib/coinbase/correlation.rb +30 -0
- data/lib/coinbase/destination.rb +11 -9
- data/lib/coinbase/errors.rb +14 -0
- data/lib/coinbase/historical_balance.rb +53 -0
- data/lib/coinbase/middleware.rb +2 -0
- data/lib/coinbase/network.rb +103 -20
- data/lib/coinbase/server_signer.rb +14 -3
- data/lib/coinbase/smart_contract.rb +106 -0
- data/lib/coinbase/sponsored_send.rb +110 -0
- data/lib/coinbase/staking_balance.rb +92 -0
- data/lib/coinbase/staking_operation.rb +134 -36
- data/lib/coinbase/staking_reward.rb +18 -0
- data/lib/coinbase/trade.rb +10 -9
- data/lib/coinbase/transaction.rb +13 -3
- data/lib/coinbase/transfer.rb +65 -36
- data/lib/coinbase/validator.rb +18 -10
- data/lib/coinbase/version.rb +5 -0
- data/lib/coinbase/wallet/data.rb +31 -0
- data/lib/coinbase/wallet.rb +143 -182
- data/lib/coinbase/webhook.rb +181 -0
- data/lib/coinbase.rb +64 -21
- metadata +51 -5
- data/lib/coinbase/user.rb +0 -65
@@ -0,0 +1,307 @@
|
|
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.7.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
class FeatureSet
|
18
|
+
# Whether the network supports a faucet
|
19
|
+
attr_accessor :faucet
|
20
|
+
|
21
|
+
# Whether the network supports Server-Signers
|
22
|
+
attr_accessor :server_signer
|
23
|
+
|
24
|
+
# Whether the network supports transfers
|
25
|
+
attr_accessor :transfer
|
26
|
+
|
27
|
+
# Whether the network supports trading
|
28
|
+
attr_accessor :trade
|
29
|
+
|
30
|
+
# Whether the network supports staking
|
31
|
+
attr_accessor :stake
|
32
|
+
|
33
|
+
# Whether the network supports gasless sends
|
34
|
+
attr_accessor :gasless_send
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:'faucet' => :'faucet',
|
40
|
+
:'server_signer' => :'server_signer',
|
41
|
+
:'transfer' => :'transfer',
|
42
|
+
:'trade' => :'trade',
|
43
|
+
:'stake' => :'stake',
|
44
|
+
:'gasless_send' => :'gasless_send'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns all the JSON keys this model knows about
|
49
|
+
def self.acceptable_attributes
|
50
|
+
attribute_map.values
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.openapi_types
|
55
|
+
{
|
56
|
+
:'faucet' => :'Boolean',
|
57
|
+
:'server_signer' => :'Boolean',
|
58
|
+
:'transfer' => :'Boolean',
|
59
|
+
:'trade' => :'Boolean',
|
60
|
+
:'stake' => :'Boolean',
|
61
|
+
:'gasless_send' => :'Boolean'
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# List of attributes with nullable: true
|
66
|
+
def self.openapi_nullable
|
67
|
+
Set.new([
|
68
|
+
])
|
69
|
+
end
|
70
|
+
|
71
|
+
# Initializes the object
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
+
def initialize(attributes = {})
|
74
|
+
if (!attributes.is_a?(Hash))
|
75
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::FeatureSet` initialize method"
|
76
|
+
end
|
77
|
+
|
78
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
80
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
81
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::FeatureSet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
82
|
+
end
|
83
|
+
h[k.to_sym] = v
|
84
|
+
}
|
85
|
+
|
86
|
+
if attributes.key?(:'faucet')
|
87
|
+
self.faucet = attributes[:'faucet']
|
88
|
+
else
|
89
|
+
self.faucet = nil
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.key?(:'server_signer')
|
93
|
+
self.server_signer = attributes[:'server_signer']
|
94
|
+
else
|
95
|
+
self.server_signer = nil
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.key?(:'transfer')
|
99
|
+
self.transfer = attributes[:'transfer']
|
100
|
+
else
|
101
|
+
self.transfer = nil
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'trade')
|
105
|
+
self.trade = attributes[:'trade']
|
106
|
+
else
|
107
|
+
self.trade = nil
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'stake')
|
111
|
+
self.stake = attributes[:'stake']
|
112
|
+
else
|
113
|
+
self.stake = nil
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'gasless_send')
|
117
|
+
self.gasless_send = attributes[:'gasless_send']
|
118
|
+
else
|
119
|
+
self.gasless_send = nil
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
124
|
+
# @return Array for valid properties with the reasons
|
125
|
+
def list_invalid_properties
|
126
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
127
|
+
invalid_properties = Array.new
|
128
|
+
if @faucet.nil?
|
129
|
+
invalid_properties.push('invalid value for "faucet", faucet cannot be nil.')
|
130
|
+
end
|
131
|
+
|
132
|
+
if @server_signer.nil?
|
133
|
+
invalid_properties.push('invalid value for "server_signer", server_signer cannot be nil.')
|
134
|
+
end
|
135
|
+
|
136
|
+
if @transfer.nil?
|
137
|
+
invalid_properties.push('invalid value for "transfer", transfer cannot be nil.')
|
138
|
+
end
|
139
|
+
|
140
|
+
if @trade.nil?
|
141
|
+
invalid_properties.push('invalid value for "trade", trade cannot be nil.')
|
142
|
+
end
|
143
|
+
|
144
|
+
if @stake.nil?
|
145
|
+
invalid_properties.push('invalid value for "stake", stake cannot be nil.')
|
146
|
+
end
|
147
|
+
|
148
|
+
if @gasless_send.nil?
|
149
|
+
invalid_properties.push('invalid value for "gasless_send", gasless_send cannot be nil.')
|
150
|
+
end
|
151
|
+
|
152
|
+
invalid_properties
|
153
|
+
end
|
154
|
+
|
155
|
+
# Check to see if the all the properties in the model are valid
|
156
|
+
# @return true if the model is valid
|
157
|
+
def valid?
|
158
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
159
|
+
return false if @faucet.nil?
|
160
|
+
return false if @server_signer.nil?
|
161
|
+
return false if @transfer.nil?
|
162
|
+
return false if @trade.nil?
|
163
|
+
return false if @stake.nil?
|
164
|
+
return false if @gasless_send.nil?
|
165
|
+
true
|
166
|
+
end
|
167
|
+
|
168
|
+
# Checks equality by comparing each attribute.
|
169
|
+
# @param [Object] Object to be compared
|
170
|
+
def ==(o)
|
171
|
+
return true if self.equal?(o)
|
172
|
+
self.class == o.class &&
|
173
|
+
faucet == o.faucet &&
|
174
|
+
server_signer == o.server_signer &&
|
175
|
+
transfer == o.transfer &&
|
176
|
+
trade == o.trade &&
|
177
|
+
stake == o.stake &&
|
178
|
+
gasless_send == o.gasless_send
|
179
|
+
end
|
180
|
+
|
181
|
+
# @see the `==` method
|
182
|
+
# @param [Object] Object to be compared
|
183
|
+
def eql?(o)
|
184
|
+
self == o
|
185
|
+
end
|
186
|
+
|
187
|
+
# Calculates hash code according to all attributes.
|
188
|
+
# @return [Integer] Hash code
|
189
|
+
def hash
|
190
|
+
[faucet, server_signer, transfer, trade, stake, gasless_send].hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Builds the object from hash
|
194
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
195
|
+
# @return [Object] Returns the model itself
|
196
|
+
def self.build_from_hash(attributes)
|
197
|
+
return nil unless attributes.is_a?(Hash)
|
198
|
+
attributes = attributes.transform_keys(&:to_sym)
|
199
|
+
transformed_hash = {}
|
200
|
+
openapi_types.each_pair do |key, type|
|
201
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
202
|
+
transformed_hash["#{key}"] = nil
|
203
|
+
elsif type =~ /\AArray<(.*)>/i
|
204
|
+
# check to ensure the input is an array given that the attribute
|
205
|
+
# is documented as an array but the input is not
|
206
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
207
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
208
|
+
end
|
209
|
+
elsif !attributes[attribute_map[key]].nil?
|
210
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
211
|
+
end
|
212
|
+
end
|
213
|
+
new(transformed_hash)
|
214
|
+
end
|
215
|
+
|
216
|
+
# Deserializes the data based on type
|
217
|
+
# @param string type Data type
|
218
|
+
# @param string value Value to be deserialized
|
219
|
+
# @return [Object] Deserialized data
|
220
|
+
def self._deserialize(type, value)
|
221
|
+
case type.to_sym
|
222
|
+
when :Time
|
223
|
+
Time.parse(value)
|
224
|
+
when :Date
|
225
|
+
Date.parse(value)
|
226
|
+
when :String
|
227
|
+
value.to_s
|
228
|
+
when :Integer
|
229
|
+
value.to_i
|
230
|
+
when :Float
|
231
|
+
value.to_f
|
232
|
+
when :Boolean
|
233
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
234
|
+
true
|
235
|
+
else
|
236
|
+
false
|
237
|
+
end
|
238
|
+
when :Object
|
239
|
+
# generic object (usually a Hash), return directly
|
240
|
+
value
|
241
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
242
|
+
inner_type = Regexp.last_match[:inner_type]
|
243
|
+
value.map { |v| _deserialize(inner_type, v) }
|
244
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
245
|
+
k_type = Regexp.last_match[:k_type]
|
246
|
+
v_type = Regexp.last_match[:v_type]
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each do |k, v|
|
249
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
else # model
|
253
|
+
# models (e.g. Pet) or oneOf
|
254
|
+
klass = Coinbase::Client.const_get(type)
|
255
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
# Returns the string representation of the object
|
260
|
+
# @return [String] String presentation of the object
|
261
|
+
def to_s
|
262
|
+
to_hash.to_s
|
263
|
+
end
|
264
|
+
|
265
|
+
# to_body is an alias to to_hash (backward compatibility)
|
266
|
+
# @return [Hash] Returns the object in the form of hash
|
267
|
+
def to_body
|
268
|
+
to_hash
|
269
|
+
end
|
270
|
+
|
271
|
+
# Returns the object in the form of hash
|
272
|
+
# @return [Hash] Returns the object in the form of hash
|
273
|
+
def to_hash
|
274
|
+
hash = {}
|
275
|
+
self.class.attribute_map.each_pair do |attr, param|
|
276
|
+
value = self.send(attr)
|
277
|
+
if value.nil?
|
278
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
279
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
280
|
+
end
|
281
|
+
|
282
|
+
hash[param] = _to_hash(value)
|
283
|
+
end
|
284
|
+
hash
|
285
|
+
end
|
286
|
+
|
287
|
+
# Outputs non-array value in the form of hash
|
288
|
+
# For object, use to_hash. Otherwise, just return the value
|
289
|
+
# @param [Object] value Any valid value
|
290
|
+
# @return [Hash] Returns the value in the form of hash
|
291
|
+
def _to_hash(value)
|
292
|
+
if value.is_a?(Array)
|
293
|
+
value.compact.map { |v| _to_hash(v) }
|
294
|
+
elsif value.is_a?(Hash)
|
295
|
+
{}.tap do |hash|
|
296
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
297
|
+
end
|
298
|
+
elsif value.respond_to? :to_hash
|
299
|
+
value.to_hash
|
300
|
+
else
|
301
|
+
value
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
end
|
306
|
+
|
307
|
+
end
|
@@ -14,20 +14,22 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Coinbase::Client
|
17
|
-
#
|
18
|
-
class
|
19
|
-
attr_accessor :
|
17
|
+
#
|
18
|
+
class FetchHistoricalStakingBalances200Response
|
19
|
+
attr_accessor :data
|
20
20
|
|
21
|
-
|
21
|
+
# True if this list has another page of items after this one that can be fetched.
|
22
|
+
attr_accessor :has_more
|
22
23
|
|
23
|
-
|
24
|
+
# The page token to be used to fetch the next page.
|
25
|
+
attr_accessor :next_page
|
24
26
|
|
25
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
28
|
def self.attribute_map
|
27
29
|
{
|
28
|
-
:'
|
29
|
-
:'
|
30
|
-
:'
|
30
|
+
:'data' => :'data',
|
31
|
+
:'has_more' => :'has_more',
|
32
|
+
:'next_page' => :'next_page'
|
31
33
|
}
|
32
34
|
end
|
33
35
|
|
@@ -39,9 +41,9 @@ module Coinbase::Client
|
|
39
41
|
# Attribute type mapping.
|
40
42
|
def self.openapi_types
|
41
43
|
{
|
42
|
-
:'
|
43
|
-
:'
|
44
|
-
:'
|
44
|
+
:'data' => :'Array<StakingBalance>',
|
45
|
+
:'has_more' => :'Boolean',
|
46
|
+
:'next_page' => :'String'
|
45
47
|
}
|
46
48
|
end
|
47
49
|
|
@@ -55,33 +57,35 @@ module Coinbase::Client
|
|
55
57
|
# @param [Hash] attributes Model attributes in the form of hash
|
56
58
|
def initialize(attributes = {})
|
57
59
|
if (!attributes.is_a?(Hash))
|
58
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::FetchHistoricalStakingBalances200Response` initialize method"
|
59
61
|
end
|
60
62
|
|
61
63
|
# check to see if the attribute exists and convert string to symbol for hash key
|
62
64
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
63
65
|
if (!self.class.attribute_map.key?(k.to_sym))
|
64
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::
|
66
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::FetchHistoricalStakingBalances200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
67
|
end
|
66
68
|
h[k.to_sym] = v
|
67
69
|
}
|
68
70
|
|
69
|
-
if attributes.key?(:'
|
70
|
-
|
71
|
+
if attributes.key?(:'data')
|
72
|
+
if (value = attributes[:'data']).is_a?(Array)
|
73
|
+
self.data = value
|
74
|
+
end
|
71
75
|
else
|
72
|
-
self.
|
76
|
+
self.data = nil
|
73
77
|
end
|
74
78
|
|
75
|
-
if attributes.key?(:'
|
76
|
-
self.
|
79
|
+
if attributes.key?(:'has_more')
|
80
|
+
self.has_more = attributes[:'has_more']
|
77
81
|
else
|
78
|
-
self.
|
82
|
+
self.has_more = nil
|
79
83
|
end
|
80
84
|
|
81
|
-
if attributes.key?(:'
|
82
|
-
self.
|
85
|
+
if attributes.key?(:'next_page')
|
86
|
+
self.next_page = attributes[:'next_page']
|
83
87
|
else
|
84
|
-
self.
|
88
|
+
self.next_page = nil
|
85
89
|
end
|
86
90
|
end
|
87
91
|
|
@@ -90,16 +94,16 @@ module Coinbase::Client
|
|
90
94
|
def list_invalid_properties
|
91
95
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
92
96
|
invalid_properties = Array.new
|
93
|
-
if @
|
94
|
-
invalid_properties.push('invalid value for "
|
97
|
+
if @data.nil?
|
98
|
+
invalid_properties.push('invalid value for "data", data cannot be nil.')
|
95
99
|
end
|
96
100
|
|
97
|
-
if @
|
98
|
-
invalid_properties.push('invalid value for "
|
101
|
+
if @has_more.nil?
|
102
|
+
invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
|
99
103
|
end
|
100
104
|
|
101
|
-
if @
|
102
|
-
invalid_properties.push('invalid value for "
|
105
|
+
if @next_page.nil?
|
106
|
+
invalid_properties.push('invalid value for "next_page", next_page cannot be nil.')
|
103
107
|
end
|
104
108
|
|
105
109
|
invalid_properties
|
@@ -109,9 +113,9 @@ module Coinbase::Client
|
|
109
113
|
# @return true if the model is valid
|
110
114
|
def valid?
|
111
115
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
112
|
-
return false if @
|
113
|
-
return false if @
|
114
|
-
return false if @
|
116
|
+
return false if @data.nil?
|
117
|
+
return false if @has_more.nil?
|
118
|
+
return false if @next_page.nil?
|
115
119
|
true
|
116
120
|
end
|
117
121
|
|
@@ -120,9 +124,9 @@ module Coinbase::Client
|
|
120
124
|
def ==(o)
|
121
125
|
return true if self.equal?(o)
|
122
126
|
self.class == o.class &&
|
123
|
-
|
124
|
-
|
125
|
-
|
127
|
+
data == o.data &&
|
128
|
+
has_more == o.has_more &&
|
129
|
+
next_page == o.next_page
|
126
130
|
end
|
127
131
|
|
128
132
|
# @see the `==` method
|
@@ -134,7 +138,7 @@ module Coinbase::Client
|
|
134
138
|
# Calculates hash code according to all attributes.
|
135
139
|
# @return [Integer] Hash code
|
136
140
|
def hash
|
137
|
-
[
|
141
|
+
[data, has_more, next_page].hash
|
138
142
|
end
|
139
143
|
|
140
144
|
# Builds the object from hash
|