coinbase-sdk 0.0.5 → 0.0.6

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address.rb +63 -44
  3. data/lib/coinbase/authenticator.rb +1 -1
  4. data/lib/coinbase/client/api/server_signers_api.rb +419 -0
  5. data/lib/coinbase/client/api/trades_api.rb +342 -0
  6. data/lib/coinbase/client/models/broadcast_trade_request.rb +222 -0
  7. data/lib/coinbase/client/models/create_address_request.rb +0 -14
  8. data/lib/coinbase/client/models/create_server_signer_request.rb +239 -0
  9. data/lib/coinbase/client/models/create_trade_request.rb +256 -0
  10. data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
  11. data/lib/coinbase/client/models/create_wallet_request_wallet.rb +233 -0
  12. data/lib/coinbase/client/models/seed_creation_event.rb +240 -0
  13. data/lib/coinbase/client/models/seed_creation_event_result.rb +274 -0
  14. data/lib/coinbase/client/models/server_signer.rb +235 -0
  15. data/lib/coinbase/client/models/server_signer_event.rb +239 -0
  16. data/lib/coinbase/client/models/server_signer_event_event.rb +105 -0
  17. data/lib/coinbase/client/models/server_signer_event_list.rb +275 -0
  18. data/lib/coinbase/client/models/signature_creation_event.rb +363 -0
  19. data/lib/coinbase/client/models/signature_creation_event_result.rb +329 -0
  20. data/lib/coinbase/client/models/trade.rb +356 -0
  21. data/lib/coinbase/client/models/trade_list.rb +275 -0
  22. data/lib/coinbase/client/models/transaction.rb +294 -0
  23. data/lib/coinbase/client/models/transaction_type.rb +39 -0
  24. data/lib/coinbase/client/models/wallet.rb +55 -4
  25. data/lib/coinbase/client.rb +18 -0
  26. data/lib/coinbase/transfer.rb +21 -21
  27. data/lib/coinbase/user.rb +14 -89
  28. data/lib/coinbase/wallet.rb +176 -26
  29. data/lib/coinbase.rb +16 -4
  30. metadata +34 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98cd32134ee8acb14c9dc018f39e7af188646b546998c4182cd50d7ae75f2816
4
- data.tar.gz: df6ff19c63798ec10f054972aa75edef79fe65ae39c93cbe0941c77db251e5d6
3
+ metadata.gz: ee1676ef79c89fd46c217eacbffecf507bed15a7362b8550d3110df96d45cd47
4
+ data.tar.gz: 21627d8b1bd0aefd94f33e5638eb514d8984aea244fb353c21e6fc17e899bf8d
5
5
  SHA512:
6
- metadata.gz: a209d25aa72fc185fb667a5ef7b8de617341dba449b0a02b15ad95bc0c434140932353e12258f4665b35ef60e37b5346efca76db811cc5a308cfc69b907f37b8
7
- data.tar.gz: 8856f048ea3ecb664559665e2422d60b6c12d607526aea4bea75f8e8273cf0584b2206e14dcb4e99bdca3436114b03961558be36029b40614d018028f9d41183
6
+ metadata.gz: 8b4ea7efb7b44a82b7b508ae8145ac7df6f467c55a17b27c10fe66aed6a72a7d4408d24ff1253b9ab9cbd6eca19d46def359d094673a066eb6479656ed47d30a
7
+ data.tar.gz: 79557441fda3a63c564976f8568cb0ab5b724063dd793fc5ad32085e2eb533355720d1084cace42d3b7a92e3bdf3748434389c0f1f8a7989c402b7191054be2f
@@ -71,59 +71,26 @@ module Coinbase
71
71
  Coinbase::Balance.from_model_and_asset_id(response, asset_id).amount
72
72
  end
73
73
 
74
- # Transfers the given amount of the given Asset to the given address. Only same-Network Transfers are supported.
74
+ # Transfers the given amount of the given Asset to the specified address or wallet.
75
+ # Only same-network Transfers are supported.
75
76
  # @param amount [Integer, Float, BigDecimal] The amount of the Asset to send.
76
77
  # @param asset_id [Symbol] The ID of the Asset to send. For Ether, :eth, :gwei, and :wei are supported.
77
78
  # @param destination [Wallet | Address | String] The destination of the transfer. If a Wallet, sends to the Wallet's
