coinbase-sdk 0.7.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/wallet_address.rb +28 -0
  3. data/lib/coinbase/address.rb +8 -3
  4. data/lib/coinbase/balance.rb +1 -1
  5. data/lib/coinbase/client/api/addresses_api.rb +1 -1
  6. data/lib/coinbase/client/api/assets_api.rb +1 -1
  7. data/lib/coinbase/client/api/balance_history_api.rb +1 -1
  8. data/lib/coinbase/client/api/contract_events_api.rb +1 -1
  9. data/lib/coinbase/client/api/contract_invocations_api.rb +1 -1
  10. data/lib/coinbase/client/api/external_addresses_api.rb +79 -1
  11. data/lib/coinbase/client/api/fund_api.rb +336 -0
  12. data/lib/coinbase/client/api/{wallet_stake_api.rb → mpc_wallet_stake_api.rb} +21 -21
  13. data/lib/coinbase/client/api/networks_api.rb +1 -1
  14. data/lib/coinbase/client/api/onchain_identity_api.rb +108 -0
  15. data/lib/coinbase/client/api/reputation_api.rb +160 -0
  16. data/lib/coinbase/client/api/server_signers_api.rb +1 -1
  17. data/lib/coinbase/client/api/smart_contracts_api.rb +81 -1
  18. data/lib/coinbase/client/api/stake_api.rb +158 -1
  19. data/lib/coinbase/client/api/trades_api.rb +1 -1
  20. data/lib/coinbase/client/api/transaction_history_api.rb +1 -1
  21. data/lib/coinbase/client/api/transfers_api.rb +1 -1
  22. data/lib/coinbase/client/api/users_api.rb +1 -1
  23. data/lib/coinbase/client/api/wallets_api.rb +1 -1
  24. data/lib/coinbase/client/api/webhooks_api.rb +6 -6
  25. data/lib/coinbase/client/api_client.rb +1 -1
  26. data/lib/coinbase/client/api_error.rb +1 -1
  27. data/lib/coinbase/client/configuration.rb +1 -1
  28. data/lib/coinbase/client/models/address.rb +1 -1
  29. data/lib/coinbase/client/models/address_balance_list.rb +1 -1
  30. data/lib/coinbase/client/models/address_historical_balance_list.rb +1 -1
  31. data/lib/coinbase/client/models/address_list.rb +1 -1
  32. data/lib/coinbase/client/models/address_reputation.rb +232 -0
  33. data/lib/coinbase/client/models/address_reputation_metadata.rb +376 -0
  34. data/lib/coinbase/client/models/address_risk.rb +223 -0
  35. data/lib/coinbase/client/models/address_transaction_list.rb +1 -1
  36. data/lib/coinbase/client/models/asset.rb +1 -1
  37. data/lib/coinbase/client/models/balance.rb +1 -1
  38. data/lib/coinbase/client/models/broadcast_contract_invocation_request.rb +1 -1
  39. data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +1 -1
  40. data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
  41. data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
  42. data/lib/coinbase/client/models/build_staking_operation_request.rb +2 -1
  43. data/lib/coinbase/client/models/contract_event.rb +1 -1
  44. data/lib/coinbase/client/models/contract_event_list.rb +1 -1
  45. data/lib/coinbase/client/models/contract_invocation.rb +1 -1
  46. data/lib/coinbase/client/models/contract_invocation_list.rb +1 -1
  47. data/lib/coinbase/client/models/create_address_request.rb +1 -1
  48. data/lib/coinbase/client/models/create_contract_invocation_request.rb +1 -1
  49. data/lib/coinbase/client/models/create_fund_operation_request.rb +249 -0
  50. data/lib/coinbase/client/models/create_fund_quote_request.rb +239 -0
  51. data/lib/coinbase/client/models/create_payload_signature_request.rb +1 -1
  52. data/lib/coinbase/client/models/create_server_signer_request.rb +1 -1
  53. data/lib/coinbase/client/models/create_smart_contract_request.rb +1 -1
  54. data/lib/coinbase/client/models/create_staking_operation_request.rb +2 -1
  55. data/lib/coinbase/client/models/create_trade_request.rb +1 -1
  56. data/lib/coinbase/client/models/create_transfer_request.rb +1 -1
  57. data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
  58. data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
  59. data/lib/coinbase/client/models/create_wallet_webhook_request.rb +2 -2
  60. data/lib/coinbase/client/models/create_webhook_request.rb +1 -1
  61. data/lib/coinbase/client/models/crypto_amount.rb +239 -0
  62. data/lib/coinbase/client/models/deploy_smart_contract_request.rb +1 -1
  63. data/lib/coinbase/client/models/erc20_transfer_event.rb +1 -1
  64. data/lib/coinbase/client/models/erc721_transfer_event.rb +1 -1
  65. data/lib/coinbase/client/models/error.rb +1 -1
  66. data/lib/coinbase/client/models/ethereum_token_transfer.rb +327 -0
  67. data/lib/coinbase/client/models/ethereum_transaction.rb +13 -2
  68. data/lib/coinbase/client/models/ethereum_transaction_access.rb +1 -1
  69. data/lib/coinbase/client/models/ethereum_transaction_access_list.rb +1 -1
  70. data/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb +1 -1
  71. data/lib/coinbase/client/models/ethereum_validator_metadata.rb +1 -1
  72. data/lib/coinbase/client/models/faucet_transaction.rb +21 -5
  73. data/lib/coinbase/client/models/feature_set.rb +1 -1
  74. data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +1 -1
  75. data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +1 -1
  76. data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +1 -1
  77. data/lib/coinbase/client/models/fiat_amount.rb +240 -0
  78. data/lib/coinbase/client/models/fund_operation.rb +373 -0
  79. data/lib/coinbase/client/models/fund_operation_fees.rb +238 -0
  80. data/lib/coinbase/client/models/fund_operation_list.rb +275 -0
  81. data/lib/coinbase/client/models/fund_quote.rb +339 -0
  82. data/lib/coinbase/client/models/get_staking_context_request.rb +2 -1
  83. data/lib/coinbase/client/models/historical_balance.rb +1 -1
  84. data/lib/coinbase/client/models/multi_token_contract_options.rb +1 -1
  85. data/lib/coinbase/client/models/network.rb +1 -1
  86. data/lib/coinbase/client/models/network_identifier.rb +1 -1
  87. data/lib/coinbase/client/models/nft_contract_options.rb +1 -1
  88. data/lib/coinbase/client/models/onchain_name.rb +357 -0
  89. data/lib/coinbase/client/models/onchain_name_list.rb +262 -0
  90. data/lib/coinbase/client/models/payload_signature.rb +1 -1
  91. data/lib/coinbase/client/models/payload_signature_list.rb +1 -1
  92. data/lib/coinbase/client/models/read_contract_request.rb +249 -0
  93. data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
  94. data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
  95. data/lib/coinbase/client/models/server_signer.rb +1 -1
  96. data/lib/coinbase/client/models/server_signer_event.rb +1 -1
  97. data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
  98. data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
  99. data/lib/coinbase/client/models/server_signer_list.rb +1 -1
  100. data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
  101. data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
  102. data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +1 -1
  103. data/lib/coinbase/client/models/smart_contract.rb +1 -1
  104. data/lib/coinbase/client/models/smart_contract_list.rb +1 -1
  105. data/lib/coinbase/client/models/smart_contract_options.rb +1 -1
  106. data/lib/coinbase/client/models/smart_contract_type.rb +1 -1
  107. data/lib/coinbase/client/models/solidity_value.rb +287 -0
  108. data/lib/coinbase/client/models/sponsored_send.rb +1 -1
  109. data/lib/coinbase/client/models/staking_balance.rb +1 -1
  110. data/lib/coinbase/client/models/staking_context.rb +1 -1
  111. data/lib/coinbase/client/models/staking_context_context.rb +1 -1
  112. data/lib/coinbase/client/models/staking_operation.rb +1 -1
  113. data/lib/coinbase/client/models/staking_operation_metadata.rb +1 -1
  114. data/lib/coinbase/client/models/staking_reward.rb +1 -1
  115. data/lib/coinbase/client/models/staking_reward_format.rb +1 -1
  116. data/lib/coinbase/client/models/staking_reward_usd_value.rb +1 -1
  117. data/lib/coinbase/client/models/token_contract_options.rb +1 -1
  118. data/lib/coinbase/client/models/token_transfer_type.rb +43 -0
  119. data/lib/coinbase/client/models/trade.rb +1 -1
  120. data/lib/coinbase/client/models/trade_list.rb +1 -1
  121. data/lib/coinbase/client/models/transaction.rb +1 -1
  122. data/lib/coinbase/client/models/transaction_content.rb +1 -1
  123. data/lib/coinbase/client/models/transaction_type.rb +1 -1
  124. data/lib/coinbase/client/models/transfer.rb +1 -1
  125. data/lib/coinbase/client/models/transfer_list.rb +1 -1
  126. data/lib/coinbase/client/models/update_webhook_request.rb +1 -8
  127. data/lib/coinbase/client/models/user.rb +1 -1
  128. data/lib/coinbase/client/models/validator.rb +1 -1
  129. data/lib/coinbase/client/models/validator_details.rb +1 -1
  130. data/lib/coinbase/client/models/validator_list.rb +1 -1
  131. data/lib/coinbase/client/models/validator_status.rb +1 -1
  132. data/lib/coinbase/client/models/wallet.rb +1 -1
  133. data/lib/coinbase/client/models/wallet_list.rb +1 -1
  134. data/lib/coinbase/client/models/webhook.rb +1 -1
  135. data/lib/coinbase/client/models/webhook_event_filter.rb +1 -1
  136. data/lib/coinbase/client/models/webhook_event_type.rb +1 -1
  137. data/lib/coinbase/client/models/webhook_event_type_filter.rb +1 -1
  138. data/lib/coinbase/client/models/webhook_list.rb +1 -1
  139. data/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +1 -1
  140. data/lib/coinbase/client/version.rb +1 -1
  141. data/lib/coinbase/client.rb +23 -3
  142. data/lib/coinbase/crypto_amount.rb +62 -0
  143. data/lib/coinbase/faucet_transaction.rb +64 -4
  144. data/lib/coinbase/fiat_amount.rb +40 -0
  145. data/lib/coinbase/fund_operation.rb +228 -0
  146. data/lib/coinbase/fund_quote.rb +149 -0
  147. data/lib/coinbase/smart_contract.rb +95 -0
  148. data/lib/coinbase/staking_operation.rb +2 -2
  149. data/lib/coinbase/transaction.rb +8 -2
  150. data/lib/coinbase/validator.rb +7 -10
  151. data/lib/coinbase/version.rb +1 -1
  152. data/lib/coinbase/wallet.rb +13 -1
  153. data/lib/coinbase.rb +4 -0
  154. metadata +27 -4
  155. data/lib/coinbase/client/api/validators_api.rb +0 -179
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb84cbd1ab8caed73d5f13f149f99b93d002a680c767e8787dbc6f60fd72f7da
4
- data.tar.gz: ec856cae3c68d140f162abb3566131cf8cc620927f539c7d8dbb090a9802d2a5
3
+ metadata.gz: bf3cd3f21e8ca2443b776f6cc4c276dde8199a595087cce2e924318a91f7f0bf
4
+ data.tar.gz: 404b48c42fcdf6cda2062439ee9e17104912fdf7f359e5e60c1a2d8b95fce50a
5
5
  SHA512:
