coinbase-sdk 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c18b015a028c3b795a618318ab244f31d58861f66f67e6d76a7b70ee3b664e2f
4
- data.tar.gz: c82577524824f743ac16624ffc042c2017183d366a5c849d1baa3d2028b85c96
3
+ metadata.gz: d4413913708fadc44dcbb49a00a72fe55382187c8084531b9cec43894e0ee9a0
4
+ data.tar.gz: e47f6295ce5f8bc1d8888b49ba71cdbc1558d606e708e66452f0ae6a76127249
5
5
  SHA512:
6
- metadata.gz: 92efa9bc82a0d753698bae8de9e60768c696ce6ef5019cbb3eab6ae7bd25d9257f289dd95164a6440a7f25f0cd90b02a0d267b07ea1d82ebe6b0d4cb142fe82f
7
- data.tar.gz: 204120f5e22ec7bfd4b87f0e09bdd8600740106d11a0e7d04264d39f650b8a1154472de209537da510cef03daeb669e6a84c5ee5f212c82d9eda66207f5f8e81
6
+ metadata.gz: acb6233add651f82063b7f2a73da8b7a8112687603d61fb77f3160713d813ea07447e25b5b69e83dd81c1852478c1b9999c1b207c9137ae08868db495721181b
7
+ data.tar.gz: 3b72b12e92386e7114e0146f257032b904a4f26a2a97369bff19c1bc722b195372c830a2bb405e1a2f2655c81608beeee8d601deab293f87c1adf5fb18ca64e9
@@ -35,40 +35,32 @@ module Coinbase
35
35
 
36
36
  # Returns the Address ID.
37
37
  # @return [String] The Address ID
38
- def address_id
38
+ def id
39
39
  @model.address_id
40
40
  end
41
41
 
42
42
  # Returns the balances of the Address.
43
43
  # @return [BalanceMap] The balances of the Address, keyed by asset ID. Ether balances are denominated
44
44
  # in ETH.
45
- def list_balances
46
- response = addresses_api.list_address_balances(wallet_id, address_id)
47
- Coinbase.to_balance_map(response)
45
+ def balances
46
+ response = Coinbase.call_api do
47
+ addresses_api.list_address_balances(wallet_id, id)
48
+ end
49
+
50
+ Coinbase::BalanceMap.from_balances(response.data)
48
51
  end
49
52
 
50
53
  # Returns the balance of the provided Asset.
51
54
  # @param asset_id [Symbol] The Asset to retrieve the balance for
52
55
  # @return [BigDecimal] The balance of the Asset
53
- def get_balance(asset_id)
54
- normalized_asset_id = normalize_asset_id(asset_id)
55
-
56
- response = addresses_api.get_address_balance(wallet_id, address_id, normalized_asset_id.to_s)
56
+ def balance(asset_id)
57
+ response = Coinbase.call_api do
58
+ addresses_api.get_address_balance(wallet_id, id, Coinbase::Asset.primary_denomination(asset_id).to_s)
59
+ end
57
60
 
58
61
  return BigDecimal('0') if response.nil?
59
62
 
60
- amount = BigDecimal(response.amount)
61
-
62
- case asset_id
63
- when :eth
64
- amount / BigDecimal(Coinbase::WEI_PER_ETHER.to_s)
65
- when :gwei
66
- amount / BigDecimal(Coinbase::GWEI_PER_ETHER.to_s)
67
- when :usdc
68
- amount / BigDecimal(Coinbase::ATOMIC_UNITS_PER_USDC.to_s)
69
- else
70
- amount
71
- end
63
+ Coinbase::Balance.from_model_and_asset_id(response, asset_id).amount
72
64
  end
73
65
 
74
66
  # Transfers the given amount of the given Asset to the given address. Only same-Network Transfers are supported.
@@ -78,83 +70,105 @@ module Coinbase
78
70
  # default address. If a String, interprets it as the address ID.
79
71
  # @return [String] The hash of the Transfer transaction.
80
72
  def transfer(amount, asset_id, destination)
81
- raise ArgumentError, "Unsupported asset: #{asset_id}" unless Coinbase::SUPPORTED_ASSET_IDS[asset_id]
73
+ raise ArgumentError, "Unsupported asset: #{asset_id}" unless Coinbase::Asset.supported?(asset_id)
82
74
 
