coinbase-sdk 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/wallet_address.rb +26 -1
  3. data/lib/coinbase/client/api/smart_contracts_api.rb +332 -0
  4. data/lib/coinbase/client/api/stake_api.rb +0 -8
  5. data/lib/coinbase/client/api/users_api.rb +79 -0
  6. data/lib/coinbase/client/api/validators_api.rb +4 -4
  7. data/lib/coinbase/client/api/wallets_api.rb +4 -4
  8. data/lib/coinbase/client/models/create_smart_contract_request.rb +259 -0
  9. data/lib/coinbase/client/models/create_webhook_request.rb +10 -8
  10. data/lib/coinbase/client/models/deploy_smart_contract_request.rb +222 -0
  11. data/lib/coinbase/client/models/feature.rb +43 -0
  12. data/lib/coinbase/client/models/nft_contract_options.rb +240 -0
  13. data/lib/coinbase/client/models/smart_contract.rb +378 -0
  14. data/lib/coinbase/client/models/smart_contract_list.rb +257 -0
  15. data/lib/coinbase/client/models/smart_contract_options.rb +106 -0
  16. data/lib/coinbase/client/models/smart_contract_type.rb +41 -0
  17. data/lib/coinbase/client/models/staking_balance.rb +2 -2
  18. data/lib/coinbase/client/models/staking_reward.rb +2 -2
  19. data/lib/coinbase/client/models/token_contract_options.rb +257 -0
  20. data/lib/coinbase/client/models/update_webhook_request.rb +10 -8
  21. data/lib/coinbase/client/models/user.rb +231 -0
  22. data/lib/coinbase/client/models/webhook.rb +10 -1
  23. data/lib/coinbase/client/models/webhook_event_type.rb +2 -1
  24. data/lib/coinbase/client/models/webhook_event_type_filter.rb +105 -0
  25. data/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +228 -0
  26. data/lib/coinbase/client.rb +13 -0
  27. data/lib/coinbase/contract_invocation.rb +16 -17
  28. data/lib/coinbase/smart_contract.rb +216 -45
  29. data/lib/coinbase/transaction.rb +3 -0
  30. data/lib/coinbase/transfer.rb +1 -1
  31. data/lib/coinbase/version.rb +1 -1
  32. data/lib/coinbase/wallet.rb +11 -2
  33. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b34f214c1b2a2802d9e6e08dd9cef8867a2b29636c933496b32e7336d898738a
4
- data.tar.gz: a9d1dc3bf9e257f7432832ec3c70d165d09cc1c477c0d5ad4f34c54aba8e4e1f
3
+ metadata.gz: 2313a5ef68b35c37a63761a05e180c114334fbf0d66c1999b1be04c065a50c64
4
+ data.tar.gz: 0ebbb9e277b58368ed608dd91a626016e7cfd51888b9b29d28315546e5c6a09a
5
5
  SHA512:
6
- metadata.gz: 4b2fc3edabfb7edd418e8f5be3e25b0701266206cc012bfb56c6e05b2879baac542ab636c21b80ac71d7871e62cf289c43618c6d5e51ec100cdfb9b49777963d
7
- data.tar.gz: 37fea814fa12745645084442e21e1c443b57d78d24e9b314dc11e6921f590d8b4485b8ea6f774816bf851d8ec70e141ea1240fa9b2fa8f322867eb5a229e7260
6
+ metadata.gz: a9224a29e1cb866c16acca444cf99b06dcb35086aa2f0ff9503e786f42d9dd7c5a6b3a74259689b1f139d93c6cccb8bc8b762ec3578f38d43289e34406dbf3d4
7
+ data.tar.gz: 8a6ee67daf8eb6fdcd8fda7d2333f09307c00c2c19b675a401a951cd6a56f2b73918e80c4e99e5d09c7d2d6767c558c44503e0e5b6be6dc88cf095ef4bcb332e
@@ -106,7 +106,7 @@ module Coinbase
106
106
  # @param asset_id [Symbol] (Optional) The ID of the Asset to send to a payable contract method.
107
107
  # The Asset must be a denomination of the native Asset. For Ethereum, :eth, :gwei, and :wei are supported.
108
108
  # @return [Coinbase::ContractInvocation] The contract invocation object.
109
- def invoke_contract(contract_address:, abi:, method:, args:, amount: nil, asset_id: nil)
109
+ def invoke_contract(contract_address:, method:, args:, abi: nil, amount: nil, asset_id: nil)
110
110
  ensure_can_sign!