6
- metadata.gz: 853736276f36210c32c051ebee8583f1596ce88eddb2e3b107a60fa78d3cfd34cf1b14ca05f30db464b5b4a418225e7af10129640c1830f22c38250ec2f64b54
7
- data.tar.gz: 685826f02959985e2a36132db985f040588239936dc25df57f352ed38b8c5204e7ea67e6ef8f0b5695e2a03f7a0268bbb7ec3861efb795c99f543957f63c2b59
6
+ metadata.gz: 77b9bb44dc2d19bd6005bb274786679c0cc47586a90ad77c7288256ebd5ea6a0126fcdd751c73941b2786835d427864cd78d9ccfc3b2275164434c9b0e5c58a8
7
+ data.tar.gz: de1b59e1e4e3b077e65dbbc4d1a85ec988a4327cd29ecd9bec9167dbbf39762ad79df36ae508e25b48f87c9c4746069672baf52df86564434234208ec44731cf
@@ -217,6 +217,34 @@ module Coinbase
217
217
  )
218
218
  end
219
219
 
220
+ # Funds the address from your account on the Coinbase Platform for the given amount of the given Asset.
221
+ # @param amount [Integer, Float, BigDecimal] The amount of the Asset to fund the wallet with.
222
+ # @param asset_id [Symbol] The ID of the Asset to trade from. For Ether, :eth, :gwei, and :wei are supported.
223
+ # @return [Coinbase::FundOperation] The FundOperation object.
224
+ def fund(amount, asset_id)
225
+ FundOperation.create(
226
+ address_id: id,
227
+ amount: amount,
228
+ asset_id: asset_id,
229
+ network: network,
230
+ wallet_id: wallet_id
231
+ )
232
+ end
233
+
234
+ # Gets a quote for a fund operation to fund the address from your Coinbase platform,
235
+ # account for the amount of the specified Asset.
236
+ # @param asset_id [Symbol] The ID of the Asset to trade from. For Ether, :eth, :gwei, and :wei are supported.
237
+ # @return [Coinbase::FundQuote] The FundQuote object.
238
+ def quote_fund(amount, asset_id)
239
+ FundQuote.create(
240
+ address_id: id,
241
+ amount: amount,
242
+ asset_id: asset_id,
243
+ network: network,
244
+ wallet_id: wallet_id
245
+ )
246
+ end
247
+
220
248
  # Stakes the given amount of the given Asset. The stake operation