83
75
  if destination.is_a?(Wallet)
84
76
  raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id
85
77
 
86
- destination = destination.default_address.address_id
78
+ destination = destination.default_address.id
87
79
  elsif destination.is_a?(Address)
88
80
  raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id
89
81
 
90
- destination = destination.address_id
82
+ destination = destination.id
91
83
  end
92
84
 
93
- current_balance = get_balance(asset_id)
85
+ current_balance = balance(asset_id)
94
86
  if current_balance < amount
95
87
  raise ArgumentError, "Insufficient funds: #{amount} requested, but only #{current_balance} available"
96
88
  end
97
89
 
98
- normalized_amount = normalize_asset_amount(amount, asset_id)
99
-
100
- normalized_asset_id = normalize_asset_id(asset_id)
101
-
102
90
  create_transfer_request = {
103
- amount: normalized_amount.to_i.to_s,
91
+ amount: Coinbase::Asset.to_atomic_amount(amount, asset_id).to_i.to_s,
104
92
  network_id: network_id,
105
- asset_id: normalized_asset_id.to_s,
93
+ asset_id: Coinbase::Asset.primary_denomination(asset_id).to_s,
106
94
  destination: destination
107
95
  }
108
96
 
109
- transfer_model = transfers_api.create_transfer(wallet_id, address_id, create_transfer_request)
97
+ transfer_model = Coinbase.call_api do
98
+ transfers_api.create_transfer(wallet_id, id, create_transfer_request)
99
+ end
110
100
 
111
101
  transfer = Coinbase::Transfer.new(transfer_model)
112
102
 
113
103
  transaction = transfer.transaction
114
104
  transaction.sign(@key)
115
- Coinbase.configuration.base_sepolia_client.eth_sendRawTransaction("0x#{transaction.hex}")
116
105
 
117
- transfer
106
+ signed_payload = transaction.hex
107
+
108
+ broadcast_transfer_request = {
109
+ signed_payload: signed_payload
110
+ }
111
+
112
+ transfer_model = Coinbase.call_api do
113
+ transfers_api.broadcast_transfer(wallet_id, id, transfer.id, broadcast_transfer_request)
114
+ end
115
+
116
+ Coinbase::Transfer.new(transfer_model)
118
117
  end
119
118
 
120
- # Returns the address as a string.
121
- # @return [String] The address
119
+ # Returns a String representation of the Address.
120
+ # @return [String] a String representation of the Address
122
121
  def to_s
123
- address_id
122
+ "Coinbase::Address{id: '#{id}', network_id: '#{network_id}', wallet_id: '#{wallet_id}'}"
124
123
  end
125
124
 
126
- private
125
+ # Same as to_s.
126
+ # @return [String] a String representation of the Address
127
+ def inspect
128
+ to_s
129
+ end
127
130
 
128
- # Normalizes the amount of the Asset to send to the atomic unit.
129
- # @param amount [Integer, Float, BigDecimal] The amount to normalize
130
- # @param asset_id [Symbol] The ID of the Asset being transferred
131
- # @return [BigDecimal] The normalized amount in atomic units
132
- def normalize_asset_amount(amount, asset_id)
133
- big_amount = BigDecimal(amount.to_s)
134
-
135
- case asset_id
136
- when :eth
137
- big_amount * Coinbase::WEI_PER_ETHER
138
- when :gwei
139
- big_amount * Coinbase::WEI_PER_GWEI
140
- when :usdc
141
- big_amount * Coinbase::ATOMIC_UNITS_PER_USDC
142
- else
143
- big_amount
131
+ # Requests funds for the address from the faucet and returns the faucet transaction.
132
+ # This is only supported on testnet networks.
133
+ # @return [Coinbase::FaucetTransaction] The successful faucet transaction
134
+ # @raise [Coinbase::FaucetLimitReachedError] If the faucet limit has been reached for the address or user.
135
+ # @raise [Coinbase::Client::ApiError] If an unexpected error occurs while requesting faucet funds.
136
+ def faucet
137
+ Coinbase.call_api do
138
+ Coinbase::FaucetTransaction.new(addresses_api.request_faucet_funds(wallet_id, id))
144
139
  end
