coinbase-sdk 0.2.0 → 0.5.0
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 +61 -0
- data/lib/coinbase/address.rb +25 -1
- data/lib/coinbase/client/api/addresses_api.rb +238 -8
- data/lib/coinbase/client/api/assets_api.rb +3 -3
- data/lib/coinbase/client/api/balance_history_api.rb +107 -0
- data/lib/coinbase/client/api/contract_events_api.rb +5 -5
- data/lib/coinbase/client/api/contract_invocations_api.rb +342 -0
- data/lib/coinbase/client/api/external_addresses_api.rb +24 -30
- data/lib/coinbase/client/api/networks_api.rb +3 -3
- data/lib/coinbase/client/api/server_signers_api.rb +8 -8
- data/lib/coinbase/client/api/stake_api.rb +7 -7
- data/lib/coinbase/client/api/trades_api.rb +6 -6
- data/lib/coinbase/client/api/transfers_api.rb +6 -6
- data/lib/coinbase/client/api/validators_api.rb +8 -8
- data/lib/coinbase/client/api/wallet_stake_api.rb +5 -5
- data/lib/coinbase/client/api/wallets_api.rb +11 -11
- data/lib/coinbase/client/api/webhooks_api.rb +6 -6
- data/lib/coinbase/client/api_client.rb +31 -25
- data/lib/coinbase/client/api_error.rb +2 -2
- data/lib/coinbase/client/configuration.rb +2 -2
- data/lib/coinbase/client/models/address.rb +2 -2
- data/lib/coinbase/client/models/address_balance_list.rb +2 -2
- data/lib/coinbase/client/models/address_historical_balance_list.rb +2 -2
- data/lib/coinbase/client/models/address_list.rb +2 -2
- data/lib/coinbase/client/models/address_transaction_list.rb +258 -0
- data/lib/coinbase/client/models/asset.rb +2 -2
- data/lib/coinbase/client/models/balance.rb +2 -2
- data/lib/coinbase/client/models/{user.rb → broadcast_contract_invocation_request.rb} +17 -26
- data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +2 -2
- data/lib/coinbase/client/models/broadcast_trade_request.rb +2 -2
- data/lib/coinbase/client/models/broadcast_transfer_request.rb +2 -2
- data/lib/coinbase/client/models/build_staking_operation_request.rb +2 -2
- data/lib/coinbase/client/models/contract_event.rb +2 -2
- data/lib/coinbase/client/models/contract_event_list.rb +2 -2
- data/lib/coinbase/client/models/contract_invocation.rb +368 -0
- data/lib/coinbase/client/models/contract_invocation_list.rb +274 -0
- data/lib/coinbase/client/models/create_address_request.rb +2 -2
- data/lib/coinbase/client/models/create_contract_invocation_request.rb +276 -0
- data/lib/coinbase/client/models/create_payload_signature_request.rb +232 -0
- data/lib/coinbase/client/models/create_server_signer_request.rb +2 -2
- data/lib/coinbase/client/models/create_staking_operation_request.rb +2 -2
- data/lib/coinbase/client/models/create_trade_request.rb +2 -2
- data/lib/coinbase/client/models/create_transfer_request.rb +3 -3
- data/lib/coinbase/client/models/create_wallet_request.rb +2 -2
- data/lib/coinbase/client/models/create_wallet_request_wallet.rb +2 -2
- data/lib/coinbase/client/models/create_webhook_request.rb +30 -6
- data/lib/coinbase/client/models/erc20_transfer_event.rb +336 -0
- data/lib/coinbase/client/models/erc721_transfer_event.rb +336 -0
- data/lib/coinbase/client/models/error.rb +16 -6
- data/lib/coinbase/client/models/ethereum_transaction.rb +389 -0
- data/lib/coinbase/client/models/ethereum_transaction_access.rb +225 -0
- data/lib/coinbase/client/models/ethereum_transaction_access_list.rb +216 -0
- data/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb +378 -0
- data/lib/coinbase/client/models/ethereum_validator_metadata.rb +2 -2
- data/lib/coinbase/client/models/faucet_transaction.rb +2 -2
- data/lib/coinbase/client/models/feature_set.rb +2 -2
- data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +2 -2
- data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +2 -2
- data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +2 -2
- data/lib/coinbase/client/models/get_staking_context_request.rb +2 -2
- data/lib/coinbase/client/models/historical_balance.rb +2 -2
- data/lib/coinbase/client/models/network.rb +4 -4
- data/lib/coinbase/client/models/network_identifier.rb +5 -3
- data/lib/coinbase/client/models/payload_signature.rb +335 -0
- data/lib/coinbase/client/models/payload_signature_list.rb +275 -0
- data/lib/coinbase/client/models/seed_creation_event.rb +2 -2
- data/lib/coinbase/client/models/seed_creation_event_result.rb +2 -2
- data/lib/coinbase/client/models/server_signer.rb +2 -2
- data/lib/coinbase/client/models/server_signer_event.rb +2 -2
- data/lib/coinbase/client/models/server_signer_event_event.rb +2 -2
- data/lib/coinbase/client/models/server_signer_event_list.rb +2 -2
- data/lib/coinbase/client/models/server_signer_list.rb +2 -2
- data/lib/coinbase/client/models/signature_creation_event.rb +2 -2
- data/lib/coinbase/client/models/signature_creation_event_result.rb +2 -2
- data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +2 -2
- data/lib/coinbase/client/models/sponsored_send.rb +2 -2
- data/lib/coinbase/client/models/staking_balance.rb +2 -2
- data/lib/coinbase/client/models/staking_context.rb +2 -2
- data/lib/coinbase/client/models/staking_context_context.rb +2 -2
- data/lib/coinbase/client/models/staking_operation.rb +2 -2
- data/lib/coinbase/client/models/staking_operation_metadata.rb +2 -2
- data/lib/coinbase/client/models/staking_reward.rb +2 -2
- data/lib/coinbase/client/models/staking_reward_format.rb +2 -2
- data/lib/coinbase/client/models/staking_reward_usd_value.rb +2 -2
- data/lib/coinbase/client/models/trade.rb +2 -2
- data/lib/coinbase/client/models/trade_list.rb +2 -2
- data/lib/coinbase/client/models/transaction.rb +37 -8
- data/lib/coinbase/client/models/transaction_content.rb +104 -0
- data/lib/coinbase/client/models/transaction_type.rb +2 -2
- data/lib/coinbase/client/models/transfer.rb +2 -2
- data/lib/coinbase/client/models/transfer_list.rb +2 -2
- data/lib/coinbase/client/models/update_webhook_request.rb +3 -51
- data/lib/coinbase/client/models/validator.rb +2 -2
- data/lib/coinbase/client/models/validator_details.rb +2 -2
- data/lib/coinbase/client/models/validator_list.rb +2 -2
- data/lib/coinbase/client/models/validator_status.rb +2 -2
- data/lib/coinbase/client/models/wallet.rb +2 -2
- data/lib/coinbase/client/models/wallet_list.rb +2 -2
- data/lib/coinbase/client/models/webhook.rb +16 -6
- data/lib/coinbase/client/models/webhook_event_filter.rb +5 -5
- data/lib/coinbase/client/models/webhook_event_type.rb +2 -2
- data/lib/coinbase/client/models/webhook_list.rb +2 -2
- data/lib/coinbase/client/version.rb +2 -2
- data/lib/coinbase/client.rb +19 -4
- data/lib/coinbase/constants.rb +3 -0
- data/lib/coinbase/contract_invocation.rb +259 -0
- data/lib/coinbase/payload_signature.rb +181 -0
- data/lib/coinbase/transaction.rb +21 -0
- data/lib/coinbase/version.rb +1 -1
- data/lib/coinbase/wallet.rb +11 -1
- data/lib/coinbase/webhook.rb +17 -6
- data/lib/coinbase.rb +2 -0
- metadata +21 -5
- data/lib/coinbase/client/api/users_api.rb +0 -79
- data/lib/coinbase/client/models/feature.rb +0 -43
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b34f214c1b2a2802d9e6e08dd9cef8867a2b29636c933496b32e7336d898738a
|
|
4
|
+
data.tar.gz: a9d1dc3bf9e257f7432832ec3c70d165d09cc1c477c0d5ad4f34c54aba8e4e1f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b2fc3edabfb7edd418e8f5be3e25b0701266206cc012bfb56c6e05b2879baac542ab636c21b80ac71d7871e62cf289c43618c6d5e51ec100cdfb9b49777963d
|
|
7
|
+
data.tar.gz: 37fea814fa12745645084442e21e1c443b57d78d24e9b314dc11e6921f590d8b4485b8ea6f774816bf851d8ec70e141ea1240fa9b2fa8f322867eb5a229e7260
|
|
@@ -95,6 +95,59 @@ module Coinbase
|
|
|
95
95
|
trade
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
+
# Invokes a contract method on the specified contract address, with the given ABI and arguments.
|
|
99
|
+
# @param contract_address [String] The address of the contract to invoke.
|
|
100
|
+
# @param abi [Array<Hash>] The ABI of the contract to invoke.
|
|
101
|
+
# @param method [String] The method to invoke on the contract.
|
|
102
|
+
# @param args [Hash] The arguments to pass to the contract method.
|
|
103
|
+
# The keys should be the argument names, and the values should be the argument values.
|
|
104
|
+
# @param amount [Integer, Float, BigDecimal] (Optional) The amount of the native Asset
|
|
105
|
+
# to send to a payable contract method.
|
|
106
|
+
# @param asset_id [Symbol] (Optional) The ID of the Asset to send to a payable contract method.
|
|
107
|
+
# The Asset must be a denomination of the native Asset. For Ethereum, :eth, :gwei, and :wei are supported.
|
|
108
|
+
# @return [Coinbase::ContractInvocation] The contract invocation object.
|
|
109
|
+
def invoke_contract(contract_address:, abi:, method:, args:, amount: nil, asset_id: nil)
|
|
110
|
+
ensure_can_sign!
|
|
111
|
+
ensure_sufficient_balance!(amount, asset_id) if amount && asset_id
|
|
112
|
+
|
|
113
|
+
invocation = ContractInvocation.create(
|
|
114
|
+
address_id: id,
|
|
115
|
+
wallet_id: wallet_id,
|
|
116
|
+
contract_address: contract_address,
|
|
117
|
+
abi: abi,
|
|
118
|
+
method: method,
|
|
119
|
+
args: args,
|
|
120
|
+
amount: amount,
|
|
121
|
+
asset_id: asset_id,
|
|
122
|
+
network: network
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# If a server signer is managing keys, it will sign and broadcast the underlying transaction out of band.
|
|
126
|
+
return invocation if Coinbase.use_server_signer?
|
|
127
|
+
|
|
128
|
+
invocation.sign(@key)
|
|
129
|
+
invocation.broadcast!
|
|
130
|
+
invocation
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Signs the given unsigned payload.
|
|
134
|
+
# @param unsigned_payload [String] The hex-encoded hashed unsigned payload for the Address to sign.
|
|
135
|
+
# @return [Coinbase::PayloadSignature] The payload signature
|
|
136
|
+
def sign_payload(unsigned_payload:)
|
|
137
|
+
ensure_can_sign!
|
|
138
|
+
|
|
139
|
+
unless Coinbase.use_server_signer?
|
|
140
|
+
signature = Eth::Util.prefix_hex(@key.sign(Eth::Util.hex_to_bin(unsigned_payload)))
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
PayloadSignature.create(
|
|
144
|
+
wallet_id: wallet_id,
|
|
145
|
+
address_id: id,
|
|
146
|
+
unsigned_payload: unsigned_payload,
|
|
147
|
+
signature: signature
|
|
148
|
+
)
|
|
149
|
+
end
|
|
150
|
+
|
|
98
151
|
# Stakes the given amount of the given Asset. The stake operation
|
|
99
152
|
# may take a few minutes to complete in the case when infrastructure is spun up.
|
|
100
153
|
# @param amount [Integer, Float, BigDecimal] The amount of the Asset to stake.
|
|
@@ -179,6 +232,14 @@ module Coinbase
|
|
|
179
232
|
Trade.list(wallet_id: wallet_id, address_id: id)
|
|
180
233
|
end
|
|
181
234
|
|
|
235
|
+
# Enumerates the payload signatures associated with the address.
|
|
236
|
+
# The result is an enumerator that lazily fetches from the server, and can be iterated over,
|
|
237
|
+
# converted to an array, etc...
|
|
238
|
+
# @return [Enumerable<Coinbase::PayloadSignature>] Enumerator that returns the address's payload signatures
|
|
239
|
+
def payload_signatures
|
|
240
|
+
PayloadSignature.list(wallet_id: wallet_id, address_id: id)
|
|
241
|
+
end
|
|
242
|
+
|
|
182
243
|
# Returns a String representation of the WalletAddress.
|
|
183
244
|
# @return [String] a String representation of the WalletAddress
|
|
184
245
|
def to_s
|
data/lib/coinbase/address.rb
CHANGED
|
@@ -72,6 +72,18 @@ module Coinbase
|
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
+
# Enumerates the transactions of address.
|
|
76
|
+
# The result is an enumerator that lazily fetches from the server, and can be iterated over,
|
|
77
|
+
# converted to an array, etc...
|
|
78
|
+
# @return [Enumerable<Coinbase::HistoricalBalance>] Enumerator that returns historical_balance
|
|
79
|
+
def transactions
|
|
80
|
+
Coinbase::Pagination.enumerate(
|
|
81
|
+
->(page) { list_transaction_page(page) }
|
|
82
|
+
) do |transaction|
|
|
83
|
+
Coinbase::Transaction.new(transaction)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
75
87
|
# Requests funds for the address from the faucet and returns the faucet transaction.
|
|
76
88
|
# This is only supported on testnet networks.
|
|
77
89
|
# @param asset_id [Symbol] The ID of the Asset to transfer to the wallet.
|
|
@@ -236,17 +248,29 @@ module Coinbase
|
|
|
236
248
|
@addresses_api ||= Coinbase::Client::ExternalAddressesApi.new(Coinbase.configuration.api_client)
|
|
237
249
|
end
|
|
238
250
|
|
|
251
|
+
def balance_history_api
|
|
252
|
+
@balance_history_api ||= Coinbase::Client::BalanceHistoryApi.new(Coinbase.configuration.api_client)
|
|
253
|
+
end
|
|
254
|
+
|
|
239
255
|
def stake_api
|
|
240
256
|
@stake_api ||= Coinbase::Client::StakeApi.new(Coinbase.configuration.api_client)
|
|
241
257
|
end
|
|
242
258
|
|
|
243
259
|
def list_page(asset_id, page)
|
|
244
|
-
|
|
260
|
+
balance_history_api.list_address_historical_balance(
|
|
245
261
|
network.normalized_id,
|
|
246
262
|
id,
|
|
247
263
|
Coinbase::Asset.primary_denomination(asset_id).to_s,
|
|
248
264
|
{ limit: DEFAULT_PAGE_LIMIT, page: page }
|
|
249
265
|
)
|
|
250
266
|
end
|
|
267
|
+
|
|
268
|
+
def list_transaction_page(page)
|
|
269
|
+
addresses_api.list_address_transactions(
|
|
270
|
+
network.normalized_id,
|
|
271
|
+
id,
|
|
272
|
+
{ limit: DEFAULT_TRANSACTION_PAGE_LIMIT, page: page }
|
|
273
|
+
)
|
|
274
|
+
end
|
|
251
275
|
end
|
|
252
276
|
end
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
|
|
5
5
|
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.8.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -53,7 +53,7 @@ module Coinbase::Client
|
|
|
53
53
|
# header parameters
|
|
54
54
|
header_params = opts[:header_params] || {}
|
|
55
55
|
# HTTP header 'Accept' (if needed)
|
|
56
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
57
57
|
# HTTP header 'Content-Type'
|
|
58
58
|
content_type = @api_client.select_header_content_type(['application/json'])
|
|
59
59
|
if !content_type.nil?
|
|
@@ -89,6 +89,82 @@ module Coinbase::Client
|
|
|
89
89
|
return data, status_code, headers
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
+
# Create a new payload signature.
|
|
93
|
+
# Create a new payload signature with an address.
|
|
94
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
|
95
|
+
# @param address_id [String] The onchain address of the address to sign the payload with.
|
|
96
|
+
# @param [Hash] opts the optional parameters
|
|
97
|
+
# @option opts [CreatePayloadSignatureRequest] :create_payload_signature_request
|
|
98
|
+
# @return [PayloadSignature]
|
|
99
|
+
def create_payload_signature(wallet_id, address_id, opts = {})
|
|
100
|
+
data, _status_code, _headers = create_payload_signature_with_http_info(wallet_id, address_id, opts)
|
|
101
|
+
data
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Create a new payload signature.
|
|
105
|
+
# Create a new payload signature with an address.
|
|
106
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
|
107
|
+
# @param address_id [String] The onchain address of the address to sign the payload with.
|
|
108
|
+
# @param [Hash] opts the optional parameters
|
|
109
|
+
# @option opts [CreatePayloadSignatureRequest] :create_payload_signature_request
|
|
110
|
+
# @return [Array<(PayloadSignature, Integer, Hash)>] PayloadSignature data, response status code and response headers
|
|
111
|
+
def create_payload_signature_with_http_info(wallet_id, address_id, opts = {})
|
|
112
|
+
if @api_client.config.debugging
|
|
113
|
+
@api_client.config.logger.debug 'Calling API: AddressesApi.create_payload_signature ...'
|
|
114
|
+
end
|
|
115
|
+
# verify the required parameter 'wallet_id' is set
|
|
116
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
|
117
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling AddressesApi.create_payload_signature"
|
|
118
|
+
end
|
|
119
|
+
# verify the required parameter 'address_id' is set
|
|
120
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
|
121
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling AddressesApi.create_payload_signature"
|
|
122
|
+
end
|
|
123
|
+
# resource path
|
|
124
|
+
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
|
|
125
|
+
|
|
126
|
+
# query parameters
|
|
127
|
+
query_params = opts[:query_params] || {}
|
|
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']) unless header_params['Accept']
|
|
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(opts[:'create_payload_signature_request'])
|
|
144
|
+
|
|
145
|
+
# return_type
|
|
146
|
+
return_type = opts[:debug_return_type] || 'PayloadSignature'
|
|
147
|
+
|
|
148
|
+
# auth_names
|
|
149
|
+
auth_names = opts[:debug_auth_names] || []
|
|
150
|
+
|
|
151
|
+
new_options = opts.merge(
|
|
152
|
+
:operation => :"AddressesApi.create_payload_signature",
|
|
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: AddressesApi#create_payload_signature\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
164
|
+
end
|
|
165
|
+
return data, status_code, headers
|
|
166
|
+
end
|
|
167
|
+
|
|
92
168
|
# Get address by onchain address
|
|
93
169
|
# Get address
|
|
94
170
|
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
|
@@ -127,7 +203,7 @@ module Coinbase::Client
|
|
|
127
203
|
# header parameters
|
|
128
204
|
header_params = opts[:header_params] || {}
|
|
129
205
|
# HTTP header 'Accept' (if needed)
|
|
130
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
206
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
131
207
|
|
|
132
208
|
# form parameters
|
|
133
209
|
form_params = opts[:form_params] || {}
|
|
@@ -202,7 +278,7 @@ module Coinbase::Client
|
|
|
202
278
|
# header parameters
|
|
203
279
|
header_params = opts[:header_params] || {}
|
|
204
280
|
# HTTP header 'Accept' (if needed)
|
|
205
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
281
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
206
282
|
|
|
207
283
|
# form parameters
|
|
208
284
|
form_params = opts[:form_params] || {}
|
|
@@ -233,6 +309,81 @@ module Coinbase::Client
|
|
|
233
309
|
return data, status_code, headers
|
|
234
310
|
end
|
|
235
311
|
|
|
312
|
+
# Get payload signature.
|
|
313
|
+
# Get payload signature.
|
|
314
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
|
315
|
+
# @param address_id [String] The onchain address of the address that signed the payload.
|
|
316
|
+
# @param payload_signature_id [String] The ID of the payload signature to fetch.
|
|
317
|
+
# @param [Hash] opts the optional parameters
|
|
318
|
+
# @return [PayloadSignature]
|
|
319
|
+
def get_payload_signature(wallet_id, address_id, payload_signature_id, opts = {})
|
|
320
|
+
data, _status_code, _headers = get_payload_signature_with_http_info(wallet_id, address_id, payload_signature_id, opts)
|
|
321
|
+
data
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
# Get payload signature.
|
|
325
|
+
# Get payload signature.
|
|
326
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
|
327
|
+
# @param address_id [String] The onchain address of the address that signed the payload.
|
|
328
|
+
# @param payload_signature_id [String] The ID of the payload signature to fetch.
|
|
329
|
+
# @param [Hash] opts the optional parameters
|
|
330
|
+
# @return [Array<(PayloadSignature, Integer, Hash)>] PayloadSignature data, response status code and response headers
|
|
331
|
+
def get_payload_signature_with_http_info(wallet_id, address_id, payload_signature_id, opts = {})
|
|
332
|
+
if @api_client.config.debugging
|
|
333
|
+
@api_client.config.logger.debug 'Calling API: AddressesApi.get_payload_signature ...'
|
|
334
|
+
end
|
|
335
|
+
# verify the required parameter 'wallet_id' is set
|
|
336
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
|
337
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling AddressesApi.get_payload_signature"
|
|
338
|
+
end
|
|
339
|
+
# verify the required parameter 'address_id' is set
|
|
340
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
|
341
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling AddressesApi.get_payload_signature"
|
|
342
|
+
end
|
|
343
|
+
# verify the required parameter 'payload_signature_id' is set
|
|
344
|
+
if @api_client.config.client_side_validation && payload_signature_id.nil?
|
|
345
|
+
fail ArgumentError, "Missing the required parameter 'payload_signature_id' when calling AddressesApi.get_payload_signature"
|
|
346
|
+
end
|
|
347
|
+
# resource path
|
|
348
|
+
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures/{payload_signature_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'payload_signature_id' + '}', CGI.escape(payload_signature_id.to_s))
|
|
349
|
+
|
|
350
|
+
# query parameters
|
|
351
|
+
query_params = opts[:query_params] || {}
|
|
352
|
+
|
|
353
|
+
# header parameters
|
|
354
|
+
header_params = opts[:header_params] || {}
|
|
355
|
+
# HTTP header 'Accept' (if needed)
|
|
356
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
357
|
+
|
|
358
|
+
# form parameters
|
|
359
|
+
form_params = opts[:form_params] || {}
|
|
360
|
+
|
|
361
|
+
# http body (model)
|
|
362
|
+
post_body = opts[:debug_body]
|
|
363
|
+
|
|
364
|
+
# return_type
|
|
365
|
+
return_type = opts[:debug_return_type] || 'PayloadSignature'
|
|
366
|
+
|
|
367
|
+
# auth_names
|
|
368
|
+
auth_names = opts[:debug_auth_names] || []
|
|
369
|
+
|
|
370
|
+
new_options = opts.merge(
|
|
371
|
+
:operation => :"AddressesApi.get_payload_signature",
|
|
372
|
+
:header_params => header_params,
|
|
373
|
+
:query_params => query_params,
|
|
374
|
+
:form_params => form_params,
|
|
375
|
+
:body => post_body,
|
|
376
|
+
:auth_names => auth_names,
|
|
377
|
+
:return_type => return_type
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
381
|
+
if @api_client.config.debugging
|
|
382
|
+
@api_client.config.logger.debug "API called: AddressesApi#get_payload_signature\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
383
|
+
end
|
|
384
|
+
return data, status_code, headers
|
|
385
|
+
end
|
|
386
|
+
|
|
236
387
|
# Get all balances for address
|
|
237
388
|
# Get address balances
|
|
238
389
|
# @param wallet_id [String] The ID of the wallet to fetch the balances for
|
|
@@ -278,7 +429,7 @@ module Coinbase::Client
|
|
|
278
429
|
# header parameters
|
|
279
430
|
header_params = opts[:header_params] || {}
|
|
280
431
|
# HTTP header 'Accept' (if needed)
|
|
281
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
432
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
282
433
|
|
|
283
434
|
# form parameters
|
|
284
435
|
form_params = opts[:form_params] || {}
|
|
@@ -351,7 +502,7 @@ module Coinbase::Client
|
|
|
351
502
|
# header parameters
|
|
352
503
|
header_params = opts[:header_params] || {}
|
|
353
504
|
# HTTP header 'Accept' (if needed)
|
|
354
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
505
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
355
506
|
|
|
356
507
|
# form parameters
|
|
357
508
|
form_params = opts[:form_params] || {}
|
|
@@ -382,6 +533,85 @@ module Coinbase::Client
|
|
|
382
533
|
return data, status_code, headers
|
|
383
534
|
end
|
|
384
535
|
|
|
536
|
+
# List payload signatures for an address.
|
|
537
|
+
# List payload signatures for an address.
|
|
538
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
|
539
|
+
# @param address_id [String] The onchain address of the address whose payload signatures to fetch.
|
|
540
|
+
# @param [Hash] opts the optional parameters
|
|
541
|
+
# @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.
|
|
542
|
+
# @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.
|
|
543
|
+
# @return [PayloadSignatureList]
|
|
544
|
+
def list_payload_signatures(wallet_id, address_id, opts = {})
|
|
545
|
+
data, _status_code, _headers = list_payload_signatures_with_http_info(wallet_id, address_id, opts)
|
|
546
|
+
data
|
|
547
|
+
end
|
|
548
|
+
|
|
549
|
+
# List payload signatures for an address.
|
|
550
|
+
# List payload signatures for an address.
|
|
551
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
|
552
|
+
# @param address_id [String] The onchain address of the address whose payload signatures to fetch.
|
|
553
|
+
# @param [Hash] opts the optional parameters
|
|
554
|
+
# @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.
|
|
555
|
+
# @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.
|
|
556
|
+
# @return [Array<(PayloadSignatureList, Integer, Hash)>] PayloadSignatureList data, response status code and response headers
|
|
557
|
+
def list_payload_signatures_with_http_info(wallet_id, address_id, opts = {})
|
|
558
|
+
if @api_client.config.debugging
|
|
559
|
+
@api_client.config.logger.debug 'Calling API: AddressesApi.list_payload_signatures ...'
|
|
560
|
+
end
|
|
561
|
+
# verify the required parameter 'wallet_id' is set
|
|
562
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
|
563
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling AddressesApi.list_payload_signatures"
|
|
564
|
+
end
|
|
565
|
+
# verify the required parameter 'address_id' is set
|
|
566
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
|
567
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling AddressesApi.list_payload_signatures"
|
|
568
|
+
end
|
|
569
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
|
570
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AddressesApi.list_payload_signatures, the character length must be smaller than or equal to 5000.'
|
|
571
|
+
end
|
|
572
|
+
|
|
573
|
+
# resource path
|
|
574
|
+
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
|
|
575
|
+
|
|
576
|
+
# query parameters
|
|
577
|
+
query_params = opts[:query_params] || {}
|
|
578
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
579
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
580
|
+
|
|
581
|
+
# header parameters
|
|
582
|
+
header_params = opts[:header_params] || {}
|
|
583
|
+
# HTTP header 'Accept' (if needed)
|
|
584
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
585
|
+
|
|
586
|
+
# form parameters
|
|
587
|
+
form_params = opts[:form_params] || {}
|
|
588
|
+
|
|
589
|
+
# http body (model)
|
|
590
|
+
post_body = opts[:debug_body]
|
|
591
|
+
|
|
592
|
+
# return_type
|
|
593
|
+
return_type = opts[:debug_return_type] || 'PayloadSignatureList'
|
|
594
|
+
|
|
595
|
+
# auth_names
|
|
596
|
+
auth_names = opts[:debug_auth_names] || []
|
|
597
|
+
|
|
598
|
+
new_options = opts.merge(
|
|
599
|
+
:operation => :"AddressesApi.list_payload_signatures",
|
|
600
|
+
:header_params => header_params,
|
|
601
|
+
:query_params => query_params,
|
|
602
|
+
:form_params => form_params,
|
|
603
|
+
:body => post_body,
|
|
604
|
+
:auth_names => auth_names,
|
|
605
|
+
:return_type => return_type
|
|
606
|
+
)
|
|
607
|
+
|
|
608
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
609
|
+
if @api_client.config.debugging
|
|
610
|
+
@api_client.config.logger.debug "API called: AddressesApi#list_payload_signatures\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
611
|
+
end
|
|
612
|
+
return data, status_code, headers
|
|
613
|
+
end
|
|
614
|
+
|
|
385
615
|
# Request faucet funds for onchain address.
|
|
386
616
|
# Request faucet funds to be sent to onchain address.
|
|
387
617
|
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
|
@@ -423,7 +653,7 @@ module Coinbase::Client
|
|
|
423
653
|
# header parameters
|
|
424
654
|
header_params = opts[:header_params] || {}
|
|
425
655
|
# HTTP header 'Accept' (if needed)
|
|
426
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
656
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
427
657
|
|
|
428
658
|
# form parameters
|
|
429
659
|
form_params = opts[:form_params] || {}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
|
|
5
5
|
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.8.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -57,7 +57,7 @@ module Coinbase::Client
|
|
|
57
57
|
# header parameters
|
|
58
58
|
header_params = opts[:header_params] || {}
|
|
59
59
|
# HTTP header 'Accept' (if needed)
|
|
60
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
60
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
61
61
|
|
|
62
62
|
# form parameters
|
|
63
63
|
form_params = opts[:form_params] || {}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Coinbase Platform API
|
|
3
|
+
|
|
4
|
+
#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.0.1-alpha
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.8.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Coinbase::Client
|
|
16
|
+
class BalanceHistoryApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Get address balance history for asset
|
|
23
|
+
# List the historical balance of an asset in a specific 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 historical balance for.
|
|
26
|
+
# @param asset_id [String] The symbol of the asset to fetch the historical balance for.
|
|
27
|
+
# @param [Hash] opts the optional parameters
|
|
28
|
+
# @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.
|
|
29
|
+
# @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.
|
|
30
|
+
# @return [AddressHistoricalBalanceList]
|
|
31
|
+
def list_address_historical_balance(network_id, address_id, asset_id, opts = {})
|
|
32
|
+
data, _status_code, _headers = list_address_historical_balance_with_http_info(network_id, address_id, asset_id, opts)
|
|
33
|
+
data
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Get address balance history for asset
|
|
37
|
+
# List the historical balance of an asset in a specific address.
|
|
38
|
+
# @param network_id [String] The ID of the blockchain network
|
|
39
|
+
# @param address_id [String] The ID of the address to fetch the historical balance for.
|
|
40
|
+
# @param asset_id [String] The symbol of the asset to fetch the historical balance for.
|
|
41
|
+
# @param [Hash] opts the optional parameters
|
|
42
|
+
# @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.
|
|
43
|
+
# @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.
|
|
44
|
+
# @return [Array<(AddressHistoricalBalanceList, Integer, Hash)>] AddressHistoricalBalanceList data, response status code and response headers
|
|
45
|
+
def list_address_historical_balance_with_http_info(network_id, address_id, asset_id, opts = {})
|
|
46
|
+
if @api_client.config.debugging
|
|
47
|
+
@api_client.config.logger.debug 'Calling API: BalanceHistoryApi.list_address_historical_balance ...'
|
|
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 BalanceHistoryApi.list_address_historical_balance"
|
|
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 BalanceHistoryApi.list_address_historical_balance"
|
|
56
|
+
end
|
|
57
|
+
# verify the required parameter 'asset_id' is set
|
|
58
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
|
59
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling BalanceHistoryApi.list_address_historical_balance"
|
|
60
|
+
end
|
|
61
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
|
62
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling BalanceHistoryApi.list_address_historical_balance, the character length must be smaller than or equal to 5000.'
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# resource path
|
|
66
|
+
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))
|
|
67
|
+
|
|
68
|
+
# query parameters
|
|
69
|
+
query_params = opts[:query_params] || {}
|
|
70
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
71
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
72
|
+
|
|
73
|
+
# header parameters
|
|
74
|
+
header_params = opts[:header_params] || {}
|
|
75
|
+
# HTTP header 'Accept' (if needed)
|
|
76
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
77
|
+
|
|
78
|
+
# form parameters
|
|
79
|
+
form_params = opts[:form_params] || {}
|
|
80
|
+
|
|
81
|
+
# http body (model)
|
|
82
|
+
post_body = opts[:debug_body]
|
|
83
|
+
|
|
84
|
+
# return_type
|
|
85
|
+
return_type = opts[:debug_return_type] || 'AddressHistoricalBalanceList'
|
|
86
|
+
|
|
87
|
+
# auth_names
|
|
88
|
+
auth_names = opts[:debug_auth_names] || []
|
|
89
|
+
|
|
90
|
+
new_options = opts.merge(
|
|
91
|
+
:operation => :"BalanceHistoryApi.list_address_historical_balance",
|
|
92
|
+
:header_params => header_params,
|
|
93
|
+
:query_params => query_params,
|
|
94
|
+
:form_params => form_params,
|
|
95
|
+
:body => post_body,
|
|
96
|
+
:auth_names => auth_names,
|
|
97
|
+
:return_type => return_type
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
101
|
+
if @api_client.config.debugging
|
|
102
|
+
@api_client.config.logger.debug "API called: BalanceHistoryApi#list_address_historical_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
103
|
+
end
|
|
104
|
+
return data, status_code, headers
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
|
|
5
5
|
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.8.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@ module Coinbase::Client
|
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
|
-
#
|
|
22
|
+
# List contract events
|
|
23
23
|
# Retrieve events for a specific contract
|
|
24
24
|
# @param network_id [String] Unique identifier for the blockchain network
|
|
25
25
|
# @param protocol_name [String] Case-sensitive name of the blockchain protocol
|
|
@@ -36,7 +36,7 @@ module Coinbase::Client
|
|
|
36
36
|
data
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
#
|
|
39
|
+
# List contract events
|
|
40
40
|
# Retrieve events for a specific contract
|
|
41
41
|
# @param network_id [String] Unique identifier for the blockchain network
|
|
42
42
|
# @param protocol_name [String] Case-sensitive name of the blockchain protocol
|
|
@@ -95,7 +95,7 @@ module Coinbase::Client
|
|
|
95
95
|
# header parameters
|
|
96
96
|
header_params = opts[:header_params] || {}
|
|
97
97
|
# HTTP header 'Accept' (if needed)
|
|
98
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
98
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
99
99
|
|
|
100
100
|
# form parameters
|
|
101
101
|
form_params = opts[:form_params] || {}
|