221
249
  # may take a few minutes to complete in the case when infrastructure is spun up.
222
250
  # @param amount [Integer, Float, BigDecimal] The amount of the Asset to stake.
@@ -91,11 +91,16 @@ module Coinbase
91
91
  # @raise [Coinbase::FaucetLimitReachedError] If the faucet limit has been reached for the address or user.
92
92
  # @raise [Coinbase::Client::ApiError] If an unexpected error occurs while requesting faucet funds.
93
93
  def faucet(asset_id: nil)
94
- opts = { asset_id: asset_id }.compact
95
-
96
94
  Coinbase.call_api do
97
95
  Coinbase::FaucetTransaction.new(
98
- addresses_api.request_external_faucet_funds(network.normalized_id, id, opts)
96
+ addresses_api.request_external_faucet_funds(
97
+ network.normalized_id,
98
+ id,
99
+ {
100
+ asset_id: asset_id,
101
+ skip_wait: true
102
+ }.compact
103
+ )
99
104
  )
100
105
  end
101
106
  end
@@ -43,7 +43,7 @@ module Coinbase
43
43
  # Returns a string representation of the Balance.
44
44
  # @return [String] a string representation of the Balance
45
45
  def to_s
46
- "Coinbase::Balance{amount: '#{amount.to_i}', asset_id: '#{asset_id}'}"
46
+ Coinbase.pretty_print_object(self.class, amount: amount.to_s('F'), asset_id: asset_id)
47
47
  end