145
140
  end
146
141
 
147
- # Normalizes the asset ID to use during requests.
148
- # @param asset_id [Symbol] The asset ID to normalize
149
- # @return [Symbol] The normalized asset ID
150
- def normalize_asset_id(asset_id)
151
- if %i[wei gwei].include?(asset_id)
152
- :eth
153
- else
154
- asset_id
142
+ # Exports the Address's private key to a hex string.
143
+ # @return [String] The Address's private key as a hex String
144
+ def export
145
+ @key.private_hex
146
+ end
147
+
148
+ # Returns all of the transfers associated with the address.
149
+ # @return [Array<Coinbase::Transfer>] The transfers associated with the address
150
+ def transfers
151
+ transfers = []
152
+ page = nil
153
+
154
+ loop do
155
+ puts "fetch transfers page: #{page}"
156
+ response = Coinbase.call_api do
157
+ transfers_api.list_transfers(wallet_id, id, { limit: 100, page: page })
158
+ end
159
+
160
+ transfers.concat(response.data.map { |transfer| Coinbase::Transfer.new(transfer) }) if response.data
161
+
162
+ break unless response.has_more
163
+
164
+ page = response.next_page
155
165
  end
166
+
167
+ transfers
156
168
  end
157
169
 
170
+ private
171
+
158
172
  def addresses_api
159
173
  @addresses_api ||= Coinbase::Client::AddressesApi.new(Coinbase.configuration.api_client)
160
174
  end
@@ -3,7 +3,63 @@
3
3
  module Coinbase
4
4
  # A representation of an Asset.
5
5
  class Asset
6
- attr_reader :network_id, :asset_id, :display_name, :address_id
6
+ # Retuns whether the provided asset ID is supported.
7
+ # @param asset_id [Symbol] The Asset ID
8
+ # @return [Boolean] Whether the Asset ID is supported
9
+ def self.supported?(asset_id)
10
+ !!Coinbase::SUPPORTED_ASSET_IDS[asset_id]
11
+ end
12
+
13
+ # Converts the amount of the Asset to the atomic units of the primary denomination of the Asset.
14
+ # @param amount [Integer, Float, BigDecimal] The amount to normalize
15
+ # @param asset_id [Symbol] The ID of the Asset being transferred
16
+ # @return [BigDecimal] The normalized amount in atomic units
17
+ def self.to_atomic_amount(amount, asset_id)
18
+ case asset_id
19
+ when :eth
20
+ amount * BigDecimal(Coinbase::WEI_PER_ETHER.to_s)
21
+ when :gwei
22
+ amount * BigDecimal(Coinbase::WEI_PER_GWEI.to_s)
23
+ when :usdc
24
+ amount * BigDecimal(Coinbase::ATOMIC_UNITS_PER_USDC.to_s)
25
+ when :weth
26
+ amount * BigDecimal(Coinbase::WEI_PER_ETHER)
27
+ else
28
+ amount
29
+ end
30
+ end
31
+
32
+ # Converts an amount from the atomic value of the primary denomination of the provided Asset ID
33
+ # to whole units of the specified asset ID.
34
+ # @param atomic_amount [BigDecimal] The amount in atomic units
35
+ # @param asset_id [Symbol] The Asset ID
36
+ # @return [BigDecimal] The amount in whole units of the specified asset ID
37
+ def self.from_atomic_amount(atomic_amount, asset_id)
38
+ case asset_id
39
+ when :eth
40
+ atomic_amount / BigDecimal(Coinbase::WEI_PER_ETHER.to_s)
41
+ when :gwei
42
+ atomic_amount / BigDecimal(Coinbase::WEI_PER_GWEI.to_s)
43
+ when :usdc
44
+ atomic_amount / BigDecimal(Coinbase::ATOMIC_UNITS_PER_USDC.to_s)
45
+ when :weth
46
+ atomic_amount / BigDecimal(Coinbase::WEI_PER_ETHER)
47
+ else
48
+ atomic_amount
49
+ end
50
+ end
51
+
52
+ # Returns the primary denomination for the provided Asset ID.
53
+ # For assets with multiple denominations, e.g. eth can also be denominated in wei and gwei,
54
+ # this method will return the primary denomination.
55
+ # e.g. eth.
56
+ # @param asset_id [Symbol] The Asset ID
57
+ # @return [Symbol] The primary denomination for the Asset ID
58
+ def self.primary_denomination(asset_id)
59
+ return :eth if %i[wei gwei].include?(asset_id)
60
+
61
+ asset_id
62
+ end
7
63
 
