coinbase-sdk 0.6.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/wallet_address.rb +44 -0
  3. data/lib/coinbase/address.rb +13 -4
  4. data/lib/coinbase/client/api/external_addresses_api.rb +26 -27
  5. data/lib/coinbase/client/api/fund_api.rb +336 -0
  6. data/lib/coinbase/client/api/onchain_identity_api.rb +108 -0
  7. data/lib/coinbase/client/api/smart_contracts_api.rb +80 -0
  8. data/lib/coinbase/client/api/transaction_history_api.rb +101 -0
  9. data/lib/coinbase/client/api/webhooks_api.rb +70 -0
  10. data/lib/coinbase/client/models/create_fund_operation_request.rb +249 -0
  11. data/lib/coinbase/client/models/create_fund_quote_request.rb +239 -0
  12. data/lib/coinbase/client/models/create_wallet_webhook_request.rb +232 -0
  13. data/lib/coinbase/client/models/crypto_amount.rb +239 -0
  14. data/lib/coinbase/client/models/ethereum_token_transfer.rb +327 -0
  15. data/lib/coinbase/client/models/ethereum_transaction.rb +12 -1
  16. data/lib/coinbase/client/models/faucet_transaction.rb +20 -4
  17. data/lib/coinbase/client/models/fiat_amount.rb +240 -0
  18. data/lib/coinbase/client/models/fund_operation.rb +373 -0
  19. data/lib/coinbase/client/models/fund_operation_fees.rb +238 -0
  20. data/lib/coinbase/client/models/fund_operation_list.rb +275 -0
  21. data/lib/coinbase/client/models/fund_quote.rb +339 -0
  22. data/lib/coinbase/client/models/multi_token_contract_options.rb +223 -0
  23. data/lib/coinbase/client/models/network_identifier.rb +2 -1
  24. data/lib/coinbase/client/models/nft_contract_options.rb +21 -4
  25. data/lib/coinbase/client/models/onchain_name.rb +357 -0
  26. data/lib/coinbase/client/models/onchain_name_list.rb +262 -0
  27. data/lib/coinbase/client/models/read_contract_request.rb +249 -0
  28. data/lib/coinbase/client/models/smart_contract_options.rb +1 -0
  29. data/lib/coinbase/client/models/smart_contract_type.rb +2 -1
  30. data/lib/coinbase/client/models/solidity_value.rb +287 -0
  31. data/lib/coinbase/client/models/{feature.rb → token_transfer_type.rb} +10 -10
  32. data/lib/coinbase/client/models/update_webhook_request.rb +0 -7
  33. data/lib/coinbase/client.rb +19 -0
  34. data/lib/coinbase/faucet_transaction.rb +64 -4
  35. data/lib/coinbase/smart_contract.rb +149 -0
  36. data/lib/coinbase/transaction.rb +8 -2
  37. data/lib/coinbase/version.rb +1 -1
  38. data/lib/coinbase/wallet.rb +35 -1
  39. data/lib/coinbase/webhook.rb +3 -7
  40. metadata +21 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2313a5ef68b35c37a63761a05e180c114334fbf0d66c1999b1be04c065a50c64
4
- data.tar.gz: 0ebbb9e277b58368ed608dd91a626016e7cfd51888b9b29d28315546e5c6a09a
3
+ metadata.gz: 29ac718bb1a79d86c1c626ff064e1ee9161e823a013d70479ef66557433f0729
4
+ data.tar.gz: 43cc2a356b086de2f1c59df45a6fcedfe3a6899c219c96743f682d2a176c75cd
5
5
  SHA512:
6
- metadata.gz: a9224a29e1cb866c16acca444cf99b06dcb35086aa2f0ff9503e786f42d9dd7c5a6b3a74259689b1f139d93c6cccb8bc8b762ec3578f38d43289e34406dbf3d4
7
- data.tar.gz: 8a6ee67daf8eb6fdcd8fda7d2333f09307c00c2c19b675a401a951cd6a56f2b73918e80c4e99e5d09c7d2d6767c558c44503e0e5b6be6dc88cf095ef4bcb332e
6
+ metadata.gz: d314ce486da8317c575c2663a402c1b11bda90d8116e523b389d29e09c823af7251ded4f94dc9469106676d73e4376ec28e0ff944f4e480f39ac421bb83d6f02
7
+ data.tar.gz: 0c59e91c5175612a2ac5b5433880ec4c10286f406fc4ec48f17272566b1c5416612c4d225d27eb5b2731e1da2864865e138131c4bdf6fa8a4a292bc205ece738
@@ -155,6 +155,50 @@ module Coinbase
155
155
  smart_contract
