coinbase-sdk 0.0.6 → 0.0.8
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.rb +73 -19
- data/lib/coinbase/asset.rb +80 -56
- data/lib/coinbase/balance.rb +10 -6
- data/lib/coinbase/client/api/assets_api.rb +91 -0
- data/lib/coinbase/client/api/balances_api.rb +97 -0
- data/lib/coinbase/client/api/external_addresses_api.rb +242 -0
- data/lib/coinbase/client/api/server_signers_api.rb +13 -3
- data/lib/coinbase/client/api/stake_api.rb +236 -0
- data/lib/coinbase/client/api/transfer_api.rb +114 -0
- data/lib/coinbase/client/models/broadcast_trade_request.rb +14 -4
- data/lib/coinbase/client/models/build_staking_operation_request.rb +291 -0
- data/lib/coinbase/client/models/feature.rb +42 -0
- data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +258 -0
- data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +343 -0
- data/lib/coinbase/client/models/get_staking_context_request.rb +274 -0
- data/lib/coinbase/client/models/partial_eth_staking_context.rb +257 -0
- data/lib/coinbase/client/models/request_faucet_funds200_response.rb +222 -0
- data/lib/coinbase/client/models/server_signer_list.rb +275 -0
- data/lib/coinbase/client/models/staking_context.rb +222 -0
- data/lib/coinbase/client/models/staking_context_context.rb +104 -0
- data/lib/coinbase/client/models/staking_operation.rb +222 -0
- data/lib/coinbase/client/models/staking_reward.rb +308 -0
- data/lib/coinbase/client/models/trade.rb +13 -4
- data/lib/coinbase/client/models/transaction.rb +45 -1
- data/lib/coinbase/client/models/transfer.rb +33 -1
- data/lib/coinbase/client/models/wallet.rb +20 -1
- data/lib/coinbase/client.rb +14 -0
- data/lib/coinbase/constants.rb +2 -27
- data/lib/coinbase/errors.rb +50 -62
- data/lib/coinbase/network.rb +6 -20
- data/lib/coinbase/server_signer.rb +57 -0
- data/lib/coinbase/trade.rb +147 -0
- data/lib/coinbase/transaction.rb +125 -0
- data/lib/coinbase/transfer.rb +22 -55
- data/lib/coinbase/wallet.rb +14 -3
- data/lib/coinbase.rb +11 -11
- metadata +22 -2
@@ -0,0 +1,242 @@
|
|
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 ExternalAddressesApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Get the balance of an asset in an external address
|
23
|
+
# Get the balance of an asset in an external address
|
24
|
+
# @param network_id [String] The ID of the blockchain network
|
25
|
+
# @param address_id [String] The ID of the address to fetch the balance for
|
26
|
+
# @param asset_id [String] The ID of the asset to fetch the balance for
|
27
|
+
# @param [Hash] opts the optional parameters
|
28
|
+
# @return [Balance]
|
29
|
+
def get_external_address_balance(network_id, address_id, asset_id, opts = {})
|
30
|
+
data, _status_code, _headers = get_external_address_balance_with_http_info(network_id, address_id, asset_id, opts)
|
31
|
+
data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Get the balance of an asset in an external address
|
35
|
+
# Get the balance of an asset in an external address
|
36
|
+
# @param network_id [String] The ID of the blockchain network
|
37
|
+
# @param address_id [String] The ID of the address to fetch the balance for
|
38
|
+
# @param asset_id [String] The ID of the asset to fetch the balance for
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [Array<(Balance, Integer, Hash)>] Balance data, response status code and response headers
|
41
|
+
def get_external_address_balance_with_http_info(network_id, address_id, asset_id, opts = {})
|
42
|
+
if @api_client.config.debugging
|
43
|
+
@api_client.config.logger.debug 'Calling API: ExternalAddressesApi.get_external_address_balance ...'
|
44
|
+
end
|
45
|
+
# verify the required parameter 'network_id' is set
|
46
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling ExternalAddressesApi.get_external_address_balance"
|
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 ExternalAddressesApi.get_external_address_balance"
|
52
|
+
end
|
53
|
+
# verify the required parameter 'asset_id' is set
|
54
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
55
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling ExternalAddressesApi.get_external_address_balance"
|
56
|
+
end
|
57
|
+
# resource path
|
58
|
+
local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/balances/{asset_id}'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_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'])
|
67
|
+
|
68
|
+
# form parameters
|
69
|
+
form_params = opts[:form_params] || {}
|
70
|
+
|
71
|
+
# http body (model)
|
72
|
+
post_body = opts[:debug_body]
|
73
|
+
|
74
|
+
# return_type
|
75
|
+
return_type = opts[:debug_return_type] || 'Balance'
|
76
|
+
|
77
|
+
# auth_names
|
78
|
+
auth_names = opts[:debug_auth_names] || []
|
79
|
+
|
80
|
+
new_options = opts.merge(
|
81
|
+
:operation => :"ExternalAddressesApi.get_external_address_balance",
|
82
|
+
:header_params => header_params,
|
83
|
+
:query_params => query_params,
|
84
|
+
:form_params => form_params,
|
85
|
+
:body => post_body,
|
86
|
+
:auth_names => auth_names,
|
87
|
+
:return_type => return_type
|
88
|
+
)
|
89
|
+
|
90
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
91
|
+
if @api_client.config.debugging
|
92
|
+
@api_client.config.logger.debug "API called: ExternalAddressesApi#get_external_address_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
93
|
+
end
|
94
|
+
return data, status_code, headers
|
95
|
+
end
|
96
|
+
|
97
|
+
# Get the balances of an external address
|
98
|
+
# List all of the balances of an external address
|
99
|
+
# @param network_id [String] The ID of the blockchain network
|
100
|
+
# @param address_id [String] The ID of the address to fetch the balance for
|
101
|
+
# @param [Hash] opts the optional parameters
|
102
|
+
# @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.
|
103
|
+
# @return [AddressBalanceList]
|
104
|
+
def list_external_address_balances(network_id, address_id, opts = {})
|
105
|
+
data, _status_code, _headers = list_external_address_balances_with_http_info(network_id, address_id, opts)
|
106
|
+
data
|
107
|
+
end
|
108
|
+
|
109
|
+
# Get the balances of an external address
|
110
|
+
# List all of the balances of an external address
|
111
|
+
# @param network_id [String] The ID of the blockchain network
|
112
|
+
# @param address_id [String] The ID of the address to fetch the balance for
|
113
|
+
# @param [Hash] opts the optional parameters
|
114
|
+
# @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.
|
115
|
+
# @return [Array<(AddressBalanceList, Integer, Hash)>] AddressBalanceList data, response status code and response headers
|
116
|
+
def list_external_address_balances_with_http_info(network_id, address_id, opts = {})
|
117
|
+
if @api_client.config.debugging
|
118
|
+
@api_client.config.logger.debug 'Calling API: ExternalAddressesApi.list_external_address_balances ...'
|
119
|
+
end
|
120
|
+
# verify the required parameter 'network_id' is set
|
121
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
122
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling ExternalAddressesApi.list_external_address_balances"
|
123
|
+
end
|
124
|
+
# verify the required parameter 'address_id' is set
|
125
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
126
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling ExternalAddressesApi.list_external_address_balances"
|
127
|
+
end
|
128
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
129
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ExternalAddressesApi.list_external_address_balances, the character length must be smaller than or equal to 5000.'
|
130
|
+
end
|
131
|
+
|
132
|
+
# resource path
|
133
|
+
local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/balances'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
|
134
|
+
|
135
|
+
# query parameters
|
136
|
+
query_params = opts[:query_params] || {}
|
137
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
138
|
+
|
139
|
+
# header parameters
|
140
|
+
header_params = opts[:header_params] || {}
|
141
|
+
# HTTP header 'Accept' (if needed)
|
142
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
143
|
+
|
144
|
+
# form parameters
|
145
|
+
form_params = opts[:form_params] || {}
|
146
|
+
|
147
|
+
# http body (model)
|
148
|
+
post_body = opts[:debug_body]
|
149
|
+
|
150
|
+
# return_type
|
151
|
+
return_type = opts[:debug_return_type] || 'AddressBalanceList'
|
152
|
+
|
153
|
+
# auth_names
|
154
|
+
auth_names = opts[:debug_auth_names] || []
|
155
|
+
|
156
|
+
new_options = opts.merge(
|
157
|
+
:operation => :"ExternalAddressesApi.list_external_address_balances",
|
158
|
+
:header_params => header_params,
|
159
|
+
:query_params => query_params,
|
160
|
+
:form_params => form_params,
|
161
|
+
:body => post_body,
|
162
|
+
:auth_names => auth_names,
|
163
|
+
:return_type => return_type
|
164
|
+
)
|
165
|
+
|
166
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
167
|
+
if @api_client.config.debugging
|
168
|
+
@api_client.config.logger.debug "API called: ExternalAddressesApi#list_external_address_balances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
169
|
+
end
|
170
|
+
return data, status_code, headers
|
171
|
+
end
|
172
|
+
|
173
|
+
# Request faucet funds for external address.
|
174
|
+
# Request faucet funds to be sent to external address.
|
175
|
+
# @param network_id [String] The ID of the wallet the address belongs to.
|
176
|
+
# @param address_id [String] The onchain address of the address that is being fetched.
|
177
|
+
# @param [Hash] opts the optional parameters
|
178
|
+
# @return [FaucetTransaction]
|
179
|
+
def request_external_faucet_funds(network_id, address_id, opts = {})
|
180
|
+
data, _status_code, _headers = request_external_faucet_funds_with_http_info(network_id, address_id, opts)
|
181
|
+
data
|
182
|
+
end
|
183
|
+
|
184
|
+
# Request faucet funds for external address.
|
185
|
+
# Request faucet funds to be sent to external address.
|
186
|
+
# @param network_id [String] The ID of the wallet the address belongs to.
|
187
|
+
# @param address_id [String] The onchain address of the address that is being fetched.
|
188
|
+
# @param [Hash] opts the optional parameters
|
189
|
+
# @return [Array<(FaucetTransaction, Integer, Hash)>] FaucetTransaction data, response status code and response headers
|
190
|
+
def request_external_faucet_funds_with_http_info(network_id, address_id, opts = {})
|
191
|
+
if @api_client.config.debugging
|
192
|
+
@api_client.config.logger.debug 'Calling API: ExternalAddressesApi.request_external_faucet_funds ...'
|
193
|
+
end
|
194
|
+
# verify the required parameter 'network_id' is set
|
195
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
196
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling ExternalAddressesApi.request_external_faucet_funds"
|
197
|
+
end
|
198
|
+
# verify the required parameter 'address_id' is set
|
199
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
200
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling ExternalAddressesApi.request_external_faucet_funds"
|
201
|
+
end
|
202
|
+
# resource path
|
203
|
+
local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/faucet'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
|
204
|
+
|
205
|
+
# query parameters
|
206
|
+
query_params = opts[:query_params] || {}
|
207
|
+
|
208
|
+
# header parameters
|
209
|
+
header_params = opts[:header_params] || {}
|
210
|
+
# HTTP header 'Accept' (if needed)
|
211
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
212
|
+
|
213
|
+
# form parameters
|
214
|
+
form_params = opts[:form_params] || {}
|
215
|
+
|
216
|
+
# http body (model)
|
217
|
+
post_body = opts[:debug_body]
|
218
|
+
|
219
|
+
# return_type
|
220
|
+
return_type = opts[:debug_return_type] || 'FaucetTransaction'
|
221
|
+
|
222
|
+
# auth_names
|
223
|
+
auth_names = opts[:debug_auth_names] || []
|
224
|
+
|
225
|
+
new_options = opts.merge(
|
226
|
+
:operation => :"ExternalAddressesApi.request_external_faucet_funds",
|
227
|
+
:header_params => header_params,
|
228
|
+
:query_params => query_params,
|
229
|
+
:form_params => form_params,
|
230
|
+
:body => post_body,
|
231
|
+
:auth_names => auth_names,
|
232
|
+
:return_type => return_type
|
233
|
+
)
|
234
|
+
|
235
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
236
|
+
if @api_client.config.debugging
|
237
|
+
@api_client.config.logger.debug "API called: ExternalAddressesApi#request_external_faucet_funds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
238
|
+
end
|
239
|
+
return data, status_code, headers
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
@@ -222,7 +222,9 @@ module Coinbase::Client
|
|
222
222
|
# List server signers for the current project
|
223
223
|
# List server signers for the current project
|
224
224
|
# @param [Hash] opts the optional parameters
|
225
|
-
# @
|
225
|
+
# @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.
|
226
|
+
# @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.
|
227
|
+
# @return [ServerSignerList]
|
226
228
|
def list_server_signers(opts = {})
|
227
229
|
data, _status_code, _headers = list_server_signers_with_http_info(opts)
|
228
230
|
data
|
@@ -231,16 +233,24 @@ module Coinbase::Client
|
|
231
233
|
# List server signers for the current project
|
232
234
|
# List server signers for the current project
|
233
235
|
# @param [Hash] opts the optional parameters
|
234
|
-
# @
|
236
|
+
# @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.
|
237
|
+
# @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.
|
238
|
+
# @return [Array<(ServerSignerList, Integer, Hash)>] ServerSignerList data, response status code and response headers
|
235
239
|
def list_server_signers_with_http_info(opts = {})
|
236
240
|
if @api_client.config.debugging
|
237
241
|
@api_client.config.logger.debug 'Calling API: ServerSignersApi.list_server_signers ...'
|
238
242
|
end
|
243
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
244
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ServerSignersApi.list_server_signers, the character length must be smaller than or equal to 5000.'
|
245
|
+
end
|
246
|
+
|
239
247
|
# resource path
|
240
248
|
local_var_path = '/v1/server_signers'
|
241
249
|
|
242
250
|
# query parameters
|
243
251
|
query_params = opts[:query_params] || {}
|
252
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
253
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
244
254
|
|
245
255
|
# header parameters
|
246
256
|
header_params = opts[:header_params] || {}
|
@@ -254,7 +264,7 @@ module Coinbase::Client
|
|
254
264
|
post_body = opts[:debug_body]
|
255
265
|
|
256
266
|
# return_type
|
257
|
-
return_type = opts[:debug_return_type] || '
|
267
|
+
return_type = opts[:debug_return_type] || 'ServerSignerList'
|
258
268
|
|
259
269
|
# auth_names
|
260
270
|
auth_names = opts[:debug_auth_names] || []
|
@@ -0,0 +1,236 @@
|
|
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 StakeApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Build a new staking operation
|
23
|
+
# Build a new staking operation
|
24
|
+
# @param build_staking_operation_request [BuildStakingOperationRequest]
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [StakingOperation]
|
27
|
+
def build_staking_operation(build_staking_operation_request, opts = {})
|
28
|
+
data, _status_code, _headers = build_staking_operation_with_http_info(build_staking_operation_request, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Build a new staking operation
|
33
|
+
# Build a new staking operation
|
34
|
+
# @param build_staking_operation_request [BuildStakingOperationRequest]
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers
|
37
|
+
def build_staking_operation_with_http_info(build_staking_operation_request, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: StakeApi.build_staking_operation ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'build_staking_operation_request' is set
|
42
|
+
if @api_client.config.client_side_validation && build_staking_operation_request.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'build_staking_operation_request' when calling StakeApi.build_staking_operation"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/v1/stake/build'
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = opts[:query_params] || {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = opts[:header_params] || {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
55
|
+
# HTTP header 'Content-Type'
|
56
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
57
|
+
if !content_type.nil?
|
58
|
+
header_params['Content-Type'] = content_type
|
59
|
+
end
|
60
|
+
|
61
|
+
# form parameters
|
62
|
+
form_params = opts[:form_params] || {}
|
63
|
+
|
64
|
+
# http body (model)
|
65
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(build_staking_operation_request)
|
66
|
+
|
67
|
+
# return_type
|
68
|
+
return_type = opts[:debug_return_type] || 'StakingOperation'
|
69
|
+
|
70
|
+
# auth_names
|
71
|
+
auth_names = opts[:debug_auth_names] || []
|
72
|
+
|
73
|
+
new_options = opts.merge(
|
74
|
+
:operation => :"StakeApi.build_staking_operation",
|
75
|
+
:header_params => header_params,
|
76
|
+
:query_params => query_params,
|
77
|
+
:form_params => form_params,
|
78
|
+
:body => post_body,
|
79
|
+
:auth_names => auth_names,
|
80
|
+
:return_type => return_type
|
81
|
+
)
|
82
|
+
|
83
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
84
|
+
if @api_client.config.debugging
|
85
|
+
@api_client.config.logger.debug "API called: StakeApi#build_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
86
|
+
end
|
87
|
+
return data, status_code, headers
|
88
|
+
end
|
89
|
+
|
90
|
+
# Fetch staking rewards
|
91
|
+
# Fetch staking rewards for a list of addresses
|
92
|
+
# @param fetch_staking_rewards_request [FetchStakingRewardsRequest]
|
93
|
+
# @param [Hash] opts the optional parameters
|
94
|
+
# @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.
|
95
|
+
# @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.
|
96
|
+
# @return [FetchStakingRewards200Response]
|
97
|
+
def fetch_staking_rewards(fetch_staking_rewards_request, opts = {})
|
98
|
+
data, _status_code, _headers = fetch_staking_rewards_with_http_info(fetch_staking_rewards_request, opts)
|
99
|
+
data
|
100
|
+
end
|
101
|
+
|
102
|
+
# Fetch staking rewards
|
103
|
+
# Fetch staking rewards for a list of addresses
|
104
|
+
# @param fetch_staking_rewards_request [FetchStakingRewardsRequest]
|
105
|
+
# @param [Hash] opts the optional parameters
|
106
|
+
# @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.
|
107
|
+
# @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.
|
108
|
+
# @return [Array<(FetchStakingRewards200Response, Integer, Hash)>] FetchStakingRewards200Response data, response status code and response headers
|
109
|
+
def fetch_staking_rewards_with_http_info(fetch_staking_rewards_request, opts = {})
|
110
|
+
if @api_client.config.debugging
|
111
|
+
@api_client.config.logger.debug 'Calling API: StakeApi.fetch_staking_rewards ...'
|
112
|
+
end
|
113
|
+
# verify the required parameter 'fetch_staking_rewards_request' is set
|
114
|
+
if @api_client.config.client_side_validation && fetch_staking_rewards_request.nil?
|
115
|
+
fail ArgumentError, "Missing the required parameter 'fetch_staking_rewards_request' when calling StakeApi.fetch_staking_rewards"
|
116
|
+
end
|
117
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
118
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling StakeApi.fetch_staking_rewards, the character length must be smaller than or equal to 5000.'
|
119
|
+
end
|
120
|
+
|
121
|
+
# resource path
|
122
|
+
local_var_path = '/v1/stake/rewards/search'
|
123
|
+
|
124
|
+
# query parameters
|
125
|
+
query_params = opts[:query_params] || {}
|
126
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
127
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
128
|
+
|
129
|
+
# header parameters
|
130
|
+
header_params = opts[:header_params] || {}
|
131
|
+
# HTTP header 'Accept' (if needed)
|
132
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
133
|
+
# HTTP header 'Content-Type'
|
134
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
135
|
+
if !content_type.nil?
|
136
|
+
header_params['Content-Type'] = content_type
|
137
|
+
end
|
138
|
+
|
139
|
+
# form parameters
|
140
|
+
form_params = opts[:form_params] || {}
|
141
|
+
|
142
|
+
# http body (model)
|
143
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(fetch_staking_rewards_request)
|
144
|
+
|
145
|
+
# return_type
|
146
|
+
return_type = opts[:debug_return_type] || 'FetchStakingRewards200Response'
|
147
|
+
|
148
|
+
# auth_names
|
149
|
+
auth_names = opts[:debug_auth_names] || []
|
150
|
+
|
151
|
+
new_options = opts.merge(
|
152
|
+
:operation => :"StakeApi.fetch_staking_rewards",
|
153
|
+
:header_params => header_params,
|
154
|
+
:query_params => query_params,
|
155
|
+
:form_params => form_params,
|
156
|
+
:body => post_body,
|
157
|
+
:auth_names => auth_names,
|
158
|
+
:return_type => return_type
|
159
|
+
)
|
160
|
+
|
161
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
162
|
+
if @api_client.config.debugging
|
163
|
+
@api_client.config.logger.debug "API called: StakeApi#fetch_staking_rewards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
164
|
+
end
|
165
|
+
return data, status_code, headers
|
166
|
+
end
|
167
|
+
|
168
|
+
# Get staking context
|
169
|
+
# Get staking context for an address
|
170
|
+
# @param get_staking_context_request [GetStakingContextRequest]
|
171
|
+
# @param [Hash] opts the optional parameters
|
172
|
+
# @return [StakingContext]
|
173
|
+
def get_staking_context(get_staking_context_request, opts = {})
|
174
|
+
data, _status_code, _headers = get_staking_context_with_http_info(get_staking_context_request, opts)
|
175
|
+
data
|
176
|
+
end
|
177
|
+
|
178
|
+
# Get staking context
|
179
|
+
# Get staking context for an address
|
180
|
+
# @param get_staking_context_request [GetStakingContextRequest]
|
181
|
+
# @param [Hash] opts the optional parameters
|
182
|
+
# @return [Array<(StakingContext, Integer, Hash)>] StakingContext data, response status code and response headers
|
183
|
+
def get_staking_context_with_http_info(get_staking_context_request, opts = {})
|
184
|
+
if @api_client.config.debugging
|
185
|
+
@api_client.config.logger.debug 'Calling API: StakeApi.get_staking_context ...'
|
186
|
+
end
|
187
|
+
# verify the required parameter 'get_staking_context_request' is set
|
188
|
+
if @api_client.config.client_side_validation && get_staking_context_request.nil?
|
189
|
+
fail ArgumentError, "Missing the required parameter 'get_staking_context_request' when calling StakeApi.get_staking_context"
|
190
|
+
end
|
191
|
+
# resource path
|
192
|
+
local_var_path = '/v1/stake/context'
|
193
|
+
|
194
|
+
# query parameters
|
195
|
+
query_params = opts[:query_params] || {}
|
196
|
+
|
197
|
+
# header parameters
|
198
|
+
header_params = opts[:header_params] || {}
|
199
|
+
# HTTP header 'Accept' (if needed)
|
200
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
201
|
+
# HTTP header 'Content-Type'
|
202
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
203
|
+
if !content_type.nil?
|
204
|
+
header_params['Content-Type'] = content_type
|
205
|
+
end
|
206
|
+
|
207
|
+
# form parameters
|
208
|
+
form_params = opts[:form_params] || {}
|
209
|
+
|
210
|
+
# http body (model)
|
211
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(get_staking_context_request)
|
212
|
+
|
213
|
+
# return_type
|
214
|
+
return_type = opts[:debug_return_type] || 'StakingContext'
|
215
|
+
|
216
|
+
# auth_names
|
217
|
+
auth_names = opts[:debug_auth_names] || []
|
218
|
+
|
219
|
+
new_options = opts.merge(
|
220
|
+
:operation => :"StakeApi.get_staking_context",
|
221
|
+
:header_params => header_params,
|
222
|
+
:query_params => query_params,
|
223
|
+
:form_params => form_params,
|
224
|
+
:body => post_body,
|
225
|
+
:auth_names => auth_names,
|
226
|
+
:return_type => return_type
|
227
|
+
)
|
228
|
+
|
229
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
230
|
+
if @api_client.config.debugging
|
231
|
+
@api_client.config.logger.debug "API called: StakeApi#get_staking_context\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
232
|
+
end
|
233
|
+
return data, status_code, headers
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
@@ -0,0 +1,114 @@
|
|
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 TransferApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Build a new transfer
|
23
|
+
# Build a new transfer object without tracking anything server-side.
|
24
|
+
# @param network_id [String] The ID of the blockchain network
|
25
|
+
# @param address_id [String] The ID of the address to transfer from
|
26
|
+
# @param amount [String] The amount to transfer
|
27
|
+
# @param asset_id [String] The ID of the asset to transfer
|
28
|
+
# @param destination [String] The destination address
|
29
|
+
# @param [Hash] opts the optional parameters
|
30
|
+
# @return [Transfer]
|
31
|
+
def build_transfer(network_id, address_id, amount, asset_id, destination, opts = {})
|
32
|
+
data, _status_code, _headers = build_transfer_with_http_info(network_id, address_id, amount, asset_id, destination, opts)
|
33
|
+
data
|
34
|
+
end
|
35
|
+
|
36
|
+
# Build a new transfer
|
37
|
+
# Build a new transfer object without tracking anything server-side.
|
38
|
+
# @param network_id [String] The ID of the blockchain network
|
39
|
+
# @param address_id [String] The ID of the address to transfer from
|
40
|
+
# @param amount [String] The amount to transfer
|
41
|
+
# @param asset_id [String] The ID of the asset to transfer
|
42
|
+
# @param destination [String] The destination address
|
43
|
+
# @param [Hash] opts the optional parameters
|
44
|
+
# @return [Array<(Transfer, Integer, Hash)>] Transfer data, response status code and response headers
|
45
|
+
def build_transfer_with_http_info(network_id, address_id, amount, asset_id, destination, opts = {})
|
46
|
+
if @api_client.config.debugging
|
47
|
+
@api_client.config.logger.debug 'Calling API: TransferApi.build_transfer ...'
|
48
|
+
end
|
49
|
+
# verify the required parameter 'network_id' is set
|
50
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
51
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling TransferApi.build_transfer"
|
52
|
+
end
|
53
|
+
# verify the required parameter 'address_id' is set
|
54
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
55
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling TransferApi.build_transfer"
|
56
|
+
end
|
57
|
+
# verify the required parameter 'amount' is set
|
58
|
+
if @api_client.config.client_side_validation && amount.nil?
|
59
|
+
fail ArgumentError, "Missing the required parameter 'amount' when calling TransferApi.build_transfer"
|
60
|
+
end
|
61
|
+
# verify the required parameter 'asset_id' is set
|
62
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
63
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling TransferApi.build_transfer"
|
64
|
+
end
|
65
|
+
# verify the required parameter 'destination' is set
|
66
|
+
if @api_client.config.client_side_validation && destination.nil?
|
67
|
+
fail ArgumentError, "Missing the required parameter 'destination' when calling TransferApi.build_transfer"
|
68
|
+
end
|
69
|
+
# resource path
|
70
|
+
local_var_path = '/v1/transfers/build'
|
71
|
+
|
72
|
+
# query parameters
|
73
|
+
query_params = opts[:query_params] || {}
|
74
|
+
query_params[:'network_id'] = network_id
|
75
|
+
query_params[:'address_id'] = address_id
|
76
|
+
query_params[:'amount'] = amount
|
77
|
+
query_params[:'asset_id'] = asset_id
|
78
|
+
query_params[:'destination'] = destination
|
79
|
+
|
80
|
+
# header parameters
|
81
|
+
header_params = opts[:header_params] || {}
|
82
|
+
# HTTP header 'Accept' (if needed)
|
83
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
84
|
+
|
85
|
+
# form parameters
|
86
|
+
form_params = opts[:form_params] || {}
|
87
|
+
|
88
|
+
# http body (model)
|
89
|
+
post_body = opts[:debug_body]
|
90
|
+
|
91
|
+
# return_type
|
92
|
+
return_type = opts[:debug_return_type] || 'Transfer'
|
93
|
+
|
94
|
+
# auth_names
|
95
|
+
auth_names = opts[:debug_auth_names] || []
|
96
|
+
|
97
|
+
new_options = opts.merge(
|
98
|
+
:operation => :"TransferApi.build_transfer",
|
99
|
+
:header_params => header_params,
|
100
|
+
:query_params => query_params,
|
101
|
+
:form_params => form_params,
|
102
|
+
:body => post_body,
|
103
|
+
:auth_names => auth_names,
|
104
|
+
:return_type => return_type
|
105
|
+
)
|
106
|
+
|
107
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
108
|
+
if @api_client.config.debugging
|
109
|
+
@api_client.config.logger.debug "API called: TransferApi#build_transfer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
110
|
+
end
|
111
|
+
return data, status_code, headers
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|