coinbase-sdk 0.0.9 → 0.0.10
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/external_address.rb +4 -4
- data/lib/coinbase/client/api/stake_api.rb +75 -0
- data/lib/coinbase/client/api/validators_api.rb +179 -0
- data/lib/coinbase/client/models/create_server_signer_request.rb +2 -9
- data/lib/coinbase/client/models/ethereum_validator_metadata.rb +357 -0
- data/lib/coinbase/client/models/native_eth_staking_context.rb +254 -0
- data/lib/coinbase/client/models/partial_eth_staking_context.rb +1 -1
- data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +257 -0
- data/lib/coinbase/client/models/staking_context_context.rb +1 -0
- data/lib/coinbase/client/models/staking_operation.rb +116 -5
- data/lib/coinbase/client/models/staking_operation_metadata.rb +104 -0
- data/lib/coinbase/client/models/staking_reward.rb +3 -3
- data/lib/coinbase/client/models/transaction.rb +2 -2
- data/lib/coinbase/client/models/validator.rb +283 -0
- data/lib/coinbase/client/models/validator_details.rb +104 -0
- data/lib/coinbase/client/models/validator_list.rb +258 -0
- data/lib/coinbase/client.rb +8 -0
- data/lib/coinbase/staking_operation.rb +100 -4
- data/lib/coinbase/staking_reward.rb +7 -1
- data/lib/coinbase/validator.rb +82 -0
- data/lib/coinbase.rb +1 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20237f97b110d59cc508ab2bf8d12c50e03de8c99722caf7c8afc0b44ae14d6f
|
4
|
+
data.tar.gz: a94842743529bd1171179dbbe690034fcd04911fe16046c27b48b4aae2354a30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9affa919b3835243affb7ada3935280c4249348082055e79d598ff04b3df65979401078bebadbbd3c1e0ab32499a6eb00acb82221654c2f6a7e9474653436b7
|
7
|
+
data.tar.gz: aa868c4e37d612a0727f05826ec2275f434f23ecccb6edffab13e553b1c1bafec1573793fe6a983c5c9572a21fdbcdae778e83de7907472109d6861c0a101a04
|
@@ -44,7 +44,7 @@ module Coinbase
|
|
44
44
|
build_staking_operation(amount, asset_id, 'claim_stake', mode: mode, options: options)
|
45
45
|
end
|
46
46
|
|
47
|
-
#
|
47
|
+
# Retrieves the balances used for staking for the supplied asset.
|
48
48
|
# @param asset_id [Symbol] The asset to retrieve staking balances for
|
49
49
|
# @param mode [Symbol] The staking mode. Defaults to :default.
|
50
50
|
# @param options [Hash] Additional options for the staking operation
|
@@ -82,7 +82,7 @@ module Coinbase
|
|
82
82
|
}
|
83
83
|
end
|
84
84
|
|
85
|
-
#
|
85
|
+
# Retrieves the stakeable balance for the supplied asset.
|
86
86
|
# @param asset_id [Symbol] The asset to retrieve the stakeable balance for
|
87
87
|
# @param mode [Symbol] The staking mode. Defaults to :default.
|
88
88
|
# @param options [Hash] Additional options for the staking operation
|
@@ -91,7 +91,7 @@ module Coinbase
|
|
91
91
|
staking_balances(asset_id, mode: mode, options: options)[:stakeable_balance]
|
92
92
|
end
|
93
93
|
|
94
|
-
#
|
94
|
+
# Retrieves the unstakeable balance for the supplied asset.
|
95
95
|
# @param asset_id [Symbol] The asset to retrieve the unstakeable balance for
|
96
96
|
# @param mode [Symbol] The staking mode. Defaults to :default.
|
97
97
|
# @param options [Hash] Additional options for the staking operation
|
@@ -100,7 +100,7 @@ module Coinbase
|
|
100
100
|
staking_balances(asset_id, mode: mode, options: options)[:unstakeable_balance]
|
101
101
|
end
|
102
102
|
|
103
|
-
#
|
103
|
+
# Retrieves the claimable balance for the supplied asset.
|
104
104
|
# @param asset_id [Symbol] The asset to retrieve the claimable balance for
|
105
105
|
# @param mode [Symbol] The staking mode. Defaults to :default.
|
106
106
|
# @param options [Hash] Additional options for the staking operation
|
@@ -165,6 +165,81 @@ module Coinbase::Client
|
|
165
165
|
return data, status_code, headers
|
166
166
|
end
|
167
167
|
|
168
|
+
# Get the latest state of a staking operation
|
169
|
+
# Get the latest state of a staking operation
|
170
|
+
# @param network_id [String] The ID of the blockchain network
|
171
|
+
# @param address_id [String] The ID of the address to fetch the staking operation for
|
172
|
+
# @param staking_operation_id [String] The ID of the staking operation
|
173
|
+
# @param [Hash] opts the optional parameters
|
174
|
+
# @return [StakingOperation]
|
175
|
+
def get_external_staking_operation(network_id, address_id, staking_operation_id, opts = {})
|
176
|
+
data, _status_code, _headers = get_external_staking_operation_with_http_info(network_id, address_id, staking_operation_id, opts)
|
177
|
+
data
|
178
|
+
end
|
179
|
+
|
180
|
+
# Get the latest state of a staking operation
|
181
|
+
# Get the latest state of a staking operation
|
182
|
+
# @param network_id [String] The ID of the blockchain network
|
183
|
+
# @param address_id [String] The ID of the address to fetch the staking operation for
|
184
|
+
# @param staking_operation_id [String] The ID of the staking operation
|
185
|
+
# @param [Hash] opts the optional parameters
|
186
|
+
# @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers
|
187
|
+
def get_external_staking_operation_with_http_info(network_id, address_id, staking_operation_id, opts = {})
|
188
|
+
if @api_client.config.debugging
|
189
|
+
@api_client.config.logger.debug 'Calling API: StakeApi.get_external_staking_operation ...'
|
190
|
+
end
|
191
|
+
# verify the required parameter 'network_id' is set
|
192
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
193
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling StakeApi.get_external_staking_operation"
|
194
|
+
end
|
195
|
+
# verify the required parameter 'address_id' is set
|
196
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
197
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling StakeApi.get_external_staking_operation"
|
198
|
+
end
|
199
|
+
# verify the required parameter 'staking_operation_id' is set
|
200
|
+
if @api_client.config.client_side_validation && staking_operation_id.nil?
|
201
|
+
fail ArgumentError, "Missing the required parameter 'staking_operation_id' when calling StakeApi.get_external_staking_operation"
|
202
|
+
end
|
203
|
+
# resource path
|
204
|
+
local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/staking_operations/{staking_operation_id}'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'staking_operation_id' + '}', CGI.escape(staking_operation_id.to_s))
|
205
|
+
|
206
|
+
# query parameters
|
207
|
+
query_params = opts[:query_params] || {}
|
208
|
+
|
209
|
+
# header parameters
|
210
|
+
header_params = opts[:header_params] || {}
|
211
|
+
# HTTP header 'Accept' (if needed)
|
212
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
213
|
+
|
214
|
+
# form parameters
|
215
|
+
form_params = opts[:form_params] || {}
|
216
|
+
|
217
|
+
# http body (model)
|
218
|
+
post_body = opts[:debug_body]
|
219
|
+
|
220
|
+
# return_type
|
221
|
+
return_type = opts[:debug_return_type] || 'StakingOperation'
|
222
|
+
|
223
|
+
# auth_names
|
224
|
+
auth_names = opts[:debug_auth_names] || []
|
225
|
+
|
226
|
+
new_options = opts.merge(
|
227
|
+
:operation => :"StakeApi.get_external_staking_operation",
|
228
|
+
:header_params => header_params,
|
229
|
+
:query_params => query_params,
|
230
|
+
:form_params => form_params,
|
231
|
+
:body => post_body,
|
232
|
+
:auth_names => auth_names,
|
233
|
+
:return_type => return_type
|
234
|
+
)
|
235
|
+
|
236
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
237
|
+
if @api_client.config.debugging
|
238
|
+
@api_client.config.logger.debug "API called: StakeApi#get_external_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
239
|
+
end
|
240
|
+
return data, status_code, headers
|
241
|
+
end
|
242
|
+
|
168
243
|
# Get staking context
|
169
244
|
# Get staking context for an address
|
170
245
|
# @param get_staking_context_request [GetStakingContextRequest]
|
@@ -0,0 +1,179 @@
|
|
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 ValidatorsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Get a validator belonging to the CDP project
|
23
|
+
# Get a validator belonging to the user for a given network, asset and id.
|
24
|
+
# @param network_id [String] The ID of the blockchain network.
|
25
|
+
# @param asset_id [String] The symbol of the asset to get the validator for.
|
26
|
+
# @param validator_id [String] The unique id of the validator to fetch details for.
|
27
|
+
# @param [Hash] opts the optional parameters
|
28
|
+
# @return [Validator]
|
29
|
+
def get_validator(network_id, asset_id, validator_id, opts = {})
|
30
|
+
data, _status_code, _headers = get_validator_with_http_info(network_id, asset_id, validator_id, opts)
|
31
|
+
data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Get a validator belonging to the CDP project
|
35
|
+
# Get a validator belonging to the user for a given network, asset and id.
|
36
|
+
# @param network_id [String] The ID of the blockchain network.
|
37
|
+
# @param asset_id [String] The symbol of the asset to get the validator for.
|
38
|
+
# @param validator_id [String] The unique id of the validator to fetch details for.
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [Array<(Validator, Integer, Hash)>] Validator data, response status code and response headers
|
41
|
+
def get_validator_with_http_info(network_id, asset_id, validator_id, opts = {})
|
42
|
+
if @api_client.config.debugging
|
43
|
+
@api_client.config.logger.debug 'Calling API: ValidatorsApi.get_validator ...'
|
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 ValidatorsApi.get_validator"
|
48
|
+
end
|
49
|
+
# verify the required parameter 'asset_id' is set
|
50
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
51
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling ValidatorsApi.get_validator"
|
52
|
+
end
|
53
|
+
# verify the required parameter 'validator_id' is set
|
54
|
+
if @api_client.config.client_side_validation && validator_id.nil?
|
55
|
+
fail ArgumentError, "Missing the required parameter 'validator_id' when calling ValidatorsApi.get_validator"
|
56
|
+
end
|
57
|
+
# resource path
|
58
|
+
local_var_path = '/v1/networks/{network_id}/assets/{asset_id}/validators/{validator_id}'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_id.to_s)).sub('{' + 'validator_id' + '}', CGI.escape(validator_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] || 'Validator'
|
76
|
+
|
77
|
+
# auth_names
|
78
|
+
auth_names = opts[:debug_auth_names] || []
|
79
|
+
|
80
|
+
new_options = opts.merge(
|
81
|
+
:operation => :"ValidatorsApi.get_validator",
|
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: ValidatorsApi#get_validator\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
93
|
+
end
|
94
|
+
return data, status_code, headers
|
95
|
+
end
|
96
|
+
|
97
|
+
# List validators belonging to the CDP project
|
98
|
+
# List validators belonging to the user for a given network and asset.
|
99
|
+
# @param network_id [String] The ID of the blockchain network.
|
100
|
+
# @param asset_id [String] The symbol of the asset to get the validators for.
|
101
|
+
# @param [Hash] opts the optional parameters
|
102
|
+
# @option opts [String] :status A filter to list validators based on a status.
|
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 50.
|
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 [ValidatorList]
|
106
|
+
def list_validators(network_id, asset_id, opts = {})
|
107
|
+
data, _status_code, _headers = list_validators_with_http_info(network_id, asset_id, opts)
|
108
|
+
data
|
109
|
+
end
|
110
|
+
|
111
|
+
# List validators belonging to the CDP project
|
112
|
+
# List validators belonging to the user for a given network and asset.
|
113
|
+
# @param network_id [String] The ID of the blockchain network.
|
114
|
+
# @param asset_id [String] The symbol of the asset to get the validators for.
|
115
|
+
# @param [Hash] opts the optional parameters
|
116
|
+
# @option opts [String] :status A filter to list validators based on a status.
|
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 50.
|
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<(ValidatorList, Integer, Hash)>] ValidatorList data, response status code and response headers
|
120
|
+
def list_validators_with_http_info(network_id, asset_id, opts = {})
|
121
|
+
if @api_client.config.debugging
|
122
|
+
@api_client.config.logger.debug 'Calling API: ValidatorsApi.list_validators ...'
|
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 ValidatorsApi.list_validators"
|
127
|
+
end
|
128
|
+
# verify the required parameter 'asset_id' is set
|
129
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
130
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling ValidatorsApi.list_validators"
|
131
|
+
end
|
132
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
133
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ValidatorsApi.list_validators, the character length must be smaller than or equal to 5000.'
|
134
|
+
end
|
135
|
+
|
136
|
+
# resource path
|
137
|
+
local_var_path = '/v1/networks/{network_id}/assets/{asset_id}/validators'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_id.to_s))
|
138
|
+
|
139
|
+
# query parameters
|
140
|
+
query_params = opts[:query_params] || {}
|
141
|
+
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
142
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
143
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
144
|
+
|
145
|
+
# header parameters
|
146
|
+
header_params = opts[:header_params] || {}
|
147
|
+
# HTTP header 'Accept' (if needed)
|
148
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
149
|
+
|
150
|
+
# form parameters
|
151
|
+
form_params = opts[:form_params] || {}
|
152
|
+
|
153
|
+
# http body (model)
|
154
|
+
post_body = opts[:debug_body]
|
155
|
+
|
156
|
+
# return_type
|
157
|
+
return_type = opts[:debug_return_type] || 'ValidatorList'
|
158
|
+
|
159
|
+
# auth_names
|
160
|
+
auth_names = opts[:debug_auth_names] || []
|
161
|
+
|
162
|
+
new_options = opts.merge(
|
163
|
+
:operation => :"ValidatorsApi.list_validators",
|
164
|
+
:header_params => header_params,
|
165
|
+
:query_params => query_params,
|
166
|
+
:form_params => form_params,
|
167
|
+
:body => post_body,
|
168
|
+
:auth_names => auth_names,
|
169
|
+
:return_type => return_type
|
170
|
+
)
|
171
|
+
|
172
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
173
|
+
if @api_client.config.debugging
|
174
|
+
@api_client.config.logger.debug "API called: ValidatorsApi#list_validators\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
175
|
+
end
|
176
|
+
return data, status_code, headers
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -15,10 +15,10 @@ require 'time'
|
|
15
15
|
|
16
16
|
module Coinbase::Client
|
17
17
|
class CreateServerSignerRequest
|
18
|
-
# The ID of the server signer
|
18
|
+
# The ID of the server signer for the 1 of 1 server signer.
|
19
19
|
attr_accessor :server_signer_id
|
20
20
|
|
21
|
-
# The enrollment data of the server signer. This will be the base64 encoded server-signer-id.
|
21
|
+
# The enrollment data of the server signer. This will be the base64 encoded server-signer-id for the 1 of 1 server signer.
|
22
22
|
attr_accessor :enrollment_data
|
23
23
|
|
24
24
|
# Whether the Server-Signer uses MPC.
|
@@ -70,8 +70,6 @@ module Coinbase::Client
|
|
70
70
|
|
71
71
|
if attributes.key?(:'server_signer_id')
|
72
72
|
self.server_signer_id = attributes[:'server_signer_id']
|
73
|
-
else
|
74
|
-
self.server_signer_id = nil
|
75
73
|
end
|
76
74
|
|
77
75
|
if attributes.key?(:'enrollment_data')
|
@@ -92,10 +90,6 @@ module Coinbase::Client
|
|
92
90
|
def list_invalid_properties
|
93
91
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
94
92
|
invalid_properties = Array.new
|
95
|
-
if @server_signer_id.nil?
|
96
|
-
invalid_properties.push('invalid value for "server_signer_id", server_signer_id cannot be nil.')
|
97
|
-
end
|
98
|
-
|
99
93
|
if @enrollment_data.nil?
|
100
94
|
invalid_properties.push('invalid value for "enrollment_data", enrollment_data cannot be nil.')
|
101
95
|
end
|
@@ -111,7 +105,6 @@ module Coinbase::Client
|
|
111
105
|
# @return true if the model is valid
|
112
106
|
def valid?
|
113
107
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
114
|
-
return false if @server_signer_id.nil?
|
115
108
|
return false if @enrollment_data.nil?
|
116
109
|
return false if @is_mpc.nil?
|
117
110
|
true
|