156
156
  end
157
157
 
158
+ # Deploys a new ERC721 NFT contract with the given name, symbol, and base URI.
159
+ # @param name [String] The name of the NFT contract.
160
+ # @param symbol [String] The symbol of the NFT contract.
161
+ # @param base_uri [String] The base URI for the NFT contract.
162
+ # @return [Coinbase::SmartContract] The deployed NFT contract.
163
+ # @raise [AddressCannotSignError] if the Address does not have a private key backing it.
164
+ def deploy_nft(name:, symbol:, base_uri:)
165
+ ensure_can_sign!
166
+
167
+ smart_contract = SmartContract.create_nft_contract(
168
+ address_id: id,
169
+ wallet_id: wallet_id,
170
+ name: name,
171
+ symbol: symbol,
172
+ base_uri: base_uri
173
+ )
174
+
175
+ return smart_contract if Coinbase.use_server_signer?
176
+
177
+ smart_contract.sign(@key)
178
+ smart_contract.deploy!
179
+ smart_contract
180
+ end
181
+
182
+ # Deploys a new ERC1155 multi-token contract with the given URI.
183
+ # @param uri [String] The URI for the token metadata, where {id} will be replaced with the token ID.
184
+ # @return [Coinbase::SmartContract] The deployed multi-token contract.
185
+ # @raise [AddressCannotSignError] if the Address does not have a private key backing it.
186
+ def deploy_multi_token(uri:)
187
+ ensure_can_sign!
188
+
189
+ smart_contract = SmartContract.create_multi_token_contract(
190
+ address_id: id,
191
+ wallet_id: wallet_id,
192
+ uri: uri
193
+ )
194
+
195
+ return smart_contract if Coinbase.use_server_signer?
196
+
197
+ smart_contract.sign(@key)
198
+ smart_contract.deploy!
199
+ smart_contract
200
+ end
201
+
158
202
  # Signs the given unsigned payload.
159
203
  # @param unsigned_payload [String] The hex-encoded hashed unsigned payload for the Address to sign.
160
204
  # @return [Coinbase::PayloadSignature] The payload signature
@@ -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
@@ -252,6 +257,10 @@ module Coinbase
252
257
  @balance_history_api ||= Coinbase::Client::BalanceHistoryApi.new(Coinbase.configuration.api_client)
253
258
  end
254
259
 
260
+ def transaction_history_api
261
+ @transaction_history_api ||= Coinbase::Client::TransactionHistoryApi.new(Coinbase.configuration.api_client)
262
+ end
263
+
255
264
  def stake_api
256
265
  @stake_api ||= Coinbase::Client::StakeApi.new(Coinbase.configuration.api_client)
257
266
  end
@@ -266,7 +275,7 @@ module Coinbase
266
275
  end
267
276
 
268
277
  def list_transaction_page(page)
269
- addresses_api.list_address_transactions(
278
+ transaction_history_api.list_address_transactions(
270
279
  network.normalized_id,
271
280
  id,
272
281
  { limit: DEFAULT_TRANSACTION_PAGE_LIMIT, page: page }
@@ -94,50 +94,46 @@ module Coinbase::Client
94
94
  return data, status_code, headers
95
95
  end
96
96
 
97
- # List transactions for an address.
98
- # List all transactions that interact with the address.
97
+ # Get the status of a faucet transaction
98
+ # Get the status of a faucet transaction
99
99
  # @param network_id [String] The ID of the blockchain network
100
- # @param address_id [String] The ID of the address to fetch the transactions for.
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
101
102
  # @param [Hash] opts the optional parameters
102
- # @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.
103
- # @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.
104
- # @return [AddressTransactionList]
105
- def list_address_transactions(network_id, address_id, opts = {})
106
- data, _status_code, _headers = list_address_transactions_with_http_info(network_id, address_id, opts)
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)
107
106
  data
108
107
  end
109
108
 
110
- # List transactions for an address.
111
- # List all transactions that interact with the address.
109
+ # Get the status of a faucet transaction
110
+ # Get the status of a faucet transaction
112
111
  # @param network_id [String] The ID of the blockchain network
113
- # @param address_id [String] The ID of the address to fetch the transactions for.
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
114
  # @param [Hash] opts the optional parameters
115
- # @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.
116
- # @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.
117
- # @return [Array<(AddressTransactionList, Integer, Hash)>] AddressTransactionList data, response status code and response headers
118
- def list_address_transactions_with_http_info(network_id, address_id, opts = {})
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 = {})
119
117
  if @api_client.config.debugging