8
64
  # Returns a new Asset object. Do not use this method. Instead, use the Asset constants defined in
9
65
  # the Coinbase module.
@@ -17,5 +73,20 @@ module Coinbase
17
73
  @display_name = display_name
18
74
  @address_id = address_id
19
75
  end
76
+
77
+ attr_reader :network_id, :asset_id, :display_name, :address_id
78
+
79
+ # Returns a string representation of the Asset.
80
+ # @return [String] a string representation of the Asset
81
+ def to_s
82
+ "Coinbase::Asset{network_id: '#{network_id}', asset_id: '#{asset_id}', display_name: '#{display_name}'" +
83
+ (address_id.nil? ? '}' : ", address_id: '#{address_id}'}")
84
+ end
85
+
86
+ # Same as to_s.
87
+ # @return [String] a string representation of the Balance
88
+ def inspect
89
+ to_s
90
+ end
20
91
  end
21
92
  end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Coinbase
4
+ # A representation of an Balance.
5
+ class Balance
6
+ # Converts a Coinbase::Client::Balance model to a Coinbase::Balance
7
+ # @param balance_model [Coinbase::Client::Balance] The balance fetched from the API.
8
+ # @return [Balance] The converted Balance object.
9
+ def self.from_model(balance_model)
10
+ asset_id = Coinbase.to_sym(balance_model.asset.asset_id.downcase)
11
+
12
+ from_model_and_asset_id(balance_model, asset_id)
13
+ end
14
+
15
+ # Converts a Coinbase::Client::Balance model and asset ID to a Coinbase::Balance
16
+ # This can be used to specify a non-primary denomination that we want the balance
17
+ # to be converted to.
18
+ # @param balance_model [Coinbase::Client::Balance] The balance fetched from the API.
19
+ # @param asset_id [Symbol] The Asset ID of the denomination we want returned.
20
+ # @return [Balance] The converted Balance object.
21
+ def self.from_model_and_asset_id(balance_model, asset_id)
22
+ new(
23
+ amount: Coinbase::Asset.from_atomic_amount(BigDecimal(balance_model.amount), asset_id),
24
+ asset_id: asset_id
25
+ )
26
+ end
27
+
28
+ # Returns a new Asset object. Do not use this method. Instead, use the Asset constants defined in
29
+ # the Coinbase module.
30
+ # @param network_id [Symbol] The ID of the Network to which the Asset belongs
31
+ # @param asset_id [Symbol] The Asset ID
32
+ # @param display_name [String] The Asset's display name
33
+ # @param address_id [String] (Optional) The Asset's address ID, if one exists
34
+ def initialize(amount:, asset_id:)
35
+ @amount = amount
36
+ @asset_id = asset_id
37
+ end
38
+
39
+ attr_reader :amount, :asset_id
40
+
41
+ # Returns a string representation of the Balance.
42
+ # @return [String] a string representation of the Balance
43
+ def to_s
44
+ "Coinbase::Balance{amount: '#{amount.to_i}', asset_id: '#{asset_id}'}"
45
+ end
46
+
47
+ # Same as to_s.
48
+ # @return [String] a string representation of the Balance
49
+ def inspect
50
+ to_s
51
+ end
52
+ end
53
+ end
@@ -5,15 +5,27 @@ require 'bigdecimal'
5
5
  module Coinbase
6
6
  # A convenience class for printing out Asset balances in a human-readable format.
7
7
  class BalanceMap < Hash
8
- # Returns a new BalanceMap object.
9
- # @param hash [Map<Symbol, BigDecimal>] The hash to initialize with
10
- def initialize(hash = {})
11
- super()
12
- hash.each do |key, value|
13
- self[key] = value
8
+ # Converts a list of Coinbase::Client::Balance models to a Coinbase::BalanceMap.
9
+ # @param balances [Array<Coinbase::Client::Balance>] The list of balances fetched from the API.
10
+ # @return [BalanceMap] The converted BalanceMap object.
11
+ def self.from_balances(balances)
12
+ BalanceMap.new.tap do |balance_map|
13
+ balances.each do |balance_model|
14
+ balance = Coinbase::Balance.from_model(balance_model)
15
+
16
+ balance_map.add(balance)
17
+ end
14
18
  end