48
48
 
49
49
  # Same as to_s.
@@ -6,7 +6,7 @@
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.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
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.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -94,6 +94,81 @@ module Coinbase::Client
94
94
  return data, status_code, headers
95
95
  end
96
96
 
97
+ # Get the status of a faucet transaction
98
+ # Get the status of a faucet transaction
99
+ # @param network_id [String] The ID of the blockchain network
100
+ # @param address_id [String] The ID of the address to fetch the faucet transaction for
101
+ # @param tx_hash [String] The hash of the faucet transaction
102
+ # @param [Hash] opts the optional parameters
103
+ # @return [FaucetTransaction]
104
+ def get_faucet_transaction(network_id, address_id, tx_hash, opts = {})
105
+ data, _status_code, _headers = get_faucet_transaction_with_http_info(network_id, address_id, tx_hash, opts)
106
+ data
107
+ end
108
+
109
+ # Get the status of a faucet transaction
110
+ # Get the status of a faucet transaction
111
+ # @param network_id [String] The ID of the blockchain network
112
+ # @param address_id [String] The ID of the address to fetch the faucet transaction for
113
+ # @param tx_hash [String] The hash of the faucet transaction
114
+ # @param [Hash] opts the optional parameters
115
+ # @return [Array<(FaucetTransaction, Integer, Hash)>] FaucetTransaction data, response status code and response headers
116
+ def get_faucet_transaction_with_http_info(network_id, address_id, tx_hash, opts = {})
117
+ if @api_client.config.debugging
118
+ @api_client.config.logger.debug 'Calling API: ExternalAddressesApi.get_faucet_transaction ...'
119
+ end
120
+ # verify the required parameter 'network_id' is set
121
+ if @api_client.config.client_side_validation && network_id.nil?
122
+ fail ArgumentError, "Missing the required parameter 'network_id' when calling ExternalAddressesApi.get_faucet_transaction"
123
+ end
124
+ # verify the required parameter 'address_id' is set
125
+ if @api_client.config.client_side_validation && address_id.nil?
126
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling ExternalAddressesApi.get_faucet_transaction"
127
+ end
128
+ # verify the required parameter 'tx_hash' is set
129
+ if @api_client.config.client_side_validation && tx_hash.nil?
130
+ fail ArgumentError, "Missing the required parameter 'tx_hash' when calling ExternalAddressesApi.get_faucet_transaction"
131
+ end
132
+ # resource path
133
+ local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/faucet/{tx_hash}'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'tx_hash' + '}', CGI.escape(tx_hash.to_s))
134
+
135
+ # query parameters
136
+ query_params = opts[:query_params] || {}
137
+
138
+ # header parameters
139
+ header_params = opts[:header_params] || {}
140
+ # HTTP header 'Accept' (if needed)
141
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
142
+
143
+ # form parameters
144
+ form_params = opts[:form_params] || {}
145
+
146
+ # http body (model)
147
+ post_body = opts[:debug_body]
148
+
149
+ # return_type
150
+ return_type = opts[:debug_return_type] || 'FaucetTransaction'
151
+
152
+ # auth_names
153
+ auth_names = opts[:debug_auth_names] || []
154
+
155
+ new_options = opts.merge(
156
+ :operation => :"ExternalAddressesApi.get_faucet_transaction",
157
+ :header_params => header_params,
158
+ :query_params => query_params,
159
+ :form_params => form_params,
160
+ :body => post_body,
161
+ :auth_names => auth_names,
162
+ :return_type => return_type
163
+ )
164
+
165
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug "API called: ExternalAddressesApi#get_faucet_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
168
+ end
169
+ return data, status_code, headers
170
+ end
171
+
97
172
  # Get the balances of an external address
