coinbase-sdk 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/coinbase/address/wallet_address.rb +7 -4
- data/lib/coinbase/address.rb +36 -0
- data/lib/coinbase/client/api/addresses_api.rb +1 -1
- data/lib/coinbase/client/api/assets_api.rb +1 -1
- data/lib/coinbase/client/api/contract_events_api.rb +1 -1
- data/lib/coinbase/client/api/external_addresses_api.rb +86 -1
- data/lib/coinbase/client/api/networks_api.rb +85 -0
- data/lib/coinbase/client/api/server_signers_api.rb +1 -1
- data/lib/coinbase/client/api/stake_api.rb +121 -1
- data/lib/coinbase/client/api/trades_api.rb +1 -1
- data/lib/coinbase/client/api/transfers_api.rb +1 -1
- data/lib/coinbase/client/api/users_api.rb +1 -1
- data/lib/coinbase/client/api/validators_api.rb +1 -1
- data/lib/coinbase/client/api/wallets_api.rb +1 -1
- data/lib/coinbase/client/api/webhooks_api.rb +1 -1
- data/lib/coinbase/client/api_client.rb +1 -1
- data/lib/coinbase/client/api_error.rb +1 -1
- data/lib/coinbase/client/configuration.rb +1 -11
- data/lib/coinbase/client/models/address.rb +1 -1
- data/lib/coinbase/client/models/address_balance_list.rb +1 -1
- data/lib/coinbase/client/models/address_historical_balance_list.rb +258 -0
- data/lib/coinbase/client/models/address_list.rb +1 -1
- data/lib/coinbase/client/models/asset.rb +1 -1
- data/lib/coinbase/client/models/balance.rb +1 -1
- data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +1 -1
- data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
- data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
- data/lib/coinbase/client/models/build_staking_operation_request.rb +1 -1
- data/lib/coinbase/client/models/contract_event.rb +1 -1
- data/lib/coinbase/client/models/contract_event_list.rb +1 -1
- data/lib/coinbase/client/models/create_address_request.rb +1 -1
- data/lib/coinbase/client/models/create_server_signer_request.rb +1 -1
- data/lib/coinbase/client/models/create_staking_operation_request.rb +1 -1
- data/lib/coinbase/client/models/create_trade_request.rb +1 -1
- data/lib/coinbase/client/models/create_transfer_request.rb +15 -5
- data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
- data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
- data/lib/coinbase/client/models/create_webhook_request.rb +1 -1
- data/lib/coinbase/client/models/error.rb +1 -1
- data/lib/coinbase/client/models/ethereum_validator.rb +374 -0
- data/lib/coinbase/client/models/ethereum_validator_metadata.rb +1 -1
- data/lib/coinbase/client/models/faucet_transaction.rb +1 -1
- data/lib/coinbase/client/models/feature.rb +1 -1
- 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/fetch_staking_rewards200_response.rb +1 -1
- data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +1 -1
- data/lib/coinbase/client/models/get_staking_context_request.rb +1 -1
- 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/native_eth_staking_context.rb +1 -1
- data/lib/coinbase/client/models/network.rb +355 -0
- data/lib/coinbase/client/models/network_identifier.rb +44 -0
- data/lib/coinbase/client/models/partial_eth_staking_context.rb +1 -1
- data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
- data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
- data/lib/coinbase/client/models/server_signer.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
- data/lib/coinbase/client/models/server_signer_list.rb +1 -1
- data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
- data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
- data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +1 -1
- 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.rb +1 -1
- data/lib/coinbase/client/models/staking_context_context.rb +223 -75
- data/lib/coinbase/client/models/staking_operation.rb +3 -3
- data/lib/coinbase/client/models/staking_operation_metadata.rb +1 -1
- data/lib/coinbase/client/models/staking_reward.rb +23 -7
- data/lib/coinbase/client/models/staking_reward_format.rb +3 -2
- data/lib/coinbase/client/models/staking_reward_usd_value.rb +257 -0
- data/lib/coinbase/client/models/trade.rb +1 -1
- data/lib/coinbase/client/models/trade_list.rb +1 -1
- data/lib/coinbase/client/models/transaction.rb +3 -3
- data/lib/coinbase/client/models/transaction_type.rb +3 -2
- data/lib/coinbase/client/models/transfer.rb +102 -9
- data/lib/coinbase/client/models/transfer_list.rb +1 -1
- data/lib/coinbase/client/models/update_webhook_request.rb +1 -1
- data/lib/coinbase/client/models/user.rb +1 -1
- data/lib/coinbase/client/models/validator.rb +1 -1
- data/lib/coinbase/client/models/validator_details.rb +1 -1
- data/lib/coinbase/client/models/validator_list.rb +1 -1
- data/lib/coinbase/client/models/validator_list_data.rb +216 -0
- data/lib/coinbase/client/models/wallet.rb +14 -17
- data/lib/coinbase/client/models/wallet_list.rb +1 -1
- data/lib/coinbase/client/models/webhook.rb +1 -1
- data/lib/coinbase/client/models/webhook_event_filter.rb +1 -1
- data/lib/coinbase/client/models/webhook_event_type.rb +3 -2
- data/lib/coinbase/client/models/webhook_list.rb +1 -1
- data/lib/coinbase/client/version.rb +1 -1
- data/lib/coinbase/client.rb +11 -4
- data/lib/coinbase/errors.rb +7 -0
- data/lib/coinbase/historical_balance.rb +53 -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_reward.rb +18 -0
- data/lib/coinbase/transaction.rb +7 -3
- data/lib/coinbase/transfer.rb +56 -28
- data/lib/coinbase/wallet/data.rb +31 -0
- data/lib/coinbase/wallet.rb +15 -46
- data/lib/coinbase.rb +15 -3
- metadata +48 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: addb2d81db155719e42cf1c4057498fc8094fcf436e3a67276870b3ff77a2d69
|
|
4
|
+
data.tar.gz: 6e1a0078557be2d0fe83979c66ec9415e77edbef0b6f72ef510d69aaf7580041
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22648511bb07f598908f4b81fc87a8d06279e122b809d21a294e38b48cd54c65490a7c5009ebf6e013baffd8de7fba174017dbe6f75777e489646d9b735c885a
|
|
7
|
+
data.tar.gz: 623ecc923feb473a6a491ae07a536216ac5bf7f5648bf6e9eab8eca956ce88232973d98a376c67a61f71fade05587ba6e07300f7766d7ba3436397fce55ea994
|
|
@@ -39,8 +39,11 @@ module Coinbase
|
|
|
39
39
|
# @param asset_id [Symbol] The ID of the Asset to send. For Ether, :eth, :gwei, and :wei are supported.
|
|
40
40
|
# @param destination [Wallet | Address | String] The destination of the transfer. If a Wallet, sends to the Wallet's
|
|
41
41
|
# default address. If a String, interprets it as the address ID.
|
|
42
|
+
# @param gasless [Boolean] Whether gas fee for the transfer should be covered by Coinbase.
|
|
43
|
+
# Defaults to false. Check the API documentation for network and asset support.
|
|
44
|
+
# Whether the transfer should be gasless. Defaults to false.
|
|
42
45
|
# @return [Coinbase::Transfer] The Transfer object.
|
|
43
|
-
def transfer(amount, asset_id, destination)
|
|
46
|
+
def transfer(amount, asset_id, destination, gasless: false)
|
|
44
47
|
ensure_can_sign!
|
|
45
48
|
ensure_sufficient_balance!(amount, asset_id)
|
|
46
49
|
|
|
@@ -50,14 +53,14 @@ module Coinbase
|
|
|
50
53
|
asset_id: asset_id,
|
|
51
54
|
destination: destination,
|
|
52
55
|
network_id: network_id,
|
|
53
|
-
wallet_id: wallet_id
|
|
56
|
+
wallet_id: wallet_id,
|
|
57
|
+
gasless: gasless
|
|
54
58
|
)
|
|
55
59
|
|
|
56
60
|
# If a server signer is managing keys, it will sign and broadcast the underlying transfer transaction out of band.
|
|
57
61
|
return transfer if Coinbase.use_server_signer?
|
|
58
62
|
|
|
59
|
-
transfer.
|
|
60
|
-
|
|
63
|
+
transfer.sign(@key)
|
|
61
64
|
transfer.broadcast!
|
|
62
65
|
transfer
|
|
63
66
|
end
|
data/lib/coinbase/address.rb
CHANGED
|
@@ -62,6 +62,18 @@ module Coinbase
|
|
|
62
62
|
Coinbase::Balance.from_model_and_asset_id(response, asset_id).amount
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
# Enumerates the historical balances for a given asset belonging of address.
|
|
66
|
+
# The result is an enumerator that lazily fetches from the server, and can be iterated over,
|
|
67
|
+
# converted to an array, etc...
|
|
68
|
+
# @return [Enumerable<Coinbase::HistoricalBalance>] Enumerator that returns historical_balance
|
|
69
|
+
def historical_balances(asset_id)
|
|
70
|
+
Coinbase::Pagination.enumerate(
|
|
71
|
+
->(page) { list_page(asset_id, page) }
|
|
72
|
+
) do |historical_balance|
|
|
73
|
+
Coinbase::HistoricalBalance.from_model(historical_balance)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
65
77
|
# Requests funds for the address from the faucet and returns the faucet transaction.
|
|
66
78
|
# This is only supported on testnet networks.
|
|
67
79
|
# @return [Coinbase::FaucetTransaction] The successful faucet transaction
|
|
@@ -194,6 +206,21 @@ module Coinbase
|
|
|
194
206
|
)
|
|
195
207
|
end
|
|
196
208
|
|
|
209
|
+
# Fetches the historical staking balances for the address.
|
|
210
|
+
# @param asset_id [Symbol] The asset to retrieve staking rewards for
|
|
211
|
+
# @param start_time [Time] The start time for the rewards. Defaults to 1 week ago.
|
|
212
|
+
# @param end_time [Time] The end time for the rewards. Defaults to the current time.
|
|
213
|
+
# @return [Enumerable<Coinbase::StakingBalance>] The staking rewards
|
|
214
|
+
def historical_staking_balances(asset_id, start_time: DateTime.now.prev_week(1), end_time: DateTime.now)
|
|
215
|
+
StakingBalance.list(
|
|
216
|
+
network_id,
|
|
217
|
+
asset_id,
|
|
218
|
+
id,
|
|
219
|
+
start_time: start_time,
|
|
220
|
+
end_time: end_time
|
|
221
|
+
)
|
|
222
|
+
end
|
|
223
|
+
|
|
197
224
|
private
|
|
198
225
|
|
|
199
226
|
def validate_can_perform_staking_action!(amount, asset_id, balance_type, mode, options)
|
|
@@ -208,5 +235,14 @@ module Coinbase
|
|
|
208
235
|
def stake_api
|
|
209
236
|
@stake_api ||= Coinbase::Client::StakeApi.new(Coinbase.configuration.api_client)
|
|
210
237
|
end
|
|
238
|
+
|
|
239
|
+
def list_page(asset_id, page)
|
|
240
|
+
addresses_api.list_address_historical_balance(
|
|
241
|
+
Coinbase.normalize_network(network_id),
|
|
242
|
+
id,
|
|
243
|
+
Coinbase::Asset.primary_denomination(asset_id).to_s,
|
|
244
|
+
{ limit: DEFAULT_PAGE_LIMIT, page: page }
|
|
245
|
+
)
|
|
246
|
+
end
|
|
211
247
|
end
|
|
212
248
|
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
|
7
7
|
Contact: yuga.cohler@coinbase.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.6.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -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
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
|
7
7
|
Contact: yuga.cohler@coinbase.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.6.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -253,6 +253,126 @@ module Coinbase::Client
|
|
|
253
253
|
return data, status_code, headers
|
|
254
254
|
end
|
|
255
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
|
+
|
|
256
376
|
# Fetch staking rewards
|
|
257
377
|
# Fetch staking rewards for a list of addresses
|
|
258
378
|
# @param fetch_staking_rewards_request [FetchStakingRewardsRequest]
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
|
7
7
|
Contact: yuga.cohler@coinbase.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.6.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -79,14 +79,6 @@ module Coinbase::Client
|
|
|
79
79
|
# @return [true, false]
|
|
80
80
|
attr_accessor :debugging
|
|
81
81
|
|
|
82
|
-
# Set this to ignore operation servers for the API client. This is useful when you need to
|
|
83
|
-
# send requests to a different server than the one specified in the OpenAPI document.
|
|
84
|
-
# Will default to the base url defined in the spec but can be overridden by setting
|
|
85
|
-
# `scheme`, `host`, `base_path` directly.
|
|
86
|
-
# Default to false.
|
|
87
|
-
# @return [true, false]
|
|
88
|
-
attr_accessor :ignore_operation_servers
|
|
89
|
-
|
|
90
82
|
# Defines the logger used for debugging.
|
|
91
83
|
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
|
92
84
|
#
|
|
@@ -178,7 +170,6 @@ module Coinbase::Client
|
|
|
178
170
|
@return_binary_data = false
|
|
179
171
|
@params_encoder = nil
|
|
180
172
|
@debugging = false
|
|
181
|
-
@ignore_operation_servers = false
|
|
182
173
|
@inject_format = false
|
|
183
174
|
@force_ending_format = false
|
|
184
175
|
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
|
@@ -213,7 +204,6 @@ module Coinbase::Client
|
|
|
213
204
|
|
|
214
205
|
# Returns base URL for specified operation based on server settings
|
|
215
206
|
def base_url(operation = nil)
|
|
216
|
-
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
|
|
217
207
|
if operation_server_settings.key?(operation) then
|
|
218
208
|
index = server_operation_index.fetch(operation, server_index)
|
|
219
209
|
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|