15
19
  end
16
20
 
21
+ # Adds a balance to the map.
22
+ # @param balance [Coinbase::Balance] The balance to add to the map.
23
+ def add(balance)
24
+ raise ArgumentError, 'balance must be a Coinbase::Balance' unless balance.is_a?(Coinbase::Balance)
25
+
26
+ self[balance.asset_id] = balance.amount
27
+ end
28
+
17
29
  # Returns a string representation of the balance map.
18
30
  # @return [String] The string representation of the balance
19
31
  def to_s
@@ -42,7 +54,7 @@ module Coinbase
42
54
  result[asset_id] = str
43
55
  end
44
56
 
45
- result
57
+ result.to_s
46
58
  end
47
59
  end
48
60
  end
@@ -381,5 +381,74 @@ module Coinbase::Client
381
381
  end
382
382
  return data, status_code, headers
383
383
  end
384
+
385
+ # Request faucet funds for onchain address.
386
+ # Request faucet funds to be sent to onchain address.
387
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
388
+ # @param address_id [String] The onchain address of the address that is being fetched.
389
+ # @param [Hash] opts the optional parameters
390
+ # @return [FaucetTransaction]
391
+ def request_faucet_funds(wallet_id, address_id, opts = {})
392
+ data, _status_code, _headers = request_faucet_funds_with_http_info(wallet_id, address_id, opts)
393
+ data
394
+ end
395
+
396
+ # Request faucet funds for onchain address.
397
+ # Request faucet funds to be sent to onchain address.
398
+ # @param wallet_id [String] The ID of the wallet the address belongs to.
399
+ # @param address_id [String] The onchain address of the address that is being fetched.
400
+ # @param [Hash] opts the optional parameters
401
+ # @return [Array<(FaucetTransaction, Integer, Hash)>] FaucetTransaction data, response status code and response headers
402
+ def request_faucet_funds_with_http_info(wallet_id, address_id, opts = {})
403
+ if @api_client.config.debugging
404
+ @api_client.config.logger.debug 'Calling API: AddressesApi.request_faucet_funds ...'
405
+ end
406
+ # verify the required parameter 'wallet_id' is set
407
+ if @api_client.config.client_side_validation && wallet_id.nil?
408
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling AddressesApi.request_faucet_funds"
409
+ end
410
+ # verify the required parameter 'address_id' is set
411
+ if @api_client.config.client_side_validation && address_id.nil?
412
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling AddressesApi.request_faucet_funds"
413
+ end
414
+ # resource path
415
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/faucet'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
416
+
417
+ # query parameters
418
+ query_params = opts[:query_params] || {}
419
+
420
+ # header parameters
421
+ header_params = opts[:header_params] || {}
422
+ # HTTP header 'Accept' (if needed)
423
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
424
+
425
+ # form parameters
426
+ form_params = opts[:form_params] || {}
427
+
428
+ # http body (model)
429
+ post_body = opts[:debug_body]
430
+
431
+ # return_type
432
+ return_type = opts[:debug_return_type] || 'FaucetTransaction'
433
+
434
+ # auth_names
435
+ auth_names = opts[:debug_auth_names] || []
436
+
437
+ new_options = opts.merge(
438
+ :operation => :"AddressesApi.request_faucet_funds",
439
+ :header_params => header_params,
440
+ :query_params => query_params,
441
+ :form_params => form_params,
442
+ :body => post_body,
443
+ :auth_names => auth_names,
444
+ :return_type => return_type
445
+ )
446
+
447
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
448
+ if @api_client.config.debugging
449
+ @api_client.config.logger.debug "API called: AddressesApi#request_faucet_funds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
450
+ end
451
+ return data, status_code, headers
452
+ end
384
453
  end
385
454
  end