98
173
  # List all of the balances of an external address
99
174
  # @param network_id [String] The ID of the blockchain network
@@ -176,6 +251,7 @@ module Coinbase::Client
176
251
  # @param address_id [String] The onchain address of the address that is being fetched.
177
252
  # @param [Hash] opts the optional parameters
178
253
  # @option opts [String] :asset_id The ID of the asset to transfer from the faucet.
254
+ # @option opts [Boolean] :skip_wait Whether to skip waiting for the transaction to be mined. This will become the default behavior in the future.
179
255
  # @return [FaucetTransaction]
180
256
  def request_external_faucet_funds(network_id, address_id, opts = {})
181
257
  data, _status_code, _headers = request_external_faucet_funds_with_http_info(network_id, address_id, opts)
@@ -188,6 +264,7 @@ module Coinbase::Client
188
264
  # @param address_id [String] The onchain address of the address that is being fetched.
189
265
  # @param [Hash] opts the optional parameters
190
266
  # @option opts [String] :asset_id The ID of the asset to transfer from the faucet.
267
+ # @option opts [Boolean] :skip_wait Whether to skip waiting for the transaction to be mined. This will become the default behavior in the future.
191
268
  # @return [Array<(FaucetTransaction, Integer, Hash)>] FaucetTransaction data, response status code and response headers
192
269
  def request_external_faucet_funds_with_http_info(network_id, address_id, opts = {})
193
270
  if @api_client.config.debugging
@@ -207,6 +284,7 @@ module Coinbase::Client
207
284
  # query parameters