111
111
  ensure_sufficient_balance!(amount, asset_id) if amount && asset_id
112
112
 
@@ -130,6 +130,31 @@ module Coinbase
130
130
  invocation
131
131
  end
132
132
 
133
+ # Deploys a new ERC20 token contract with the given name, symbol, and total supply.
134
+ # @param name [String] The name of the token.
135
+ # @param symbol [String] The symbol of the token.
136
+ # @param total_supply [Integer, BigDecimal] The total supply of the token, denominated in
137
+ # whole units.
138
+ # @return [Coinbase::SmartContract] The deployed token contract.
139
+ # @raise [AddressCannotSignError] if the Address does not have a private key backing it.
140
+ def deploy_token(name:, symbol:, total_supply:)
141
+ ensure_can_sign!
142
+
143
+ smart_contract = SmartContract.create_token_contract(
144
+ address_id: id,
145
+ wallet_id: wallet_id,
146
+ name: name,
147
+ symbol: symbol,
148
+ total_supply: total_supply
149
+ )
150
+
151
+ return smart_contract if Coinbase.use_server_signer?
152
+
153
+ smart_contract.sign(@key)
154
+ smart_contract.deploy!
155
+ smart_contract
156
+ end
157
+
133
158
  # Signs the given unsigned payload.
134
159
  # @param unsigned_payload [String] The hex-encoded hashed unsigned payload for the Address to sign.
135
160
  # @return [Coinbase::PayloadSignature] The payload signature