78
79
  # default address. If a String, interprets it as the address ID.
79
80
  # @return [String] The hash of the Transfer transaction.
80
81
  def transfer(amount, asset_id, destination)
81
- raise 'Cannot transfer from address without private key loaded' if @key.nil?
82
+ destination_address, destination_network = destination_address_and_network(destination)
82
83
 
83
- raise ArgumentError, "Unsupported asset: #{asset_id}" unless Coinbase::Asset.supported?(asset_id)
84
-
85
- if destination.is_a?(Wallet)
86
- raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id
84
+ validate_can_transfer!(amount, asset_id, destination_network)
87
85
 
88
- destination = destination.default_address.id
89
- elsif destination.is_a?(Address)
90
- raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id
86
+ transfer = create_transfer(amount, asset_id, destination_address)
91
87
 
92
- destination = destination.id
93
- end
94
-
95
- current_balance = balance(asset_id)
96
- if current_balance < amount
97
- raise ArgumentError, "Insufficient funds: #{amount} requested, but only #{current_balance} available"
98
- end
99
-
100
- create_transfer_request = {
101
- amount: Coinbase::Asset.to_atomic_amount(amount, asset_id).to_i.to_s,
102
- network_id: network_id,
103
- asset_id: Coinbase::Asset.primary_denomination(asset_id).to_s,
104
- destination: destination
105
- }
106
-
107
- transfer_model = Coinbase.call_api do
108
- transfers_api.create_transfer(wallet_id, id, create_transfer_request)
109
- end
88
+ # If a server signer is managing keys, it will sign and broadcast the underlying transfer transaction out of band.
89
+ return transfer if Coinbase.use_server_signer?
110
90
 
111
- transfer = Coinbase::Transfer.new(transfer_model)
91
+ signed_payload = sign_transfer(transfer)
112
92
 
113
- transaction = transfer.transaction
114
- transaction.sign(@key)
115
-
116
- signed_payload = transaction.hex
117
-
118
- broadcast_transfer_request = {
119
- signed_payload: signed_payload
120
- }
121
-
122
- transfer_model = Coinbase.call_api do
123
- transfers_api.broadcast_transfer(wallet_id, id, transfer.id, broadcast_transfer_request)
124
- end
125
-
126
- Coinbase::Transfer.new(transfer_model)
93
+ broadcast_transfer(transfer, signed_payload)
127
94
  end
128
95
 
129
96
  # Returns whether the Address has a private key backing it to sign transactions.
@@ -170,12 +137,13 @@ module Coinbase
170
137
  page = nil
171
138
 
172
139
  loop do
173
- puts "fetch transfers page: #{page}"
174
140
  response = Coinbase.call_api do
175
141
  transfers_api.list_transfers(wallet_id, id, { limit: 100, page: page })
176
142
  end
177
143
 
178
- transfers.concat(response.data.map { |transfer| Coinbase::Transfer.new(transfer) }) if response.data
144
+ break if response.data.empty?
145
+
146
+ transfers.concat(response.data.map { |transfer| Coinbase::Transfer.new(transfer) })
179
147
 
180
148
  break unless response.has_more
181
149
 
@@ -194,5 +162,56 @@ module Coinbase
194
162
  def transfers_api
195
163
  @transfers_api ||= Coinbase::Client::TransfersApi.new(Coinbase.configuration.api_client)
196
164
  end