120
- @api_client.config.logger.debug 'Calling API: ExternalAddressesApi.list_address_transactions ...'
118
+ @api_client.config.logger.debug 'Calling API: ExternalAddressesApi.get_faucet_transaction ...'
121
119
  end
122
120
  # verify the required parameter 'network_id' is set
123
121
  if @api_client.config.client_side_validation && network_id.nil?
124
- fail ArgumentError, "Missing the required parameter 'network_id' when calling ExternalAddressesApi.list_address_transactions"
122
+ fail ArgumentError, "Missing the required parameter 'network_id' when calling ExternalAddressesApi.get_faucet_transaction"
125
123
  end
126
124
  # verify the required parameter 'address_id' is set
127
125
  if @api_client.config.client_side_validation && address_id.nil?
128
- fail ArgumentError, "Missing the required parameter 'address_id' when calling ExternalAddressesApi.list_address_transactions"
126
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling ExternalAddressesApi.get_faucet_transaction"
129
127
  end
130
- if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
131
- fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ExternalAddressesApi.list_address_transactions, the character length must be smaller than or equal to 5000.'
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"
132
131
  end
133
-
134
132
  # resource path
135
- local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/transactions'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
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))
136
134
 
137
135
  # query parameters
138
136
  query_params = opts[:query_params] || {}
139
- query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
140
- query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
141
137
 
142
138
  # header parameters
143
139
  header_params = opts[:header_params] || {}
@@ -151,13 +147,13 @@ module Coinbase::Client
151
147
  post_body = opts[:debug_body]
152
148
 
153
149
  # return_type
154
- return_type = opts[:debug_return_type] || 'AddressTransactionList'
150
+ return_type = opts[:debug_return_type] || 'FaucetTransaction'
155
151
 
156
152
  # auth_names
157
153
  auth_names = opts[:debug_auth_names] || []
158
154
 
159
155
  new_options = opts.merge(
160
- :operation => :"ExternalAddressesApi.list_address_transactions",
156
+ :operation => :"ExternalAddressesApi.get_faucet_transaction",
161
157
  :header_params => header_params,
162
158
  :query_params => query_params,
163
159
  :form_params => form_params,
@@ -168,7 +164,7 @@ module Coinbase::Client
168
164
 
169
165
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
170
166
  if @api_client.config.debugging
171
- @api_client.config.logger.debug "API called: ExternalAddressesApi#list_address_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
167
+ @api_client.config.logger.debug "API called: ExternalAddressesApi#get_faucet_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
172
168
  end
173
169
  return data, status_code, headers
174
170
  end
@@ -255,6 +251,7 @@ module Coinbase::Client
255
251
  # @param address_id [String] The onchain address of the address that is being fetched.
256
252
  # @param [Hash] opts the optional parameters
257
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.
258
255
  # @return [FaucetTransaction]
259
256
  def request_external_faucet_funds(network_id, address_id, opts = {})
260
257
  data, _status_code, _headers = request_external_faucet_funds_with_http_info(network_id, address_id, opts)
@@ -267,6 +264,7 @@ module Coinbase::Client
267
264
  # @param address_id [String] The onchain address of the address that is being fetched.
268
265
  # @param [Hash] opts the optional parameters
269
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.
270
268
  # @return [Array<(FaucetTransaction, Integer, Hash)>] FaucetTransaction data, response status code and response headers
271
269
  def request_external_faucet_funds_with_http_info(network_id, address_id, opts = {})
272
270
  if @api_client.config.debugging
@@ -286,6 +284,7 @@ module Coinbase::Client
286
284
  # query parameters
287
285
  query_params = opts[:query_params] || {}
288
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?
289
288
 
290
289
  # header parameters
291
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.8.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