@@ -0,0 +1,332 @@
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
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Coinbase::Client
16
+ class SmartContractsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a new smart contract
23
+ # Create a new smart contract
24
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
25
+ # @param address_id [String] The ID of the address to deploy the smart contract from.
26
+ # @param create_smart_contract_request [CreateSmartContractRequest]
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [SmartContract]
29
+ def create_smart_contract(wallet_id, address_id, create_smart_contract_request, opts = {})
30
+ data, _status_code, _headers = create_smart_contract_with_http_info(wallet_id, address_id, create_smart_contract_request, opts)
31
+ data
32
+ end
33
+
34
+ # Create a new smart contract
35
+ # Create a new smart contract
36
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
37
+ # @param address_id [String] The ID of the address to deploy the smart contract from.
38
+ # @param create_smart_contract_request [CreateSmartContractRequest]
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(SmartContract, Integer, Hash)>] SmartContract data, response status code and response headers
41
+ def create_smart_contract_with_http_info(wallet_id, address_id, create_smart_contract_request, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: SmartContractsApi.create_smart_contract ...'
44
+ end
45
+ # verify the required parameter 'wallet_id' is set
46
+ if @api_client.config.client_side_validation && wallet_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling SmartContractsApi.create_smart_contract"
48
+ end
49
+ # verify the required parameter 'address_id' is set
50
+ if @api_client.config.client_side_validation && address_id.nil?
51
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling SmartContractsApi.create_smart_contract"
52
+ end
53
+ # verify the required parameter 'create_smart_contract_request' is set
54
+ if @api_client.config.client_side_validation && create_smart_contract_request.nil?
55
+ fail ArgumentError, "Missing the required parameter 'create_smart_contract_request' when calling SmartContractsApi.create_smart_contract"
56
+ end
57
+ # resource path
58
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
59
+
60
+ # query parameters
61
+ query_params = opts[:query_params] || {}
62
+
63
+ # header parameters
64
+ header_params = opts[:header_params] || {}
65
+ # HTTP header 'Accept' (if needed)
66
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
67
+ # HTTP header 'Content-Type'
68
+ content_type = @api_client.select_header_content_type(['application/json'])
69
+ if !content_type.nil?
70
+ header_params['Content-Type'] = content_type
71
+ end
72
+
73
+ # form parameters
74
+ form_params = opts[:form_params] || {}
75
+
76
+ # http body (model)
77
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_smart_contract_request)
78
+
79
+ # return_type
80
+ return_type = opts[:debug_return_type] || 'SmartContract'
81
+
82
+ # auth_names
83
+ auth_names = opts[:debug_auth_names] || []
84
+
85
+ new_options = opts.merge(
86
+ :operation => :"SmartContractsApi.create_smart_contract",
87
+ :header_params => header_params,
88
+ :query_params => query_params,
89
+ :form_params => form_params,
90
+ :body => post_body,
91
+ :auth_names => auth_names,
92
+ :return_type => return_type
93
+ )
94
+
95
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug "API called: SmartContractsApi#create_smart_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
98
+ end
99
+ return data, status_code, headers
100
+ end
101
+
102
+ # Deploy a smart contract
103
+ # Deploys a smart contract, by broadcasting the transaction to the network.
104
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
105
+ # @param address_id [String] The ID of the address to broadcast the transaction from.
106
+ # @param smart_contract_id [String] The UUID of the smart contract to broadcast the transaction to.
107
+ # @param deploy_smart_contract_request [DeploySmartContractRequest]
108
+ # @param [Hash] opts the optional parameters
109
+ # @return [SmartContract]
110
+ def deploy_smart_contract(wallet_id, address_id, smart_contract_id, deploy_smart_contract_request, opts = {})
111
+ data, _status_code, _headers = deploy_smart_contract_with_http_info(wallet_id, address_id, smart_contract_id, deploy_smart_contract_request, opts)
112
+ data
113
+ end
114
+
115
+ # Deploy a smart contract
116
+ # Deploys a smart contract, by broadcasting the transaction to the network.
117
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
118
+ # @param address_id [String] The ID of the address to broadcast the transaction from.
119
+ # @param smart_contract_id [String] The UUID of the smart contract to broadcast the transaction to.
120
+ # @param deploy_smart_contract_request [DeploySmartContractRequest]
121
+ # @param [Hash] opts the optional parameters
122
+ # @return [Array<(SmartContract, Integer, Hash)>] SmartContract data, response status code and response headers
123
+ def deploy_smart_contract_with_http_info(wallet_id, address_id, smart_contract_id, deploy_smart_contract_request, opts = {})
124
+ if @api_client.config.debugging
125
+ @api_client.config.logger.debug 'Calling API: SmartContractsApi.deploy_smart_contract ...'
126
+ end
127
+ # verify the required parameter 'wallet_id' is set
128
+ if @api_client.config.client_side_validation && wallet_id.nil?
129
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling SmartContractsApi.deploy_smart_contract"
130
+ end
131
+ # verify the required parameter 'address_id' is set
132
+ if @api_client.config.client_side_validation && address_id.nil?
133
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling SmartContractsApi.deploy_smart_contract"
134
+ end
135
+ # verify the required parameter 'smart_contract_id' is set
136
+ if @api_client.config.client_side_validation && smart_contract_id.nil?
137
+ fail ArgumentError, "Missing the required parameter 'smart_contract_id' when calling SmartContractsApi.deploy_smart_contract"
138
+ end
139
+ # verify the required parameter 'deploy_smart_contract_request' is set
140
+ if @api_client.config.client_side_validation && deploy_smart_contract_request.nil?
141
+ fail ArgumentError, "Missing the required parameter 'deploy_smart_contract_request' when calling SmartContractsApi.deploy_smart_contract"
142
+ end
143
+ # resource path
144
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}/deploy'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'smart_contract_id' + '}', CGI.escape(smart_contract_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']) unless header_params['Accept']
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(deploy_smart_contract_request)
164
+
165
+ # return_type
166
+ return_type = opts[:debug_return_type] || 'SmartContract'
167
+
168
+ # auth_names
169
+ auth_names = opts[:debug_auth_names] || []
170
+
171
+ new_options = opts.merge(
172
+ :operation => :"SmartContractsApi.deploy_smart_contract",
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: SmartContractsApi#deploy_smart_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
184
+ end
185
+ return data, status_code, headers
186
+ end
187
+
188
+ # Get a specific smart contract deployed by address
189
+ # Get a specific smart contract deployed by address.
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 smart contract for.
192
+ # @param smart_contract_id [String] The UUID of the smart contract to fetch.
193
+ # @param [Hash] opts the optional parameters
194
+ # @return [SmartContract]
195
+ def get_smart_contract(wallet_id, address_id, smart_contract_id, opts = {})
196
+ data, _status_code, _headers = get_smart_contract_with_http_info(wallet_id, address_id, smart_contract_id, opts)
197
+ data
198
+ end
199
+
200
+ # Get a specific smart contract deployed by address
201
+ # Get a specific smart contract deployed by address.
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 smart contract for.
204
+ # @param smart_contract_id [String] The UUID of the smart contract to fetch.
205
+ # @param [Hash] opts the optional parameters
206
+ # @return [Array<(SmartContract, Integer, Hash)>] SmartContract data, response status code and response headers
207
+ def get_smart_contract_with_http_info(wallet_id, address_id, smart_contract_id, opts = {})
208
+ if @api_client.config.debugging
209
+ @api_client.config.logger.debug 'Calling API: SmartContractsApi.get_smart_contract ...'
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 SmartContractsApi.get_smart_contract"
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 SmartContractsApi.get_smart_contract"
218
+ end
219
+ # verify the required parameter 'smart_contract_id' is set
220
+ if @api_client.config.client_side_validation && smart_contract_id.nil?
221
+ fail ArgumentError, "Missing the required parameter 'smart_contract_id' when calling SmartContractsApi.get_smart_contract"
222
+ end
223
+ # resource path
224
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'smart_contract_id' + '}', CGI.escape(smart_contract_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']) unless header_params['Accept']
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] || 'SmartContract'
242
+
243
+ # auth_names
244
+ auth_names = opts[:debug_auth_names] || []
245
+
246
+ new_options = opts.merge(
247
+ :operation => :"SmartContractsApi.get_smart_contract",
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: SmartContractsApi#get_smart_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
259
+ end
260
+ return data, status_code, headers
261
+ end
262
+
263
+ # List smart contracts deployed by address
264
+ # List all smart contracts deployed by address.
265
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
266
+ # @param address_id [String] The ID of the address to fetch the smart contracts for.
267
+ # @param [Hash] opts the optional parameters
268
+ # @return [SmartContractList]
269
+ def list_smart_contracts(wallet_id, address_id, opts = {})
270
+ data, _status_code, _headers = list_smart_contracts_with_http_info(wallet_id, address_id, opts)
271
+ data
272
+ end
273
+
274
+ # List smart contracts deployed by address
275
+ # List all smart contracts deployed by address.
276
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
277
+ # @param address_id [String] The ID of the address to fetch the smart contracts for.
278
+ # @param [Hash] opts the optional parameters
279
+ # @return [Array<(SmartContractList, Integer, Hash)>] SmartContractList data, response status code and response headers
280
+ def list_smart_contracts_with_http_info(wallet_id, address_id, opts = {})
281
+ if @api_client.config.debugging
282
+ @api_client.config.logger.debug 'Calling API: SmartContractsApi.list_smart_contracts ...'
283
+ end
284
+ # verify the required parameter 'wallet_id' is set
285
+ if @api_client.config.client_side_validation && wallet_id.nil?
286
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling SmartContractsApi.list_smart_contracts"
287
+ end
288
+ # verify the required parameter 'address_id' is set
289
+ if @api_client.config.client_side_validation && address_id.nil?
290
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling SmartContractsApi.list_smart_contracts"
291
+ end
292
+ # resource path
293
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
294
+
295
+ # query parameters
296
+ query_params = opts[:query_params] || {}
297
+
298
+ # header parameters
299
+ header_params = opts[:header_params] || {}
300
+ # HTTP header 'Accept' (if needed)
301
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
302
+
303
+ # form parameters
304
+ form_params = opts[:form_params] || {}
305
+
306
+ # http body (model)
307
+ post_body = opts[:debug_body]
308
+
309
+ # return_type
310
+ return_type = opts[:debug_return_type] || 'SmartContractList'
311
+
312
+ # auth_names
313
+ auth_names = opts[:debug_auth_names] || []
314
+
315
+ new_options = opts.merge(
316
+ :operation => :"SmartContractsApi.list_smart_contracts",
317
+ :header_params => header_params,
318
+ :query_params => query_params,
319
+ :form_params => form_params,
320
+ :body => post_body,
321
+ :auth_names => auth_names,
322
+ :return_type => return_type
323
+ )
324
+
325
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
326
+ if @api_client.config.debugging
327
+ @api_client.config.logger.debug "API called: SmartContractsApi#list_smart_contracts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
328
+ end
329
+ return data, status_code, headers
330
+ end
331
+ end
332
+ end
@@ -146,18 +146,10 @@ module Coinbase::Client
146
146
  if @api_client.config.client_side_validation && start_time.nil?
147
147
  fail ArgumentError, "Missing the required parameter 'start_time' when calling StakeApi.fetch_historical_staking_balances"
148
148
  end
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.'
151
- end
152
-
153
149
  # verify the required parameter 'end_time' is set
154
150
  if @api_client.config.client_side_validation && end_time.nil?
155
151
  fail ArgumentError, "Missing the required parameter 'end_time' when calling StakeApi.fetch_historical_staking_balances"
156
152
  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
153
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
162
154
  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
155
  end
@@ -0,0 +1,79 @@
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
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Coinbase::Client
16
+ class UsersApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get current user
23
+ # Get current user
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [User]
26
+ def get_current_user(opts = {})
27
+ data, _status_code, _headers = get_current_user_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Get current user
32
+ # Get current user
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
35
+ def get_current_user_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: UsersApi.get_current_user ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/v1/users/me'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
49
+
50
+ # form parameters
51
+ form_params = opts[:form_params] || {}
52
+
53
+ # http body (model)
54
+ post_body = opts[:debug_body]
55
+
56
+ # return_type
57
+ return_type = opts[:debug_return_type] || 'User'
58
+
59
+ # auth_names
60
+ auth_names = opts[:debug_auth_names] || []
61
+
62
+ new_options = opts.merge(
63
+ :operation => :"UsersApi.get_current_user",
64
+ :header_params => header_params,
65
+ :query_params => query_params,
66
+ :form_params => form_params,
67
+ :body => post_body,
68
+ :auth_names => auth_names,
69
+ :return_type => return_type
70
+ )
71
+
72
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: UsersApi#get_current_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+ end
79
+ end
@@ -20,7 +20,7 @@ module Coinbase::Client
20
20
  @api_client = api_client
21
21
  end
22
22
  # Get a validator belonging to the CDP project
23
- # Get a validator belonging to the CDP project for a given network, asset and id.
23
+ # Get a validator belonging to the user for a given network, asset and id.
24
24
  # @param network_id [String] The ID of the blockchain network.
25
25
  # @param asset_id [String] The symbol of the asset to get the validator for.
26
26
  # @param validator_id [String] The unique id of the validator to fetch details for.
@@ -32,7 +32,7 @@ module Coinbase::Client
32
32
  end
33
33
 
34
34
  # Get a validator belonging to the CDP project
35
- # Get a validator belonging to the CDP project for a given network, asset and id.
35
+ # Get a validator belonging to the user for a given network, asset and id.
36
36
  # @param network_id [String] The ID of the blockchain network.
37
37
  # @param asset_id [String] The symbol of the asset to get the validator for.
38
38
  # @param validator_id [String] The unique id of the validator to fetch details for.
@@ -95,7 +95,7 @@ module Coinbase::Client
95
95
  end
96
96
 
97
97
  # List validators belonging to the CDP project
98
- # List validators belonging to the CDP project for a given network and asset.
98
+ # List validators belonging to the user for a given network and asset.
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
@@ -109,7 +109,7 @@ module Coinbase::Client
109
109
  end
110
110
 
111
111
  # List validators belonging to the CDP project
112
- # List validators belonging to the CDP project for a given network and asset.
112
+ # List validators belonging to the user for a given network and asset.
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
@@ -20,7 +20,7 @@ module Coinbase::Client
20
20
  @api_client = api_client
21
21
  end
22
22
  # Create a new wallet
23
- # Create a new wallet scoped to the CDP project.
23
+ # Create a new wallet scoped to the user.
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [CreateWalletRequest] :create_wallet_request
26
26
  # @return [Wallet]
@@ -30,7 +30,7 @@ module Coinbase::Client
30
30
  end
31
31
 
32
32
  # Create a new wallet
33
- # Create a new wallet scoped to the CDP project.
33
+ # Create a new wallet scoped to the user.
34
34
  # @param [Hash] opts the optional parameters
35
35
  # @option opts [CreateWalletRequest] :create_wallet_request
36
36
  # @return [Array<(Wallet, Integer, Hash)>] Wallet data, response status code and response headers
@@ -279,7 +279,7 @@ module Coinbase::Client
279
279
  end
280
280
 
281
281
  # List wallets
282
- # List wallets belonging to the CDP project.
282
+ # List wallets belonging to the user.
283
283
  # @param [Hash] opts the optional parameters
284
284
  # @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.
285
285
  # @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.
@@ -290,7 +290,7 @@ module Coinbase::Client
290
290
  end
291
291
 
292
292
  # List wallets
293
- # List wallets belonging to the CDP project.
293
+ # List wallets belonging to the user.
294
294
  # @param [Hash] opts the optional parameters
295
295
  # @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.
296
296
  # @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.