@@ -19,6 +19,92 @@ module Coinbase::Client
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Broadcast a transfer
23
+ # Broadcast a transfer
24
+ # @param wallet_id [String] The ID of the wallet the address belongs to
25
+ # @param address_id [String] The ID of the address the transfer belongs to
26
+ # @param transfer_id [String] The ID of the transfer to broadcast
27
+ # @param broadcast_transfer_request [BroadcastTransferRequest]
28
+ # @param [Hash] opts the optional parameters
29
+ # @return [Transfer]
30
+ def broadcast_transfer(wallet_id, address_id, transfer_id, broadcast_transfer_request, opts = {})
31
+ data, _status_code, _headers = broadcast_transfer_with_http_info(wallet_id, address_id, transfer_id, broadcast_transfer_request, opts)
32
+ data
33
+ end
34
+
35
+ # Broadcast a transfer
36
+ # Broadcast a transfer
37
+ # @param wallet_id [String] The ID of the wallet the address belongs to
38
+ # @param address_id [String] The ID of the address the transfer belongs to
39
+ # @param transfer_id [String] The ID of the transfer to broadcast
40
+ # @param broadcast_transfer_request [BroadcastTransferRequest]
41
+ # @param [Hash] opts the optional parameters
42
+ # @return [Array<(Transfer, Integer, Hash)>] Transfer data, response status code and response headers
43
+ def broadcast_transfer_with_http_info(wallet_id, address_id, transfer_id, broadcast_transfer_request, opts = {})
44
+ if @api_client.config.debugging
45
+ @api_client.config.logger.debug 'Calling API: TransfersApi.broadcast_transfer ...'
46
+ end
47
+ # verify the required parameter 'wallet_id' is set
48
+ if @api_client.config.client_side_validation && wallet_id.nil?
49
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling TransfersApi.broadcast_transfer"
50
+ end
51
+ # verify the required parameter 'address_id' is set
52
+ if @api_client.config.client_side_validation && address_id.nil?
53
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling TransfersApi.broadcast_transfer"
54
+ end
55
+ # verify the required parameter 'transfer_id' is set
56
+ if @api_client.config.client_side_validation && transfer_id.nil?
57
+ fail ArgumentError, "Missing the required parameter 'transfer_id' when calling TransfersApi.broadcast_transfer"
58
+ end
59
+ # verify the required parameter 'broadcast_transfer_request' is set
60
+ if @api_client.config.client_side_validation && broadcast_transfer_request.nil?
61
+ fail ArgumentError, "Missing the required parameter 'broadcast_transfer_request' when calling TransfersApi.broadcast_transfer"
62
+ end
63
+ # resource path
64
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/transfers/{transfer_id}/broadcast'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'transfer_id' + '}', CGI.escape(transfer_id.to_s))
65
+
66
+ # query parameters
67
+ query_params = opts[:query_params] || {}
68
+
69
+ # header parameters
70
+ header_params = opts[:header_params] || {}
71
+ # HTTP header 'Accept' (if needed)
72
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
73
+ # HTTP header 'Content-Type'
74
+ content_type = @api_client.select_header_content_type(['application/json'])
75
+ if !content_type.nil?
76
+ header_params['Content-Type'] = content_type
77
+ end
78
+
79
+ # form parameters
80
+ form_params = opts[:form_params] || {}
81
+
82
+ # http body (model)
83
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(broadcast_transfer_request)
84
+
85
+ # return_type
86
+ return_type = opts[:debug_return_type] || 'Transfer'
87
+
88
+ # auth_names
89
+ auth_names = opts[:debug_auth_names] || []
90
+
91
+ new_options = opts.merge(
92
+ :operation => :"TransfersApi.broadcast_transfer",
93
+ :header_params => header_params,
94
+ :query_params => query_params,
95
+ :form_params => form_params,
96
+ :body => post_body,
97
+ :auth_names => auth_names,
98
+ :return_type => return_type
99
+ )
100
+
101
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
102
+ if @api_client.config.debugging
103
+ @api_client.config.logger.debug "API called: TransfersApi#broadcast_transfer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
104
+ end
105
+ return data, status_code, headers
106
+ end
107
+
22
108
  # Create a new transfer for an address
23
109
  # Create a new transfer
24
110
  # @param wallet_id [String] The ID of the wallet the source address belongs to