165
+
166
+ def destination_address_and_network(destination)
167
+ return [destination.default_address.id, destination.network_id] if destination.is_a?(Wallet)
168
+ return [destination.id, destination.network_id] if destination.is_a?(Address)
169
+
170
+ [destination, network_id]
171
+ end
172
+
173
+ def validate_can_transfer!(amount, asset_id, destination_network_id)
174
+ raise 'Cannot transfer from address without private key loaded' unless can_sign? || Coinbase.use_server_signer?
175
+
176
+ raise ArgumentError, "Unsupported asset: #{asset_id}" unless Coinbase::Asset.supported?(asset_id)
177
+
178
+ raise ArgumentError, 'Transfer must be on the same Network' unless destination_network_id == network_id
179
+
180
+ current_balance = balance(asset_id)
181
+
182
+ return unless current_balance < amount
183
+
184
+ raise ArgumentError, "Insufficient funds: #{amount} requested, but only #{current_balance} available"
185
+ end
186
+
187
+ def create_transfer(amount, asset_id, destination)
188
+ create_transfer_request = {
189
+ amount: Coinbase::Asset.to_atomic_amount(amount, asset_id).to_i.to_s,
190
+ network_id: network_id,
191
+ asset_id: Coinbase::Asset.primary_denomination(asset_id).to_s,
192
+ destination: destination
193
+ }
194
+
195
+ transfer_model = Coinbase.call_api do
196
+ transfers_api.create_transfer(wallet_id, id, create_transfer_request)
197
+ end
198
+
199
+ Coinbase::Transfer.new(transfer_model)
200
+ end
201
+
202
+ def sign_transfer(transfer)
203
+ transaction = transfer.transaction
204
+ transaction.sign(@key)
205
+
206
+ transaction.hex
207
+ end
208
+
209
+ def broadcast_transfer(transfer, signed_payload)
210
+ transfer_model = Coinbase.call_api do
211
+ transfers_api.broadcast_transfer(wallet_id, id, transfer.id, { signed_payload: signed_payload })
212
+ end
213
+
214
+ Coinbase::Transfer.new(transfer_model)
215
+ end
197
216
  end
198
217
  end
@@ -38,7 +38,7 @@ module Coinbase
38
38
 