208
285
  query_params = opts[:query_params] || {}
209
286
  query_params[:'asset_id'] = opts[:'asset_id'] if !opts[:'asset_id'].nil?
287
+ query_params[:'skip_wait'] = opts[:'skip_wait'] if !opts[:'skip_wait'].nil?
210
288
 
211
289
  # header parameters
212
290
  header_params = opts[:header_params] || {}
@@ -0,0 +1,336 @@
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.9.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Coinbase::Client
16
+ class FundApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a new fund operation.
23
+ # Create a new fund operation with an address.
24
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
25
+ # @param address_id [String] The onchain address to be funded.
26
+ # @param create_fund_operation_request [CreateFundOperationRequest]
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [FundOperation]
29
+ def create_fund_operation(wallet_id, address_id, create_fund_operation_request, opts = {})
30
+ data, _status_code, _headers = create_fund_operation_with_http_info(wallet_id, address_id, create_fund_operation_request, opts)
31
+ data
32
+ end
33
+
34
+ # Create a new fund operation.
35
+ # Create a new fund operation with an address.
36
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
37
+ # @param address_id [String] The onchain address to be funded.
38
+ # @param create_fund_operation_request [CreateFundOperationRequest]
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(FundOperation, Integer, Hash)>] FundOperation data, response status code and response headers
41
+ def create_fund_operation_with_http_info(wallet_id, address_id, create_fund_operation_request, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: FundApi.create_fund_operation ...'
44
+ end
45
+ # verify the required parameter 'wallet_id' is set
46
+ if @api_client.config.client_side_validation && wallet_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling FundApi.create_fund_operation"
48
+ end
49
+ # verify the required parameter 'address_id' is set
50
+ if @api_client.config.client_side_validation && address_id.nil?
51
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling FundApi.create_fund_operation"
52
+ end
53
+ # verify the required parameter 'create_fund_operation_request' is set
54
+ if @api_client.config.client_side_validation && create_fund_operation_request.nil?
55
+ fail ArgumentError, "Missing the required parameter 'create_fund_operation_request' when calling FundApi.create_fund_operation"
56
+ end
57
+ # resource path
58
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_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']) unless header_params['Accept']
67
+ # HTTP header 'Content-Type'
68
+ content_type = @api_client.select_header_content_type(['application/json'])
69
+ if !content_type.nil?
70
+ header_params['Content-Type'] = content_type
71
+ end
72
+
73
+ # form parameters
74
+ form_params = opts[:form_params] || {}
75
+
76
+ # http body (model)
77
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_fund_operation_request)
78
+
79
+ # return_type
80
+ return_type = opts[:debug_return_type] || 'FundOperation'
81
+
82
+ # auth_names
83
+ auth_names = opts[:debug_auth_names] || []
84
+
85
+ new_options = opts.merge(
86
+ :operation => :"FundApi.create_fund_operation",
87
+ :header_params => header_params,
88
+ :query_params => query_params,
89
+ :form_params => form_params,
90
+ :body => post_body,
91
+ :auth_names => auth_names,
92
+ :return_type => return_type
93
+ )
94
+
95
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug "API called: FundApi#create_fund_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
98
+ end
99
+ return data, status_code, headers
100
+ end
101
+
102
+ # Create a Fund Operation quote.
103
+ # Create a new fund operation with an address.
104
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
105
+ # @param address_id [String] The onchain address to be funded.
106
+ # @param create_fund_quote_request [CreateFundQuoteRequest]
107
+ # @param [Hash] opts the optional parameters
108
+ # @return [FundQuote]
109
+ def create_fund_quote(wallet_id, address_id, create_fund_quote_request, opts = {})
110
+ data, _status_code, _headers = create_fund_quote_with_http_info(wallet_id, address_id, create_fund_quote_request, opts)
111
+ data
112
+ end
113
+
114
+ # Create a Fund Operation quote.
115
+ # Create a new fund operation with an address.
116
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
117
+ # @param address_id [String] The onchain address to be funded.
118
+ # @param create_fund_quote_request [CreateFundQuoteRequest]
119
+ # @param [Hash] opts the optional parameters
120
+ # @return [Array<(FundQuote, Integer, Hash)>] FundQuote data, response status code and response headers
121
+ def create_fund_quote_with_http_info(wallet_id, address_id, create_fund_quote_request, opts = {})
122
+ if @api_client.config.debugging
123
+ @api_client.config.logger.debug 'Calling API: FundApi.create_fund_quote ...'
124
+ end
125
+ # verify the required parameter 'wallet_id' is set
126
+ if @api_client.config.client_side_validation && wallet_id.nil?
127
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling FundApi.create_fund_quote"
128
+ end
129
+ # verify the required parameter 'address_id' is set
130
+ if @api_client.config.client_side_validation && address_id.nil?
131
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling FundApi.create_fund_quote"
132
+ end
133
+ # verify the required parameter 'create_fund_quote_request' is set
134
+ if @api_client.config.client_side_validation && create_fund_quote_request.nil?
135
+ fail ArgumentError, "Missing the required parameter 'create_fund_quote_request' when calling FundApi.create_fund_quote"
136
+ end
137
+ # resource path
138
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations/quote'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
139
+
140
+ # query parameters
141
+ query_params = opts[:query_params] || {}
142
+
143
+ # header parameters
144
+ header_params = opts[:header_params] || {}
145
+ # HTTP header 'Accept' (if needed)
146
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
147
+ # HTTP header 'Content-Type'
148
+ content_type = @api_client.select_header_content_type(['application/json'])
149
+ if !content_type.nil?
150
+ header_params['Content-Type'] = content_type
151
+ end
152
+
153
+ # form parameters
154
+ form_params = opts[:form_params] || {}
155
+
156
+ # http body (model)
157
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_fund_quote_request)
158
+
159
+ # return_type
160
+ return_type = opts[:debug_return_type] || 'FundQuote'
161
+
162
+ # auth_names
163
+ auth_names = opts[:debug_auth_names] || []
164
+
165
+ new_options = opts.merge(
166
+ :operation => :"FundApi.create_fund_quote",
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(:POST, local_var_path, new_options)
176
+ if @api_client.config.debugging
177
+ @api_client.config.logger.debug "API called: FundApi#create_fund_quote\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
178
+ end
179
+ return data, status_code, headers
180
+ end
181
+
182
+ # Get fund operation.
183
+ # Get fund operation.
184
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
185
+ # @param address_id [String] The onchain address of the address that created the fund operation.
186
+ # @param fund_operation_id [String] The ID of the fund operation to fetch.
187
+ # @param [Hash] opts the optional parameters
188
+ # @return [FundOperation]
189
+ def get_fund_operation(wallet_id, address_id, fund_operation_id, opts = {})
190
+ data, _status_code, _headers = get_fund_operation_with_http_info(wallet_id, address_id, fund_operation_id, opts)
191
+ data
192
+ end
193
+
194
+ # Get fund operation.
195
+ # Get fund operation.
196
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
197
+ # @param address_id [String] The onchain address of the address that created the fund operation.
198
+ # @param fund_operation_id [String] The ID of the fund operation to fetch.
199
+ # @param [Hash] opts the optional parameters
200
+ # @return [Array<(FundOperation, Integer, Hash)>] FundOperation data, response status code and response headers
201
+ def get_fund_operation_with_http_info(wallet_id, address_id, fund_operation_id, opts = {})
202
+ if @api_client.config.debugging
203
+ @api_client.config.logger.debug 'Calling API: FundApi.get_fund_operation ...'
204
+ end
205
+ # verify the required parameter 'wallet_id' is set
206
+ if @api_client.config.client_side_validation && wallet_id.nil?
207
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling FundApi.get_fund_operation"
208
+ end
209
+ # verify the required parameter 'address_id' is set
210
+ if @api_client.config.client_side_validation && address_id.nil?
211
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling FundApi.get_fund_operation"
212
+ end
213
+ # verify the required parameter 'fund_operation_id' is set
214
+ if @api_client.config.client_side_validation && fund_operation_id.nil?
215
+ fail ArgumentError, "Missing the required parameter 'fund_operation_id' when calling FundApi.get_fund_operation"
216
+ end
217
+ # resource path
218
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations/{fund_operation_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'fund_operation_id' + '}', CGI.escape(fund_operation_id.to_s))
219
+
220
+ # query parameters
221
+ query_params = opts[:query_params] || {}
222
+
223
+ # header parameters
224
+ header_params = opts[:header_params] || {}
225
+ # HTTP header 'Accept' (if needed)
226
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
227
+
228
+ # form parameters
229
+ form_params = opts[:form_params] || {}
230
+
231
+ # http body (model)
232
+ post_body = opts[:debug_body]
233
+
234
+ # return_type
235
+ return_type = opts[:debug_return_type] || 'FundOperation'
236
+
237
+ # auth_names
238
+ auth_names = opts[:debug_auth_names] || []
239
+
240
+ new_options = opts.merge(
241
+ :operation => :"FundApi.get_fund_operation",
242
+ :header_params => header_params,
243
+ :query_params => query_params,
244
+ :form_params => form_params,
245
+ :body => post_body,
246
+ :auth_names => auth_names,
247
+ :return_type => return_type
248
+ )
249
+
250
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
251
+ if @api_client.config.debugging
252
+ @api_client.config.logger.debug "API called: FundApi#get_fund_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
253
+ end
254
+ return data, status_code, headers
255
+ end
256
+
257
+ # List fund operations for an address.
258
+ # List fund operations for an address.
259
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
260
+ # @param address_id [String] The onchain address of the address to list fund operations for.
261
+ # @param [Hash] opts the optional parameters
262
+ # @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.
263
+ # @option opts [String] :page A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
264
+ # @return [FundOperationList]
265
+ def list_fund_operations(wallet_id, address_id, opts = {})
266
+ data, _status_code, _headers = list_fund_operations_with_http_info(wallet_id, address_id, opts)
267
+ data
268
+ end
269
+
270
+ # List fund operations for an address.
271
+ # List fund operations for an address.
272
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
273
+ # @param address_id [String] The onchain address of the address to list fund operations for.
274
+ # @param [Hash] opts the optional parameters
275
+ # @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.
276
+ # @option opts [String] :page A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
277
+ # @return [Array<(FundOperationList, Integer, Hash)>] FundOperationList data, response status code and response headers
278
+ def list_fund_operations_with_http_info(wallet_id, address_id, opts = {})
279
+ if @api_client.config.debugging
280
+ @api_client.config.logger.debug 'Calling API: FundApi.list_fund_operations ...'
281
+ end
282
+ # verify the required parameter 'wallet_id' is set
283
+ if @api_client.config.client_side_validation && wallet_id.nil?
284
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling FundApi.list_fund_operations"
285
+ end
286
+ # verify the required parameter 'address_id' is set
287
+ if @api_client.config.client_side_validation && address_id.nil?
288
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling FundApi.list_fund_operations"
289
+ end
290
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
291
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling FundApi.list_fund_operations, the character length must be smaller than or equal to 5000.'
292
+ end
293
+
294
+ # resource path
295
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
296
+
297
+ # query parameters
298
+ query_params = opts[:query_params] || {}
299
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
300
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
301
+
302
+ # header parameters
303
+ header_params = opts[:header_params] || {}
304
+ # HTTP header 'Accept' (if needed)
305
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
306
+
307
+ # form parameters
308
+ form_params = opts[:form_params] || {}
309
+
310
+ # http body (model)
311
+ post_body = opts[:debug_body]
312
+
313
+ # return_type
314
+ return_type = opts[:debug_return_type] || 'FundOperationList'
315
+
316
+ # auth_names
317
+ auth_names = opts[:debug_auth_names] || []
318
+
319
+ new_options = opts.merge(
320
+ :operation => :"FundApi.list_fund_operations",
321
+ :header_params => header_params,
322
+ :query_params => query_params,
323
+ :form_params => form_params,
324
+ :body => post_body,
325
+ :auth_names => auth_names,
326
+ :return_type => return_type
327
+ )
328
+
329
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
330
+ if @api_client.config.debugging
331
+ @api_client.config.logger.debug "API called: FundApi#list_fund_operations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
332
+ end
333
+ return data, status_code, headers
334
+ end
335
+ end
336
+ end