coinbase-sdk 0.0.14 → 0.1.0
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/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
@@ -19,92 +19,6 @@ module Coinbase::Client
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# Broadcast a staking operation
|
23
|
-
# Broadcast a staking operation.
|
24
|
-
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
25
|
-
# @param address_id [String] The ID of the address the staking operation belongs to.
|
26
|
-
# @param staking_operation_id [String] The ID of the staking operation to broadcast.
|
27
|
-
# @param broadcast_staking_operation_request [BroadcastStakingOperationRequest]
|
28
|
-
# @param [Hash] opts the optional parameters
|
29
|
-
# @return [StakingOperation]
|
30
|
-
def broadcast_staking_operation(wallet_id, address_id, staking_operation_id, broadcast_staking_operation_request, opts = {})
|
31
|
-
data, _status_code, _headers = broadcast_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, broadcast_staking_operation_request, opts)
|
32
|
-
data
|
33
|
-
end
|
34
|
-
|
35
|
-
# Broadcast a staking operation
|
36
|
-
# Broadcast a staking operation.
|
37
|
-
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
38
|
-
# @param address_id [String] The ID of the address the staking operation belongs to.
|
39
|
-
# @param staking_operation_id [String] The ID of the staking operation to broadcast.
|
40
|
-
# @param broadcast_staking_operation_request [BroadcastStakingOperationRequest]
|
41
|
-
# @param [Hash] opts the optional parameters
|
42
|
-
# @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers
|
43
|
-
def broadcast_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, broadcast_staking_operation_request, opts = {})
|
44
|
-
if @api_client.config.debugging
|
45
|
-
@api_client.config.logger.debug 'Calling API: StakeApi.broadcast_staking_operation ...'
|
46
|
-
end
|
47
|
-
# verify the required parameter 'wallet_id' is set
|
48
|
-
if @api_client.config.client_side_validation && wallet_id.nil?
|
49
|
-
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling StakeApi.broadcast_staking_operation"
|
50
|
-
end
|
51
|
-
# verify the required parameter 'address_id' is set
|
52
|
-
if @api_client.config.client_side_validation && address_id.nil?
|
53
|
-
fail ArgumentError, "Missing the required parameter 'address_id' when calling StakeApi.broadcast_staking_operation"
|
54
|
-
end
|
55
|
-
# verify the required parameter 'staking_operation_id' is set
|
56
|
-
if @api_client.config.client_side_validation && staking_operation_id.nil?
|
57
|
-
fail ArgumentError, "Missing the required parameter 'staking_operation_id' when calling StakeApi.broadcast_staking_operation"
|
58
|
-
end
|
59
|
-
# verify the required parameter 'broadcast_staking_operation_request' is set
|
60
|
-
if @api_client.config.client_side_validation && broadcast_staking_operation_request.nil?
|
61
|
-
fail ArgumentError, "Missing the required parameter 'broadcast_staking_operation_request' when calling StakeApi.broadcast_staking_operation"
|
62
|
-
end
|
63
|
-
# resource path
|
64
|
-
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id}/broadcast'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'staking_operation_id' + '}', CGI.escape(staking_operation_id.to_s))
|
65
|
-
|
66
|
-
# query parameters
|
67
|
-
query_params = opts[:query_params] || {}
|
68
|
-
|
69
|
-
# header parameters
|
70
|
-
header_params = opts[:header_params] || {}
|
71
|
-
# HTTP header 'Accept' (if needed)
|
72
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
73
|
-
# HTTP header 'Content-Type'
|
74
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
75
|
-
if !content_type.nil?
|
76
|
-
header_params['Content-Type'] = content_type
|
77
|
-
end
|
78
|
-
|
79
|
-
# form parameters
|
80
|
-
form_params = opts[:form_params] || {}
|
81
|
-
|
82
|
-
# http body (model)
|
83
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(broadcast_staking_operation_request)
|
84
|
-
|
85
|
-
# return_type
|
86
|
-
return_type = opts[:debug_return_type] || 'StakingOperation'
|
87
|
-
|
88
|
-
# auth_names
|
89
|
-
auth_names = opts[:debug_auth_names] || []
|
90
|
-
|
91
|
-
new_options = opts.merge(
|
92
|
-
:operation => :"StakeApi.broadcast_staking_operation",
|
93
|
-
:header_params => header_params,
|
94
|
-
:query_params => query_params,
|
95
|
-
:form_params => form_params,
|
96
|
-
:body => post_body,
|
97
|
-
:auth_names => auth_names,
|
98
|
-
:return_type => return_type
|
99
|
-
)
|
100
|
-
|
101
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
102
|
-
if @api_client.config.debugging
|
103
|
-
@api_client.config.logger.debug "API called: StakeApi#broadcast_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
104
|
-
end
|
105
|
-
return data, status_code, headers
|
106
|
-
end
|
107
|
-
|
108
22
|
# Build a new staking operation
|
109
23
|
# Build a new staking operation
|
110
24
|
# @param build_staking_operation_request [BuildStakingOperationRequest]
|
@@ -173,71 +87,111 @@ module Coinbase::Client
|
|
173
87
|
return data, status_code, headers
|
174
88
|
end
|
175
89
|
|
176
|
-
#
|
177
|
-
#
|
178
|
-
# @param
|
179
|
-
# @param
|
180
|
-
# @param
|
90
|
+
# Fetch historical staking balances
|
91
|
+
# Fetch historical staking balances for given address.
|
92
|
+
# @param network_id [String] The ID of the blockchain network.
|
93
|
+
# @param asset_id [String] The ID of the asset for which the historical staking balances are being fetched.
|
94
|
+
# @param address_id [String] The onchain address for which the historical staking balances are being fetched.
|
95
|
+
# @param start_time [Time] The start time of this historical staking balance period.
|
96
|
+
# @param end_time [Time] The end time of this historical staking balance period.
|
181
97
|
# @param [Hash] opts the optional parameters
|
182
|
-
# @
|
183
|
-
|
184
|
-
|
98
|
+
# @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50.
|
99
|
+
# @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
100
|
+
# @return [FetchHistoricalStakingBalances200Response]
|
101
|
+
def fetch_historical_staking_balances(network_id, asset_id, address_id, start_time, end_time, opts = {})
|
102
|
+
data, _status_code, _headers = fetch_historical_staking_balances_with_http_info(network_id, asset_id, address_id, start_time, end_time, opts)
|
185
103
|
data
|
186
104
|
end
|
187
105
|
|
188
|
-
#
|
189
|
-
#
|
190
|
-
# @param
|
191
|
-
# @param
|
192
|
-
# @param
|
106
|
+
# Fetch historical staking balances
|
107
|
+
# Fetch historical staking balances for given address.
|
108
|
+
# @param network_id [String] The ID of the blockchain network.
|
109
|
+
# @param asset_id [String] The ID of the asset for which the historical staking balances are being fetched.
|
110
|
+
# @param address_id [String] The onchain address for which the historical staking balances are being fetched.
|
111
|
+
# @param start_time [Time] The start time of this historical staking balance period.
|
112
|
+
# @param end_time [Time] The end time of this historical staking balance period.
|
193
113
|
# @param [Hash] opts the optional parameters
|
194
|
-
# @
|
195
|
-
|
114
|
+
# @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50.
|
115
|
+
# @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
116
|
+
# @return [Array<(FetchHistoricalStakingBalances200Response, Integer, Hash)>] FetchHistoricalStakingBalances200Response data, response status code and response headers
|
117
|
+
def fetch_historical_staking_balances_with_http_info(network_id, asset_id, address_id, start_time, end_time, opts = {})
|
196
118
|
if @api_client.config.debugging
|
197
|
-
@api_client.config.logger.debug 'Calling API: StakeApi.
|
119
|
+
@api_client.config.logger.debug 'Calling API: StakeApi.fetch_historical_staking_balances ...'
|
120
|
+
end
|
121
|
+
# verify the required parameter 'network_id' is set
|
122
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
123
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling StakeApi.fetch_historical_staking_balances"
|
124
|
+
end
|
125
|
+
if @api_client.config.client_side_validation && network_id.to_s.length > 5000
|
126
|
+
fail ArgumentError, 'invalid value for "network_id" when calling StakeApi.fetch_historical_staking_balances, the character length must be smaller than or equal to 5000.'
|
127
|
+
end
|
128
|
+
|
129
|
+
# verify the required parameter 'asset_id' is set
|
130
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
131
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling StakeApi.fetch_historical_staking_balances"
|
198
132
|
end
|
199
|
-
|
200
|
-
|
201
|
-
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling StakeApi.create_staking_operation"
|
133
|
+
if @api_client.config.client_side_validation && asset_id.to_s.length > 5000
|
134
|
+
fail ArgumentError, 'invalid value for "asset_id" when calling StakeApi.fetch_historical_staking_balances, the character length must be smaller than or equal to 5000.'
|
202
135
|
end
|
136
|
+
|
203
137
|
# verify the required parameter 'address_id' is set
|
204
138
|
if @api_client.config.client_side_validation && address_id.nil?
|
205
|
-
fail ArgumentError, "Missing the required parameter 'address_id' when calling StakeApi.
|
139
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling StakeApi.fetch_historical_staking_balances"
|
140
|
+
end
|
141
|
+
if @api_client.config.client_side_validation && address_id.to_s.length > 5000
|
142
|
+
fail ArgumentError, 'invalid value for "address_id" when calling StakeApi.fetch_historical_staking_balances, the character length must be smaller than or equal to 5000.'
|
143
|
+
end
|
144
|
+
|
145
|
+
# verify the required parameter 'start_time' is set
|
146
|
+
if @api_client.config.client_side_validation && start_time.nil?
|
147
|
+
fail ArgumentError, "Missing the required parameter 'start_time' when calling StakeApi.fetch_historical_staking_balances"
|
206
148
|
end
|
207
|
-
|
208
|
-
|
209
|
-
fail ArgumentError, "Missing the required parameter 'create_staking_operation_request' when calling StakeApi.create_staking_operation"
|
149
|
+
if @api_client.config.client_side_validation && start_time.to_s.length > 5000
|
150
|
+
fail ArgumentError, 'invalid value for "start_time" when calling StakeApi.fetch_historical_staking_balances, the character length must be smaller than or equal to 5000.'
|
210
151
|
end
|
152
|
+
|
153
|
+
# verify the required parameter 'end_time' is set
|
154
|
+
if @api_client.config.client_side_validation && end_time.nil?
|
155
|
+
fail ArgumentError, "Missing the required parameter 'end_time' when calling StakeApi.fetch_historical_staking_balances"
|
156
|
+
end
|
157
|
+
if @api_client.config.client_side_validation && end_time.to_s.length > 5000
|
158
|
+
fail ArgumentError, 'invalid value for "end_time" when calling StakeApi.fetch_historical_staking_balances, the character length must be smaller than or equal to 5000.'
|
159
|
+
end
|
160
|
+
|
161
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
162
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling StakeApi.fetch_historical_staking_balances, the character length must be smaller than or equal to 5000.'
|
163
|
+
end
|
164
|
+
|
211
165
|
# resource path
|
212
|
-
local_var_path = '/v1/
|
166
|
+
local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/stake/balances'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
|
213
167
|
|
214
168
|
# query parameters
|
215
169
|
query_params = opts[:query_params] || {}
|
170
|
+
query_params[:'asset_id'] = asset_id
|
171
|
+
query_params[:'start_time'] = start_time
|
172
|
+
query_params[:'end_time'] = end_time
|
173
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
174
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
216
175
|
|
217
176
|
# header parameters
|
218
177
|
header_params = opts[:header_params] || {}
|
219
178
|
# HTTP header 'Accept' (if needed)
|
220
179
|
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
221
|
-
# HTTP header 'Content-Type'
|
222
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
223
|
-
if !content_type.nil?
|
224
|
-
header_params['Content-Type'] = content_type
|
225
|
-
end
|
226
180
|
|
227
181
|
# form parameters
|
228
182
|
form_params = opts[:form_params] || {}
|
229
183
|
|
230
184
|
# http body (model)
|
231
|
-
post_body = opts[:debug_body]
|
185
|
+
post_body = opts[:debug_body]
|
232
186
|
|
233
187
|
# return_type
|
234
|
-
return_type = opts[:debug_return_type] || '
|
188
|
+
return_type = opts[:debug_return_type] || 'FetchHistoricalStakingBalances200Response'
|
235
189
|
|
236
190
|
# auth_names
|
237
191
|
auth_names = opts[:debug_auth_names] || []
|
238
192
|
|
239
193
|
new_options = opts.merge(
|
240
|
-
:operation => :"StakeApi.
|
194
|
+
:operation => :"StakeApi.fetch_historical_staking_balances",
|
241
195
|
:header_params => header_params,
|
242
196
|
:query_params => query_params,
|
243
197
|
:form_params => form_params,
|
@@ -246,9 +200,9 @@ module Coinbase::Client
|
|
246
200
|
:return_type => return_type
|
247
201
|
)
|
248
202
|
|
249
|
-
data, status_code, headers = @api_client.call_api(:
|
203
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
250
204
|
if @api_client.config.debugging
|
251
|
-
@api_client.config.logger.debug "API called: StakeApi#
|
205
|
+
@api_client.config.logger.debug "API called: StakeApi#fetch_historical_staking_balances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
252
206
|
end
|
253
207
|
return data, status_code, headers
|
254
208
|
end
|
@@ -473,80 +427,5 @@ module Coinbase::Client
|
|
473
427
|
end
|
474
428
|
return data, status_code, headers
|
475
429
|
end
|
476
|
-
|
477
|
-
# Get the latest state of a staking operation
|
478
|
-
# Get the latest state of a staking operation.
|
479
|
-
# @param wallet_id [String] The ID of the wallet the address belongs to
|
480
|
-
# @param address_id [String] The ID of the address to fetch the staking operation for.
|
481
|
-
# @param staking_operation_id [String] The ID of the staking operation.
|
482
|
-
# @param [Hash] opts the optional parameters
|
483
|
-
# @return [StakingOperation]
|
484
|
-
def get_staking_operation(wallet_id, address_id, staking_operation_id, opts = {})
|
485
|
-
data, _status_code, _headers = get_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, opts)
|
486
|
-
data
|
487
|
-
end
|
488
|
-
|
489
|
-
# Get the latest state of a staking operation
|
490
|
-
# Get the latest state of a staking operation.
|
491
|
-
# @param wallet_id [String] The ID of the wallet the address belongs to
|
492
|
-
# @param address_id [String] The ID of the address to fetch the staking operation for.
|
493
|
-
# @param staking_operation_id [String] The ID of the staking operation.
|
494
|
-
# @param [Hash] opts the optional parameters
|
495
|
-
# @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers
|
496
|
-
def get_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, opts = {})
|
497
|
-
if @api_client.config.debugging
|
498
|
-
@api_client.config.logger.debug 'Calling API: StakeApi.get_staking_operation ...'
|
499
|
-
end
|
500
|
-
# verify the required parameter 'wallet_id' is set
|
501
|
-
if @api_client.config.client_side_validation && wallet_id.nil?
|
502
|
-
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling StakeApi.get_staking_operation"
|
503
|
-
end
|
504
|
-
# verify the required parameter 'address_id' is set
|
505
|
-
if @api_client.config.client_side_validation && address_id.nil?
|
506
|
-
fail ArgumentError, "Missing the required parameter 'address_id' when calling StakeApi.get_staking_operation"
|
507
|
-
end
|
508
|
-
# verify the required parameter 'staking_operation_id' is set
|
509
|
-
if @api_client.config.client_side_validation && staking_operation_id.nil?
|
510
|
-
fail ArgumentError, "Missing the required parameter 'staking_operation_id' when calling StakeApi.get_staking_operation"
|
511
|
-
end
|
512
|
-
# resource path
|
513
|
-
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'staking_operation_id' + '}', CGI.escape(staking_operation_id.to_s))
|
514
|
-
|
515
|
-
# query parameters
|
516
|
-
query_params = opts[:query_params] || {}
|
517
|
-
|
518
|
-
# header parameters
|
519
|
-
header_params = opts[:header_params] || {}
|
520
|
-
# HTTP header 'Accept' (if needed)
|
521
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
522
|
-
|
523
|
-
# form parameters
|
524
|
-
form_params = opts[:form_params] || {}
|
525
|
-
|
526
|
-
# http body (model)
|
527
|
-
post_body = opts[:debug_body]
|
528
|
-
|
529
|
-
# return_type
|
530
|
-
return_type = opts[:debug_return_type] || 'StakingOperation'
|
531
|
-
|
532
|
-
# auth_names
|
533
|
-
auth_names = opts[:debug_auth_names] || []
|
534
|
-
|
535
|
-
new_options = opts.merge(
|
536
|
-
:operation => :"StakeApi.get_staking_operation",
|
537
|
-
:header_params => header_params,
|
538
|
-
:query_params => query_params,
|
539
|
-
:form_params => form_params,
|
540
|
-
:body => post_body,
|
541
|
-
:auth_names => auth_names,
|
542
|
-
:return_type => return_type
|
543
|
-
)
|
544
|
-
|
545
|
-
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
546
|
-
if @api_client.config.debugging
|
547
|
-
@api_client.config.logger.debug "API called: StakeApi#get_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
548
|
-
end
|
549
|
-
return data, status_code, headers
|
550
|
-
end
|
551
430
|
end
|
552
431
|
end
|
@@ -99,7 +99,7 @@ module Coinbase::Client
|
|
99
99
|
# @param network_id [String] The ID of the blockchain network.
|
100
100
|
# @param asset_id [String] The symbol of the asset to get the validators for.
|
101
101
|
# @param [Hash] opts the optional parameters
|
102
|
-
# @option opts [
|
102
|
+
# @option opts [ValidatorStatus] :status A filter to list validators based on a status.
|
103
103
|
# @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50.
|
104
104
|
# @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
105
105
|
# @return [ValidatorList]
|
@@ -113,7 +113,7 @@ module Coinbase::Client
|
|
113
113
|
# @param network_id [String] The ID of the blockchain network.
|
114
114
|
# @param asset_id [String] The symbol of the asset to get the validators for.
|
115
115
|
# @param [Hash] opts the optional parameters
|
116
|
-
# @option opts [
|
116
|
+
# @option opts [ValidatorStatus] :status A filter to list validators based on a status.
|
117
117
|
# @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50.
|
118
118
|
# @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
119
119
|
# @return [Array<(ValidatorList, Integer, Hash)>] ValidatorList data, response status code and response headers
|
@@ -0,0 +1,263 @@
|
|
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 'cgi'
|
14
|
+
|
15
|
+
module Coinbase::Client
|
16
|
+
class WalletStakeApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Broadcast a staking operation
|
23
|
+
# Broadcast a staking operation.
|
24
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
25
|
+
# @param address_id [String] The ID of the address the staking operation belongs to.
|
26
|
+
# @param staking_operation_id [String] The ID of the staking operation to broadcast.
|
27
|
+
# @param broadcast_staking_operation_request [BroadcastStakingOperationRequest]
|
28
|
+
# @param [Hash] opts the optional parameters
|
29
|
+
# @return [StakingOperation]
|
30
|
+
def broadcast_staking_operation(wallet_id, address_id, staking_operation_id, broadcast_staking_operation_request, opts = {})
|
31
|
+
data, _status_code, _headers = broadcast_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, broadcast_staking_operation_request, opts)
|
32
|
+
data
|
33
|
+
end
|
34
|
+
|
35
|
+
# Broadcast a staking operation
|
36
|
+
# Broadcast a staking operation.
|
37
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
38
|
+
# @param address_id [String] The ID of the address the staking operation belongs to.
|
39
|
+
# @param staking_operation_id [String] The ID of the staking operation to broadcast.
|
40
|
+
# @param broadcast_staking_operation_request [BroadcastStakingOperationRequest]
|
41
|
+
# @param [Hash] opts the optional parameters
|
42
|
+
# @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers
|
43
|
+
def broadcast_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, broadcast_staking_operation_request, opts = {})
|
44
|
+
if @api_client.config.debugging
|
45
|
+
@api_client.config.logger.debug 'Calling API: WalletStakeApi.broadcast_staking_operation ...'
|
46
|
+
end
|
47
|
+
# verify the required parameter 'wallet_id' is set
|
48
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
49
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletStakeApi.broadcast_staking_operation"
|
50
|
+
end
|
51
|
+
# verify the required parameter 'address_id' is set
|
52
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
53
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling WalletStakeApi.broadcast_staking_operation"
|
54
|
+
end
|
55
|
+
# verify the required parameter 'staking_operation_id' is set
|
56
|
+
if @api_client.config.client_side_validation && staking_operation_id.nil?
|
57
|
+
fail ArgumentError, "Missing the required parameter 'staking_operation_id' when calling WalletStakeApi.broadcast_staking_operation"
|
58
|
+
end
|
59
|
+
# verify the required parameter 'broadcast_staking_operation_request' is set
|
60
|
+
if @api_client.config.client_side_validation && broadcast_staking_operation_request.nil?
|
61
|
+
fail ArgumentError, "Missing the required parameter 'broadcast_staking_operation_request' when calling WalletStakeApi.broadcast_staking_operation"
|
62
|
+
end
|
63
|
+
# resource path
|
64
|
+
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id}/broadcast'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'staking_operation_id' + '}', CGI.escape(staking_operation_id.to_s))
|
65
|
+
|
66
|
+
# query parameters
|
67
|
+
query_params = opts[:query_params] || {}
|
68
|
+
|
69
|
+
# header parameters
|
70
|
+
header_params = opts[:header_params] || {}
|
71
|
+
# HTTP header 'Accept' (if needed)
|
72
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
73
|
+
# HTTP header 'Content-Type'
|
74
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
75
|
+
if !content_type.nil?
|
76
|
+
header_params['Content-Type'] = content_type
|
77
|
+
end
|
78
|
+
|
79
|
+
# form parameters
|
80
|
+
form_params = opts[:form_params] || {}
|
81
|
+
|
82
|
+
# http body (model)
|
83
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(broadcast_staking_operation_request)
|
84
|
+
|
85
|
+
# return_type
|
86
|
+
return_type = opts[:debug_return_type] || 'StakingOperation'
|
87
|
+
|
88
|
+
# auth_names
|
89
|
+
auth_names = opts[:debug_auth_names] || []
|
90
|
+
|
91
|
+
new_options = opts.merge(
|
92
|
+
:operation => :"WalletStakeApi.broadcast_staking_operation",
|
93
|
+
:header_params => header_params,
|
94
|
+
:query_params => query_params,
|
95
|
+
:form_params => form_params,
|
96
|
+
:body => post_body,
|
97
|
+
:auth_names => auth_names,
|
98
|
+
:return_type => return_type
|
99
|
+
)
|
100
|
+
|
101
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
102
|
+
if @api_client.config.debugging
|
103
|
+
@api_client.config.logger.debug "API called: WalletStakeApi#broadcast_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
104
|
+
end
|
105
|
+
return data, status_code, headers
|
106
|
+
end
|
107
|
+
|
108
|
+
# Create a new staking operation for an address
|
109
|
+
# Create a new staking operation.
|
110
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
111
|
+
# @param address_id [String] The ID of the address to create the staking operation for.
|
112
|
+
# @param create_staking_operation_request [CreateStakingOperationRequest]
|
113
|
+
# @param [Hash] opts the optional parameters
|
114
|
+
# @return [StakingOperation]
|
115
|
+
def create_staking_operation(wallet_id, address_id, create_staking_operation_request, opts = {})
|
116
|
+
data, _status_code, _headers = create_staking_operation_with_http_info(wallet_id, address_id, create_staking_operation_request, opts)
|
117
|
+
data
|
118
|
+
end
|
119
|
+
|
120
|
+
# Create a new staking operation for an address
|
121
|
+
# Create a new staking operation.
|
122
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
123
|
+
# @param address_id [String] The ID of the address to create the staking operation for.
|
124
|
+
# @param create_staking_operation_request [CreateStakingOperationRequest]
|
125
|
+
# @param [Hash] opts the optional parameters
|
126
|
+
# @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers
|
127
|
+
def create_staking_operation_with_http_info(wallet_id, address_id, create_staking_operation_request, opts = {})
|
128
|
+
if @api_client.config.debugging
|
129
|
+
@api_client.config.logger.debug 'Calling API: WalletStakeApi.create_staking_operation ...'
|
130
|
+
end
|
131
|
+
# verify the required parameter 'wallet_id' is set
|
132
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
133
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletStakeApi.create_staking_operation"
|
134
|
+
end
|
135
|
+
# verify the required parameter 'address_id' is set
|
136
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
137
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling WalletStakeApi.create_staking_operation"
|
138
|
+
end
|
139
|
+
# verify the required parameter 'create_staking_operation_request' is set
|
140
|
+
if @api_client.config.client_side_validation && create_staking_operation_request.nil?
|
141
|
+
fail ArgumentError, "Missing the required parameter 'create_staking_operation_request' when calling WalletStakeApi.create_staking_operation"
|
142
|
+
end
|
143
|
+
# resource path
|
144
|
+
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
|
145
|
+
|
146
|
+
# query parameters
|
147
|
+
query_params = opts[:query_params] || {}
|
148
|
+
|
149
|
+
# header parameters
|
150
|
+
header_params = opts[:header_params] || {}
|
151
|
+
# HTTP header 'Accept' (if needed)
|
152
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
153
|
+
# HTTP header 'Content-Type'
|
154
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
155
|
+
if !content_type.nil?
|
156
|
+
header_params['Content-Type'] = content_type
|
157
|
+
end
|
158
|
+
|
159
|
+
# form parameters
|
160
|
+
form_params = opts[:form_params] || {}
|
161
|
+
|
162
|
+
# http body (model)
|
163
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_staking_operation_request)
|
164
|
+
|
165
|
+
# return_type
|
166
|
+
return_type = opts[:debug_return_type] || 'StakingOperation'
|
167
|
+
|
168
|
+
# auth_names
|
169
|
+
auth_names = opts[:debug_auth_names] || []
|
170
|
+
|
171
|
+
new_options = opts.merge(
|
172
|
+
:operation => :"WalletStakeApi.create_staking_operation",
|
173
|
+
:header_params => header_params,
|
174
|
+
:query_params => query_params,
|
175
|
+
:form_params => form_params,
|
176
|
+
:body => post_body,
|
177
|
+
:auth_names => auth_names,
|
178
|
+
:return_type => return_type
|
179
|
+
)
|
180
|
+
|
181
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
182
|
+
if @api_client.config.debugging
|
183
|
+
@api_client.config.logger.debug "API called: WalletStakeApi#create_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
184
|
+
end
|
185
|
+
return data, status_code, headers
|
186
|
+
end
|
187
|
+
|
188
|
+
# Get the latest state of a staking operation
|
189
|
+
# Get the latest state of a staking operation.
|
190
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to
|
191
|
+
# @param address_id [String] The ID of the address to fetch the staking operation for.
|
192
|
+
# @param staking_operation_id [String] The ID of the staking operation.
|
193
|
+
# @param [Hash] opts the optional parameters
|
194
|
+
# @return [StakingOperation]
|
195
|
+
def get_staking_operation(wallet_id, address_id, staking_operation_id, opts = {})
|
196
|
+
data, _status_code, _headers = get_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, opts)
|
197
|
+
data
|
198
|
+
end
|
199
|
+
|
200
|
+
# Get the latest state of a staking operation
|
201
|
+
# Get the latest state of a staking operation.
|
202
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to
|
203
|
+
# @param address_id [String] The ID of the address to fetch the staking operation for.
|
204
|
+
# @param staking_operation_id [String] The ID of the staking operation.
|
205
|
+
# @param [Hash] opts the optional parameters
|
206
|
+
# @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers
|
207
|
+
def get_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, opts = {})
|
208
|
+
if @api_client.config.debugging
|
209
|
+
@api_client.config.logger.debug 'Calling API: WalletStakeApi.get_staking_operation ...'
|
210
|
+
end
|
211
|
+
# verify the required parameter 'wallet_id' is set
|
212
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
213
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletStakeApi.get_staking_operation"
|
214
|
+
end
|
215
|
+
# verify the required parameter 'address_id' is set
|
216
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
217
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling WalletStakeApi.get_staking_operation"
|
218
|
+
end
|
219
|
+
# verify the required parameter 'staking_operation_id' is set
|
220
|
+
if @api_client.config.client_side_validation && staking_operation_id.nil?
|
221
|
+
fail ArgumentError, "Missing the required parameter 'staking_operation_id' when calling WalletStakeApi.get_staking_operation"
|
222
|
+
end
|
223
|
+
# resource path
|
224
|
+
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'staking_operation_id' + '}', CGI.escape(staking_operation_id.to_s))
|
225
|
+
|
226
|
+
# query parameters
|
227
|
+
query_params = opts[:query_params] || {}
|
228
|
+
|
229
|
+
# header parameters
|
230
|
+
header_params = opts[:header_params] || {}
|
231
|
+
# HTTP header 'Accept' (if needed)
|
232
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
233
|
+
|
234
|
+
# form parameters
|
235
|
+
form_params = opts[:form_params] || {}
|
236
|
+
|
237
|
+
# http body (model)
|
238
|
+
post_body = opts[:debug_body]
|
239
|
+
|
240
|
+
# return_type
|
241
|
+
return_type = opts[:debug_return_type] || 'StakingOperation'
|
242
|
+
|
243
|
+
# auth_names
|
244
|
+
auth_names = opts[:debug_auth_names] || []
|
245
|
+
|
246
|
+
new_options = opts.merge(
|
247
|
+
:operation => :"WalletStakeApi.get_staking_operation",
|
248
|
+
:header_params => header_params,
|
249
|
+
:query_params => query_params,
|
250
|
+
:form_params => form_params,
|
251
|
+
:body => post_body,
|
252
|
+
:auth_names => auth_names,
|
253
|
+
:return_type => return_type
|
254
|
+
)
|
255
|
+
|
256
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
257
|
+
if @api_client.config.debugging
|
258
|
+
@api_client.config.logger.debug "API called: WalletStakeApi#get_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
259
|
+
end
|
260
|
+
return data, status_code, headers
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|