coinbase-sdk 0.0.13 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coinbase/address/external_address.rb +3 -166
- data/lib/coinbase/address/wallet_address.rb +51 -4
- data/lib/coinbase/address.rb +164 -0
- data/lib/coinbase/client/api/assets_api.rb +2 -2
- data/lib/coinbase/client/api/contract_events_api.rb +121 -0
- 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 +361 -0
- data/lib/coinbase/client/api/webhooks_api.rb +286 -0
- data/lib/coinbase/client/models/address_historical_balance_list.rb +258 -0
- data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +239 -0
- data/lib/coinbase/client/models/contract_event.rb +336 -0
- data/lib/coinbase/client/models/contract_event_list.rb +259 -0
- data/lib/coinbase/client/models/create_staking_operation_request.rb +274 -0
- data/lib/coinbase/client/models/create_transfer_request.rb +14 -4
- data/lib/coinbase/client/models/create_webhook_request.rb +282 -0
- data/lib/coinbase/client/models/ethereum_validator.rb +374 -0
- data/lib/coinbase/client/models/feature_set.rb +307 -0
- data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +258 -0
- data/lib/coinbase/client/models/get_validator200_response.rb +221 -0
- data/lib/coinbase/client/models/get_validator200_response_validator.rb +214 -0
- data/lib/coinbase/client/models/historical_balance.rb +273 -0
- data/lib/coinbase/client/models/network.rb +355 -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 +15 -5
- 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 +2 -2
- data/lib/coinbase/client/models/transaction_type.rb +2 -1
- data/lib/coinbase/client/models/transfer.rb +29 -24
- data/lib/coinbase/client/models/update_webhook_request.rb +289 -0
- data/lib/coinbase/client/models/validator_list_data.rb +216 -0
- data/lib/coinbase/client/models/wallet.rb +13 -16
- data/lib/coinbase/client/models/webhook.rb +299 -0
- data/lib/coinbase/client/models/webhook_event_filter.rb +236 -0
- data/lib/coinbase/client/models/webhook_event_type.rb +42 -0
- data/lib/coinbase/client/models/webhook_list.rb +244 -0
- data/lib/coinbase/client.rb +22 -3
- data/lib/coinbase/errors.rb +7 -0
- data/lib/coinbase/historical_balance.rb +53 -0
- data/lib/coinbase/middleware.rb +12 -0
- data/lib/coinbase/server_signer.rb +14 -3
- data/lib/coinbase/sponsored_send.rb +110 -0
- data/lib/coinbase/staking_balance.rb +86 -0
- data/lib/coinbase/staking_operation.rb +106 -5
- data/lib/coinbase/staking_reward.rb +18 -0
- data/lib/coinbase/trade.rb +1 -1
- data/lib/coinbase/transaction.rb +7 -3
- data/lib/coinbase/transfer.rb +56 -29
- data/lib/coinbase/wallet/data.rb +31 -0
- data/lib/coinbase/wallet.rb +91 -46
- data/lib/coinbase.rb +17 -4
- metadata +74 -2
@@ -94,6 +94,91 @@ module Coinbase::Client
|
|
94
94
|
return data, status_code, headers
|
95
95
|
end
|
96
96
|
|
97
|
+
# Get address balance history for asset
|
98
|
+
# List the historical balance of an asset in a specific 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 historical balance for.
|
101
|
+
# @param asset_id [String] The symbol of the asset to fetch the historical balance for.
|
102
|
+
# @param [Hash] opts the optional parameters
|
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 10.
|
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
|
+
# @return [AddressHistoricalBalanceList]
|
106
|
+
def list_address_historical_balance(network_id, address_id, asset_id, opts = {})
|
107
|
+
data, _status_code, _headers = list_address_historical_balance_with_http_info(network_id, address_id, asset_id, opts)
|
108
|
+
data
|
109
|
+
end
|
110
|
+
|
111
|
+
# Get address balance history for asset
|
112
|
+
# List the historical balance of an asset in a specific address.
|
113
|
+
# @param network_id [String] The ID of the blockchain network
|
114
|
+
# @param address_id [String] The ID of the address to fetch the historical balance for.
|
115
|
+
# @param asset_id [String] The symbol of the asset to fetch the historical balance for.
|
116
|
+
# @param [Hash] opts the optional parameters
|
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 10.
|
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
|
+
# @return [Array<(AddressHistoricalBalanceList, Integer, Hash)>] AddressHistoricalBalanceList data, response status code and response headers
|
120
|
+
def list_address_historical_balance_with_http_info(network_id, address_id, asset_id, opts = {})
|
121
|
+
if @api_client.config.debugging
|
122
|
+
@api_client.config.logger.debug 'Calling API: ExternalAddressesApi.list_address_historical_balance ...'
|
123
|
+
end
|
124
|
+
# verify the required parameter 'network_id' is set
|
125
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
126
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling ExternalAddressesApi.list_address_historical_balance"
|
127
|
+
end
|
128
|
+
# verify the required parameter 'address_id' is set
|
129
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
130
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling ExternalAddressesApi.list_address_historical_balance"
|
131
|
+
end
|
132
|
+
# verify the required parameter 'asset_id' is set
|
133
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
134
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling ExternalAddressesApi.list_address_historical_balance"
|
135
|
+
end
|
136
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
137
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ExternalAddressesApi.list_address_historical_balance, the character length must be smaller than or equal to 5000.'
|
138
|
+
end
|
139
|
+
|
140
|
+
# resource path
|
141
|
+
local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/balance_history/{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))
|
142
|
+
|
143
|
+
# query parameters
|
144
|
+
query_params = opts[:query_params] || {}
|
145
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
146
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
147
|
+
|
148
|
+
# header parameters
|
149
|
+
header_params = opts[:header_params] || {}
|
150
|
+
# HTTP header 'Accept' (if needed)
|
151
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
152
|
+
|
153
|
+
# form parameters
|
154
|
+
form_params = opts[:form_params] || {}
|
155
|
+
|
156
|
+
# http body (model)
|
157
|
+
post_body = opts[:debug_body]
|
158
|
+
|
159
|
+
# return_type
|
160
|
+
return_type = opts[:debug_return_type] || 'AddressHistoricalBalanceList'
|
161
|
+
|
162
|
+
# auth_names
|
163
|
+
auth_names = opts[:debug_auth_names] || []
|
164
|
+
|
165
|
+
new_options = opts.merge(
|
166
|
+
:operation => :"ExternalAddressesApi.list_address_historical_balance",
|
167
|
+
:header_params => header_params,
|
168
|
+
:query_params => query_params,
|
169
|
+
:form_params => form_params,
|
170
|
+
:body => post_body,
|
171
|
+
:auth_names => auth_names,
|
172
|
+
:return_type => return_type
|
173
|
+
)
|
174
|
+
|
175
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
176
|
+
if @api_client.config.debugging
|
177
|
+
@api_client.config.logger.debug "API called: ExternalAddressesApi#list_address_historical_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
178
|
+
end
|
179
|
+
return data, status_code, headers
|
180
|
+
end
|
181
|
+
|
97
182
|
# Get the balances of an external address
|
98
183
|
# List all of the balances of an external address
|
99
184
|
# @param network_id [String] The ID of the blockchain network
|
@@ -0,0 +1,85 @@
|
|
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.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module Coinbase::Client
|
16
|
+
class NetworksApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Get network by ID
|
23
|
+
# Get network
|
24
|
+
# @param network_id [String] The ID of the network to fetch.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [Network]
|
27
|
+
def get_network(network_id, opts = {})
|
28
|
+
data, _status_code, _headers = get_network_with_http_info(network_id, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get network by ID
|
33
|
+
# Get network
|
34
|
+
# @param network_id [String] The ID of the network to fetch.
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(Network, Integer, Hash)>] Network data, response status code and response headers
|
37
|
+
def get_network_with_http_info(network_id, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: NetworksApi.get_network ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'network_id' is set
|
42
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling NetworksApi.get_network"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/v1/networks/{network_id}'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s))
|
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
|
+
|
56
|
+
# form parameters
|
57
|
+
form_params = opts[:form_params] || {}
|
58
|
+
|
59
|
+
# http body (model)
|
60
|
+
post_body = opts[:debug_body]
|
61
|
+
|
62
|
+
# return_type
|
63
|
+
return_type = opts[:debug_return_type] || 'Network'
|
64
|
+
|
65
|
+
# auth_names
|
66
|
+
auth_names = opts[:debug_auth_names] || []
|
67
|
+
|
68
|
+
new_options = opts.merge(
|
69
|
+
:operation => :"NetworksApi.get_network",
|
70
|
+
:header_params => header_params,
|
71
|
+
:query_params => query_params,
|
72
|
+
:form_params => form_params,
|
73
|
+
:body => post_body,
|
74
|
+
:auth_names => auth_names,
|
75
|
+
:return_type => return_type
|
76
|
+
)
|
77
|
+
|
78
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
79
|
+
if @api_client.config.debugging
|
80
|
+
@api_client.config.logger.debug "API called: NetworksApi#get_network\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
81
|
+
end
|
82
|
+
return data, status_code, headers
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -19,6 +19,92 @@ 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
|
+
|
22
108
|
# Build a new staking operation
|
23
109
|
# Build a new staking operation
|
24
110
|
# @param build_staking_operation_request [BuildStakingOperationRequest]
|
@@ -87,6 +173,206 @@ module Coinbase::Client
|
|
87
173
|
return data, status_code, headers
|
88
174
|
end
|
89
175
|
|
176
|
+
# Create a new staking operation for an address
|
177
|
+
# Create a new staking operation.
|
178
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
179
|
+
# @param address_id [String] The ID of the address to create the staking operation for.
|
180
|
+
# @param create_staking_operation_request [CreateStakingOperationRequest]
|
181
|
+
# @param [Hash] opts the optional parameters
|
182
|
+
# @return [StakingOperation]
|
183
|
+
def create_staking_operation(wallet_id, address_id, create_staking_operation_request, opts = {})
|
184
|
+
data, _status_code, _headers = create_staking_operation_with_http_info(wallet_id, address_id, create_staking_operation_request, opts)
|
185
|
+
data
|
186
|
+
end
|
187
|
+
|
188
|
+
# Create a new staking operation for an address
|
189
|
+
# Create a new 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 create the staking operation for.
|
192
|
+
# @param create_staking_operation_request [CreateStakingOperationRequest]
|
193
|
+
# @param [Hash] opts the optional parameters
|
194
|
+
# @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers
|
195
|
+
def create_staking_operation_with_http_info(wallet_id, address_id, create_staking_operation_request, opts = {})
|
196
|
+
if @api_client.config.debugging
|
197
|
+
@api_client.config.logger.debug 'Calling API: StakeApi.create_staking_operation ...'
|
198
|
+
end
|
199
|
+
# verify the required parameter 'wallet_id' is set
|
200
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
201
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling StakeApi.create_staking_operation"
|
202
|
+
end
|
203
|
+
# verify the required parameter 'address_id' is set
|
204
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
205
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling StakeApi.create_staking_operation"
|
206
|
+
end
|
207
|
+
# verify the required parameter 'create_staking_operation_request' is set
|
208
|
+
if @api_client.config.client_side_validation && create_staking_operation_request.nil?
|
209
|
+
fail ArgumentError, "Missing the required parameter 'create_staking_operation_request' when calling StakeApi.create_staking_operation"
|
210
|
+
end
|
211
|
+
# resource path
|
212
|
+
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))
|
213
|
+
|
214
|
+
# query parameters
|
215
|
+
query_params = opts[:query_params] || {}
|
216
|
+
|
217
|
+
# header parameters
|
218
|
+
header_params = opts[:header_params] || {}
|
219
|
+
# HTTP header 'Accept' (if needed)
|
220
|
+
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
|
+
|
227
|
+
# form parameters
|
228
|
+
form_params = opts[:form_params] || {}
|
229
|
+
|
230
|
+
# http body (model)
|
231
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_staking_operation_request)
|
232
|
+
|
233
|
+
# return_type
|
234
|
+
return_type = opts[:debug_return_type] || 'StakingOperation'
|
235
|
+
|
236
|
+
# auth_names
|
237
|
+
auth_names = opts[:debug_auth_names] || []
|
238
|
+
|
239
|
+
new_options = opts.merge(
|
240
|
+
:operation => :"StakeApi.create_staking_operation",
|
241
|
+
:header_params => header_params,
|
242
|
+
:query_params => query_params,
|
243
|
+
:form_params => form_params,
|
244
|
+
:body => post_body,
|
245
|
+
:auth_names => auth_names,
|
246
|
+
:return_type => return_type
|
247
|
+
)
|
248
|
+
|
249
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
250
|
+
if @api_client.config.debugging
|
251
|
+
@api_client.config.logger.debug "API called: StakeApi#create_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
252
|
+
end
|
253
|
+
return data, status_code, headers
|
254
|
+
end
|
255
|
+
|
256
|
+
# Fetch historical staking balances
|
257
|
+
# Fetch historical staking balances for given address.
|
258
|
+
# @param network_id [String] The ID of the blockchain network.
|
259
|
+
# @param asset_id [String] The ID of the asset for which the historical staking balances are being fetched.
|
260
|
+
# @param address_id [String] The onchain address for which the historical staking balances are being fetched.
|
261
|
+
# @param start_time [Time] The start time of this historical staking balance period.
|
262
|
+
# @param end_time [Time] The end time of this historical staking balance period.
|
263
|
+
# @param [Hash] opts the optional parameters
|
264
|
+
# @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.
|
265
|
+
# @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.
|
266
|
+
# @return [FetchHistoricalStakingBalances200Response]
|
267
|
+
def fetch_historical_staking_balances(network_id, asset_id, address_id, start_time, end_time, opts = {})
|
268
|
+
data, _status_code, _headers = fetch_historical_staking_balances_with_http_info(network_id, asset_id, address_id, start_time, end_time, opts)
|
269
|
+
data
|
270
|
+
end
|
271
|
+
|
272
|
+
# Fetch historical staking balances
|
273
|
+
# Fetch historical staking balances for given address.
|
274
|
+
# @param network_id [String] The ID of the blockchain network.
|
275
|
+
# @param asset_id [String] The ID of the asset for which the historical staking balances are being fetched.
|
276
|
+
# @param address_id [String] The onchain address for which the historical staking balances are being fetched.
|
277
|
+
# @param start_time [Time] The start time of this historical staking balance period.
|
278
|
+
# @param end_time [Time] The end time of this historical staking balance period.
|
279
|
+
# @param [Hash] opts the optional parameters
|
280
|
+
# @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.
|
281
|
+
# @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.
|
282
|
+
# @return [Array<(FetchHistoricalStakingBalances200Response, Integer, Hash)>] FetchHistoricalStakingBalances200Response data, response status code and response headers
|
283
|
+
def fetch_historical_staking_balances_with_http_info(network_id, asset_id, address_id, start_time, end_time, opts = {})
|
284
|
+
if @api_client.config.debugging
|
285
|
+
@api_client.config.logger.debug 'Calling API: StakeApi.fetch_historical_staking_balances ...'
|
286
|
+
end
|
287
|
+
# verify the required parameter 'network_id' is set
|
288
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
289
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling StakeApi.fetch_historical_staking_balances"
|
290
|
+
end
|
291
|
+
if @api_client.config.client_side_validation && network_id.to_s.length > 5000
|
292
|
+
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.'
|
293
|
+
end
|
294
|
+
|
295
|
+
# verify the required parameter 'asset_id' is set
|
296
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
297
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling StakeApi.fetch_historical_staking_balances"
|
298
|
+
end
|
299
|
+
if @api_client.config.client_side_validation && asset_id.to_s.length > 5000
|
300
|
+
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.'
|
301
|
+
end
|
302
|
+
|
303
|
+
# verify the required parameter 'address_id' is set
|
304
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
305
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling StakeApi.fetch_historical_staking_balances"
|
306
|
+
end
|
307
|
+
if @api_client.config.client_side_validation && address_id.to_s.length > 5000
|
308
|
+
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.'
|
309
|
+
end
|
310
|
+
|
311
|
+
# verify the required parameter 'start_time' is set
|
312
|
+
if @api_client.config.client_side_validation && start_time.nil?
|
313
|
+
fail ArgumentError, "Missing the required parameter 'start_time' when calling StakeApi.fetch_historical_staking_balances"
|
314
|
+
end
|
315
|
+
if @api_client.config.client_side_validation && start_time.to_s.length > 5000
|
316
|
+
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.'
|
317
|
+
end
|
318
|
+
|
319
|
+
# verify the required parameter 'end_time' is set
|
320
|
+
if @api_client.config.client_side_validation && end_time.nil?
|
321
|
+
fail ArgumentError, "Missing the required parameter 'end_time' when calling StakeApi.fetch_historical_staking_balances"
|
322
|
+
end
|
323
|
+
if @api_client.config.client_side_validation && end_time.to_s.length > 5000
|
324
|
+
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.'
|
325
|
+
end
|
326
|
+
|
327
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
328
|
+
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.'
|
329
|
+
end
|
330
|
+
|
331
|
+
# resource path
|
332
|
+
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))
|
333
|
+
|
334
|
+
# query parameters
|
335
|
+
query_params = opts[:query_params] || {}
|
336
|
+
query_params[:'asset_id'] = asset_id
|
337
|
+
query_params[:'start_time'] = start_time
|
338
|
+
query_params[:'end_time'] = end_time
|
339
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
340
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
341
|
+
|
342
|
+
# header parameters
|
343
|
+
header_params = opts[:header_params] || {}
|
344
|
+
# HTTP header 'Accept' (if needed)
|
345
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
346
|
+
|
347
|
+
# form parameters
|
348
|
+
form_params = opts[:form_params] || {}
|
349
|
+
|
350
|
+
# http body (model)
|
351
|
+
post_body = opts[:debug_body]
|
352
|
+
|
353
|
+
# return_type
|
354
|
+
return_type = opts[:debug_return_type] || 'FetchHistoricalStakingBalances200Response'
|
355
|
+
|
356
|
+
# auth_names
|
357
|
+
auth_names = opts[:debug_auth_names] || []
|
358
|
+
|
359
|
+
new_options = opts.merge(
|
360
|
+
:operation => :"StakeApi.fetch_historical_staking_balances",
|
361
|
+
:header_params => header_params,
|
362
|
+
:query_params => query_params,
|
363
|
+
:form_params => form_params,
|
364
|
+
:body => post_body,
|
365
|
+
:auth_names => auth_names,
|
366
|
+
:return_type => return_type
|
367
|
+
)
|
368
|
+
|
369
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
370
|
+
if @api_client.config.debugging
|
371
|
+
@api_client.config.logger.debug "API called: StakeApi#fetch_historical_staking_balances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
372
|
+
end
|
373
|
+
return data, status_code, headers
|
374
|
+
end
|
375
|
+
|
90
376
|
# Fetch staking rewards
|
91
377
|
# Fetch staking rewards for a list of addresses
|
92
378
|
# @param fetch_staking_rewards_request [FetchStakingRewardsRequest]
|
@@ -307,5 +593,80 @@ module Coinbase::Client
|
|
307
593
|
end
|
308
594
|
return data, status_code, headers
|
309
595
|
end
|
596
|
+
|
597
|
+
# Get the latest state of a staking operation
|
598
|
+
# Get the latest state of a staking operation.
|
599
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to
|
600
|
+
# @param address_id [String] The ID of the address to fetch the staking operation for.
|
601
|
+
# @param staking_operation_id [String] The ID of the staking operation.
|
602
|
+
# @param [Hash] opts the optional parameters
|
603
|
+
# @return [StakingOperation]
|
604
|
+
def get_staking_operation(wallet_id, address_id, staking_operation_id, opts = {})
|
605
|
+
data, _status_code, _headers = get_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, opts)
|
606
|
+
data
|
607
|
+
end
|
608
|
+
|
609
|
+
# Get the latest state of a staking operation
|
610
|
+
# Get the latest state of a staking operation.
|
611
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to
|
612
|
+
# @param address_id [String] The ID of the address to fetch the staking operation for.
|
613
|
+
# @param staking_operation_id [String] The ID of the staking operation.
|
614
|
+
# @param [Hash] opts the optional parameters
|
615
|
+
# @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers
|
616
|
+
def get_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, opts = {})
|
617
|
+
if @api_client.config.debugging
|
618
|
+
@api_client.config.logger.debug 'Calling API: StakeApi.get_staking_operation ...'
|
619
|
+
end
|
620
|
+
# verify the required parameter 'wallet_id' is set
|
621
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
622
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling StakeApi.get_staking_operation"
|
623
|
+
end
|
624
|
+
# verify the required parameter 'address_id' is set
|
625
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
626
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling StakeApi.get_staking_operation"
|
627
|
+
end
|
628
|
+
# verify the required parameter 'staking_operation_id' is set
|
629
|
+
if @api_client.config.client_side_validation && staking_operation_id.nil?
|
630
|
+
fail ArgumentError, "Missing the required parameter 'staking_operation_id' when calling StakeApi.get_staking_operation"
|
631
|
+
end
|
632
|
+
# resource path
|
633
|
+
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))
|
634
|
+
|
635
|
+
# query parameters
|
636
|
+
query_params = opts[:query_params] || {}
|
637
|
+
|
638
|
+
# header parameters
|
639
|
+
header_params = opts[:header_params] || {}
|
640
|
+
# HTTP header 'Accept' (if needed)
|
641
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
642
|
+
|
643
|
+
# form parameters
|
644
|
+
form_params = opts[:form_params] || {}
|
645
|
+
|
646
|
+
# http body (model)
|
647
|
+
post_body = opts[:debug_body]
|
648
|
+
|
649
|
+
# return_type
|
650
|
+
return_type = opts[:debug_return_type] || 'StakingOperation'
|
651
|
+
|
652
|
+
# auth_names
|
653
|
+
auth_names = opts[:debug_auth_names] || []
|
654
|
+
|
655
|
+
new_options = opts.merge(
|
656
|
+
:operation => :"StakeApi.get_staking_operation",
|
657
|
+
:header_params => header_params,
|
658
|
+
:query_params => query_params,
|
659
|
+
:form_params => form_params,
|
660
|
+
:body => post_body,
|
661
|
+
:auth_names => auth_names,
|
662
|
+
:return_type => return_type
|
663
|
+
)
|
664
|
+
|
665
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
666
|
+
if @api_client.config.debugging
|
667
|
+
@api_client.config.logger.debug "API called: StakeApi#get_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
668
|
+
end
|
669
|
+
return data, status_code, headers
|
670
|
+
end
|
310
671
|
end
|
311
672
|
end
|