39
39
  claims = {
40
40
  sub: Coinbase.configuration.api_key_name,
41
- iss: 'coinbase-cloud',
41
+ iss: 'cdp',
42
42
  aud: ['cdp_service'],
43
43
  nbf: Time.now.to_i,
44
44
  exp: Time.now.to_i + 60, # Expiration time: 1 minute from now.
@@ -0,0 +1,419 @@
1
+ =begin
2
+ #Coinbase Platform API
3
+
4
+ #This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
5
+
6
+ The version of the OpenAPI document: 0.0.1-alpha
7
+ Contact: yuga.cohler@coinbase.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.5.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Coinbase::Client
16
+ class ServerSignersApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a new Server-Signer
23
+ # Create a new Server-Signer
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [CreateServerSignerRequest] :create_server_signer_request
26
+ # @return [ServerSigner]
27
+ def create_server_signer(opts = {})
28
+ data, _status_code, _headers = create_server_signer_with_http_info(opts)
29
+ data
30
+ end
31
+
32
+ # Create a new Server-Signer
33
+ # Create a new Server-Signer
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [CreateServerSignerRequest] :create_server_signer_request
36
+ # @return [Array<(ServerSigner, Integer, Hash)>] ServerSigner data, response status code and response headers
37
+ def create_server_signer_with_http_info(opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: ServerSignersApi.create_server_signer ...'
40
+ end
41
+ # resource path
42
+ local_var_path = '/v1/server_signers'
43
+
44
+ # query parameters
45
+ query_params = opts[:query_params] || {}
46
+
47
+ # header parameters
48
+ header_params = opts[:header_params] || {}
49
+ # HTTP header 'Accept' (if needed)
50
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
51
+ # HTTP header 'Content-Type'
52
+ content_type = @api_client.select_header_content_type(['application/json'])
53
+ if !content_type.nil?
54
+ header_params['Content-Type'] = content_type
55
+ end
56
+
57
+ # form parameters
58
+ form_params = opts[:form_params] || {}
59
+
60
+ # http body (model)
61
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_server_signer_request'])
62
+
63
+ # return_type
64
+ return_type = opts[:debug_return_type] || 'ServerSigner'
65
+
66
+ # auth_names
67
+ auth_names = opts[:debug_auth_names] || []
68
+
69
+ new_options = opts.merge(
70
+ :operation => :"ServerSignersApi.create_server_signer",
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => return_type
77
+ )
78
+
79
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
80
+ if @api_client.config.debugging
81
+ @api_client.config.logger.debug "API called: ServerSignersApi#create_server_signer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
+ end
83
+ return data, status_code, headers
84
+ end
85
+
86
+ # Get a server signer by ID
87
+ # Get a server signer by ID
88
+ # @param server_signer_id [String] The ID of the server signer to fetch
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [ServerSigner]
91
+ def get_server_signer(server_signer_id, opts = {})
92
+ data, _status_code, _headers = get_server_signer_with_http_info(server_signer_id, opts)
93
+ data
94
+ end
95
+
96
+ # Get a server signer by ID
97
+ # Get a server signer by ID
98
+ # @param server_signer_id [String] The ID of the server signer to fetch
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [Array<(ServerSigner, Integer, Hash)>] ServerSigner data, response status code and response headers
101
+ def get_server_signer_with_http_info(server_signer_id, opts = {})
102
+ if @api_client.config.debugging
103
+ @api_client.config.logger.debug 'Calling API: ServerSignersApi.get_server_signer ...'
104
+ end
105
+ # verify the required parameter 'server_signer_id' is set
106
+ if @api_client.config.client_side_validation && server_signer_id.nil?
107
+ fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.get_server_signer"
108
+ end
109
+ # resource path
110
+ local_var_path = '/v1/server_signers/{server_signer_id}'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_id.to_s))
111
+
112
+ # query parameters
113
+ query_params = opts[:query_params] || {}
114
+
115
+ # header parameters
116
+ header_params = opts[:header_params] || {}
117
+ # HTTP header 'Accept' (if needed)
118
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
119
+
120
+ # form parameters
121
+ form_params = opts[:form_params] || {}
122
+
123
+ # http body (model)
124
+ post_body = opts[:debug_body]
125
+
126
+ # return_type
127
+ return_type = opts[:debug_return_type] || 'ServerSigner'
128
+
129
+ # auth_names
130
+ auth_names = opts[:debug_auth_names] || []
131
+
132
+ new_options = opts.merge(
133
+ :operation => :"ServerSignersApi.get_server_signer",
134
+ :header_params => header_params,
135
+ :query_params => query_params,
136
+ :form_params => form_params,
137
+ :body => post_body,
138
+ :auth_names => auth_names,
139
+ :return_type => return_type
140
+ )
141
+
142
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
143
+ if @api_client.config.debugging
144
+ @api_client.config.logger.debug "API called: ServerSignersApi#get_server_signer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
145
+ end
146
+ return data, status_code, headers
147
+ end
148
+
149
+ # List events for a server signer
150
+ # List events for a server signer
151
+ # @param server_signer_id [String] The ID of the server signer to fetch events for
152
+ # @param [Hash] opts the optional parameters
153
+ # @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 10.
154
+ # @option opts [String] :page A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
155
+ # @return [ServerSignerEventList]
156
+ def list_server_signer_events(server_signer_id, opts = {})
157
+ data, _status_code, _headers = list_server_signer_events_with_http_info(server_signer_id, opts)
158
+ data
159
+ end
160
+
161
+ # List events for a server signer
162
+ # List events for a server signer
163
+ # @param server_signer_id [String] The ID of the server signer to fetch events for
164
+ # @param [Hash] opts the optional parameters
165
+ # @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 10.
166
+ # @option opts [String] :page A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
167
+ # @return [Array<(ServerSignerEventList, Integer, Hash)>] ServerSignerEventList data, response status code and response headers
168
+ def list_server_signer_events_with_http_info(server_signer_id, opts = {})
169
+ if @api_client.config.debugging
170
+ @api_client.config.logger.debug 'Calling API: ServerSignersApi.list_server_signer_events ...'
171
+ end
172
+ # verify the required parameter 'server_signer_id' is set
173
+ if @api_client.config.client_side_validation && server_signer_id.nil?
174
+ fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.list_server_signer_events"
175
+ end
176
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
177
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ServerSignersApi.list_server_signer_events, the character length must be smaller than or equal to 5000.'
178
+ end
179
+
180
+ # resource path
181
+ local_var_path = '/v1/server_signers/{server_signer_id}/events'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_id.to_s))
182
+
183
+ # query parameters
184
+ query_params = opts[:query_params] || {}
185
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
186
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
187
+
188
+ # header parameters
189
+ header_params = opts[:header_params] || {}
190
+ # HTTP header 'Accept' (if needed)
191
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
192
+
193
+ # form parameters
194
+ form_params = opts[:form_params] || {}
195
+
196
+ # http body (model)
197
+ post_body = opts[:debug_body]
198
+
199
+ # return_type
200
+ return_type = opts[:debug_return_type] || 'ServerSignerEventList'
201
+
202
+ # auth_names
203
+ auth_names = opts[:debug_auth_names] || []
204
+
205
+ new_options = opts.merge(
206
+ :operation => :"ServerSignersApi.list_server_signer_events",
207
+ :header_params => header_params,
208
+ :query_params => query_params,
209
+ :form_params => form_params,
210
+ :body => post_body,
211
+ :auth_names => auth_names,
212
+ :return_type => return_type
213
+ )
214
+
215
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug "API called: ServerSignersApi#list_server_signer_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
218
+ end
219
+ return data, status_code, headers
220
+ end
221
+
222
+ # List server signers for the current project
223
+ # List server signers for the current project
224
+ # @param [Hash] opts the optional parameters
225
+ # @return [ServerSigner]
226
+ def list_server_signers(opts = {})
227
+ data, _status_code, _headers = list_server_signers_with_http_info(opts)
228
+ data
229
+ end
230
+
231
+ # List server signers for the current project
232
+ # List server signers for the current project
233
+ # @param [Hash] opts the optional parameters
234
+ # @return [Array<(ServerSigner, Integer, Hash)>] ServerSigner data, response status code and response headers
235
+ def list_server_signers_with_http_info(opts = {})
236
+ if @api_client.config.debugging
237
+ @api_client.config.logger.debug 'Calling API: ServerSignersApi.list_server_signers ...'
238
+ end
239
+ # resource path
240
+ local_var_path = '/v1/server_signers'
241
+
242
+ # query parameters
243
+ query_params = opts[:query_params] || {}
244
+
245
+ # header parameters
246
+ header_params = opts[:header_params] || {}
247
+ # HTTP header 'Accept' (if needed)
248
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
249
+
250
+ # form parameters
251
+ form_params = opts[:form_params] || {}
252
+
253
+ # http body (model)
254
+ post_body = opts[:debug_body]
255
+
256
+ # return_type
257
+ return_type = opts[:debug_return_type] || 'ServerSigner'
258
+
259
+ # auth_names
260
+ auth_names = opts[:debug_auth_names] || []
261
+
262
+ new_options = opts.merge(
263
+ :operation => :"ServerSignersApi.list_server_signers",
264
+ :header_params => header_params,
265
+ :query_params => query_params,
266
+ :form_params => form_params,
267
+ :body => post_body,
268
+ :auth_names => auth_names,
269
+ :return_type => return_type
270
+ )
271
+
272
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
273
+ if @api_client.config.debugging
274
+ @api_client.config.logger.debug "API called: ServerSignersApi#list_server_signers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
275
+ end
276
+ return data, status_code, headers
277
+ end
278
+
279
+ # Submit the result of a server signer event
280
+ # Submit the result of a server signer event
281
+ # @param server_signer_id [String] The ID of the server signer to submit the event result for
282
+ # @param [Hash] opts the optional parameters
283
+ # @option opts [SeedCreationEventResult] :seed_creation_event_result
284
+ # @return [SeedCreationEventResult]
285
+ def submit_server_signer_seed_event_result(server_signer_id, opts = {})
286
+ data, _status_code, _headers = submit_server_signer_seed_event_result_with_http_info(server_signer_id, opts)
287
+ data
288
+ end
289
+
290
+ # Submit the result of a server signer event
291
+ # Submit the result of a server signer event
292
+ # @param server_signer_id [String] The ID of the server signer to submit the event result for
293
+ # @param [Hash] opts the optional parameters
294
+ # @option opts [SeedCreationEventResult] :seed_creation_event_result
295
+ # @return [Array<(SeedCreationEventResult, Integer, Hash)>] SeedCreationEventResult data, response status code and response headers
296
+ def submit_server_signer_seed_event_result_with_http_info(server_signer_id, opts = {})
297
+ if @api_client.config.debugging
298
+ @api_client.config.logger.debug 'Calling API: ServerSignersApi.submit_server_signer_seed_event_result ...'
299
+ end
300
+ # verify the required parameter 'server_signer_id' is set
301
+ if @api_client.config.client_side_validation && server_signer_id.nil?
302
+ fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.submit_server_signer_seed_event_result"
303
+ end
304
+ # resource path
305
+ local_var_path = '/v1/server_signers/{server_signer_id}/seed_event_result'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_id.to_s))
306
+
307
+ # query parameters
308
+ query_params = opts[:query_params] || {}
309
+
310
+ # header parameters
311
+ header_params = opts[:header_params] || {}
312
+ # HTTP header 'Accept' (if needed)
313
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
314
+ # HTTP header 'Content-Type'
315
+ content_type = @api_client.select_header_content_type(['application/json'])
316
+ if !content_type.nil?
317
+ header_params['Content-Type'] = content_type
318
+ end
319
+
320
+ # form parameters
321
+ form_params = opts[:form_params] || {}
322
+
323
+ # http body (model)
324
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'seed_creation_event_result'])
325
+
326
+ # return_type
327
+ return_type = opts[:debug_return_type] || 'SeedCreationEventResult'
328
+
329
+ # auth_names
330
+ auth_names = opts[:debug_auth_names] || []
331
+
332
+ new_options = opts.merge(
333
+ :operation => :"ServerSignersApi.submit_server_signer_seed_event_result",
334
+ :header_params => header_params,
335
+ :query_params => query_params,
336
+ :form_params => form_params,
337
+ :body => post_body,
338
+ :auth_names => auth_names,
339
+ :return_type => return_type
340
+ )
341
+
342
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
343
+ if @api_client.config.debugging
344
+ @api_client.config.logger.debug "API called: ServerSignersApi#submit_server_signer_seed_event_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
345
+ end
346
+ return data, status_code, headers
347
+ end
348
+
349
+ # Submit the result of a server signer event
350
+ # Submit the result of a server signer event
351
+ # @param server_signer_id [String] The ID of the server signer to submit the event result for
352
+ # @param [Hash] opts the optional parameters
353
+ # @option opts [SignatureCreationEventResult] :signature_creation_event_result
354
+ # @return [SignatureCreationEventResult]
355
+ def submit_server_signer_signature_event_result(server_signer_id, opts = {})
356
+ data, _status_code, _headers = submit_server_signer_signature_event_result_with_http_info(server_signer_id, opts)
357
+ data
358
+ end
359
+
360
+ # Submit the result of a server signer event
361
+ # Submit the result of a server signer event
362
+ # @param server_signer_id [String] The ID of the server signer to submit the event result for
363
+ # @param [Hash] opts the optional parameters
364
+ # @option opts [SignatureCreationEventResult] :signature_creation_event_result
365
+ # @return [Array<(SignatureCreationEventResult, Integer, Hash)>] SignatureCreationEventResult data, response status code and response headers
366
+ def submit_server_signer_signature_event_result_with_http_info(server_signer_id, opts = {})
367
+ if @api_client.config.debugging
368
+ @api_client.config.logger.debug 'Calling API: ServerSignersApi.submit_server_signer_signature_event_result ...'
369
+ end
370
+ # verify the required parameter 'server_signer_id' is set
371
+ if @api_client.config.client_side_validation && server_signer_id.nil?
372
+ fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.submit_server_signer_signature_event_result"
373
+ end
374
+ # resource path
375
+ local_var_path = '/v1/server_signers/{server_signer_id}/signature_event_result'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_id.to_s))
376
+
377
+ # query parameters
378
+ query_params = opts[:query_params] || {}
379
+
380
+ # header parameters
381
+ header_params = opts[:header_params] || {}
382
+ # HTTP header 'Accept' (if needed)
383
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
384
+ # HTTP header 'Content-Type'
385
+ content_type = @api_client.select_header_content_type(['application/json'])
386
+ if !content_type.nil?
387
+ header_params['Content-Type'] = content_type
388
+ end
389
+
390
+ # form parameters
391
+ form_params = opts[:form_params] || {}
392
+
393
+ # http body (model)
394
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'signature_creation_event_result'])
395
+
396
+ # return_type
397
+ return_type = opts[:debug_return_type] || 'SignatureCreationEventResult'
398
+
399
+ # auth_names
400
+ auth_names = opts[:debug_auth_names] || []
401
+
402
+ new_options = opts.merge(
403
+ :operation => :"ServerSignersApi.submit_server_signer_signature_event_result",
404
+ :header_params => header_params,
405
+ :query_params => query_params,
406
+ :form_params => form_params,
407
+ :body => post_body,
408
+ :auth_names => auth_names,
409
+ :return_type => return_type
410
+ )
411
+
412
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
413
+ if @api_client.config.debugging
414
+ @api_client.config.logger.debug "API called: ServerSignersApi#submit_server_signer_signature_event_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
415
+ end
416
+ return data, status_code, headers
417
+ end
418
+ end
419
+ end