coinbase-sdk 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/coinbase/address/wallet_address.rb +70 -1
- data/lib/coinbase/address.rb +5 -1
- data/lib/coinbase/client/api/external_addresses_api.rb +0 -79
- data/lib/coinbase/client/api/smart_contracts_api.rb +332 -0
- data/lib/coinbase/client/api/stake_api.rb +0 -8
- data/lib/coinbase/client/api/transaction_history_api.rb +101 -0
- data/lib/coinbase/client/api/users_api.rb +79 -0
- data/lib/coinbase/client/api/validators_api.rb +4 -4
- data/lib/coinbase/client/api/wallets_api.rb +4 -4
- data/lib/coinbase/client/api/webhooks_api.rb +72 -2
- data/lib/coinbase/client/models/create_smart_contract_request.rb +259 -0
- data/lib/coinbase/client/models/create_wallet_webhook_request.rb +232 -0
- data/lib/coinbase/client/models/create_webhook_request.rb +10 -8
- data/lib/coinbase/client/models/deploy_smart_contract_request.rb +222 -0
- data/lib/coinbase/client/models/multi_token_contract_options.rb +223 -0
- data/lib/coinbase/client/models/network_identifier.rb +2 -1
- data/lib/coinbase/client/models/nft_contract_options.rb +257 -0
- data/lib/coinbase/client/models/smart_contract.rb +378 -0
- data/lib/coinbase/client/models/smart_contract_list.rb +257 -0
- data/lib/coinbase/client/models/smart_contract_options.rb +107 -0
- data/lib/coinbase/client/models/smart_contract_type.rb +42 -0
- data/lib/coinbase/client/models/staking_balance.rb +2 -2
- data/lib/coinbase/client/models/staking_reward.rb +2 -2
- data/lib/coinbase/client/models/token_contract_options.rb +257 -0
- data/lib/coinbase/client/models/update_webhook_request.rb +10 -8
- data/lib/coinbase/client/models/user.rb +231 -0
- data/lib/coinbase/client/models/webhook.rb +10 -1
- data/lib/coinbase/client/models/webhook_event_type.rb +2 -1
- data/lib/coinbase/client/models/webhook_event_type_filter.rb +105 -0
- data/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +228 -0
- data/lib/coinbase/client.rb +15 -0
- data/lib/coinbase/contract_invocation.rb +16 -17
- data/lib/coinbase/smart_contract.rb +264 -39
- data/lib/coinbase/transaction.rb +3 -0
- data/lib/coinbase/transfer.rb +1 -1
- data/lib/coinbase/version.rb +1 -1
- data/lib/coinbase/wallet.rb +45 -2
- data/lib/coinbase/webhook.rb +3 -7
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb84cbd1ab8caed73d5f13f149f99b93d002a680c767e8787dbc6f60fd72f7da
|
4
|
+
data.tar.gz: ec856cae3c68d140f162abb3566131cf8cc620927f539c7d8dbb090a9802d2a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 853736276f36210c32c051ebee8583f1596ce88eddb2e3b107a60fa78d3cfd34cf1b14ca05f30db464b5b4a418225e7af10129640c1830f22c38250ec2f64b54
|
7
|
+
data.tar.gz: 685826f02959985e2a36132db985f040588239936dc25df57f352ed38b8c5204e7ea67e6ef8f0b5695e2a03f7a0268bbb7ec3861efb795c99f543957f63c2b59
|
@@ -106,7 +106,7 @@ module Coinbase
|
|
106
106
|
# @param asset_id [Symbol] (Optional) The ID of the Asset to send to a payable contract method.
|
107
107
|
# The Asset must be a denomination of the native Asset. For Ethereum, :eth, :gwei, and :wei are supported.
|
108
108
|
# @return [Coinbase::ContractInvocation] The contract invocation object.
|
109
|
-
def invoke_contract(contract_address:,
|
109
|
+
def invoke_contract(contract_address:, method:, args:, abi: nil, amount: nil, asset_id: nil)
|
110
110
|
ensure_can_sign!
|
111
111
|
ensure_sufficient_balance!(amount, asset_id) if amount && asset_id
|
112
112
|
|
@@ -130,6 +130,75 @@ module Coinbase
|
|
130
130
|
invocation
|
131
131
|
end
|
132
132
|
|
133
|
+
# Deploys a new ERC20 token contract with the given name, symbol, and total supply.
|
134
|
+
# @param name [String] The name of the token.
|
135
|
+
# @param symbol [String] The symbol of the token.
|
136
|
+
# @param total_supply [Integer, BigDecimal] The total supply of the token, denominated in
|
137
|
+
# whole units.
|
138
|
+
# @return [Coinbase::SmartContract] The deployed token contract.
|
139
|
+
# @raise [AddressCannotSignError] if the Address does not have a private key backing it.
|
140
|
+
def deploy_token(name:, symbol:, total_supply:)
|
141
|
+
ensure_can_sign!
|
142
|
+
|
143
|
+
smart_contract = SmartContract.create_token_contract(
|
144
|
+
address_id: id,
|
145
|
+
wallet_id: wallet_id,
|
146
|
+
name: name,
|
147
|
+
symbol: symbol,
|
148
|
+
total_supply: total_supply
|
149
|
+
)
|
150
|
+
|
151
|
+
return smart_contract if Coinbase.use_server_signer?
|
152
|
+
|
153
|
+
smart_contract.sign(@key)
|
154
|
+
smart_contract.deploy!
|
155
|
+
smart_contract
|
156
|
+
end
|
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
|
+
|
133
202
|
# Signs the given unsigned payload.
|
134
203
|
# @param unsigned_payload [String] The hex-encoded hashed unsigned payload for the Address to sign.
|
135
204
|
# @return [Coinbase::PayloadSignature] The payload signature
|
data/lib/coinbase/address.rb
CHANGED
@@ -252,6 +252,10 @@ module Coinbase
|
|
252
252
|
@balance_history_api ||= Coinbase::Client::BalanceHistoryApi.new(Coinbase.configuration.api_client)
|
253
253
|
end
|
254
254
|
|
255
|
+
def transaction_history_api
|
256
|
+
@transaction_history_api ||= Coinbase::Client::TransactionHistoryApi.new(Coinbase.configuration.api_client)
|
257
|
+
end
|
258
|
+
|
255
259
|
def stake_api
|
256
260
|
@stake_api ||= Coinbase::Client::StakeApi.new(Coinbase.configuration.api_client)
|
257
261
|
end
|
@@ -266,7 +270,7 @@ module Coinbase
|
|
266
270
|
end
|
267
271
|
|
268
272
|
def list_transaction_page(page)
|
269
|
-
|
273
|
+
transaction_history_api.list_address_transactions(
|
270
274
|
network.normalized_id,
|
271
275
|
id,
|
272
276
|
{ limit: DEFAULT_TRANSACTION_PAGE_LIMIT, page: page }
|
@@ -94,85 +94,6 @@ 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.
|
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.
|
101
|
-
# @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)
|
107
|
-
data
|
108
|
-
end
|
109
|
-
|
110
|
-
# List transactions for an address.
|
111
|
-
# List all transactions that interact with the address.
|
112
|
-
# @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.
|
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 = {})
|
119
|
-
if @api_client.config.debugging
|
120
|
-
@api_client.config.logger.debug 'Calling API: ExternalAddressesApi.list_address_transactions ...'
|
121
|
-
end
|
122
|
-
# verify the required parameter 'network_id' is set
|
123
|
-
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"
|
125
|
-
end
|
126
|
-
# verify the required parameter 'address_id' is set
|
127
|
-
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"
|
129
|
-
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.'
|
132
|
-
end
|
133
|
-
|
134
|
-
# 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))
|
136
|
-
|
137
|
-
# query parameters
|
138
|
-
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
|
-
|
142
|
-
# header parameters
|
143
|
-
header_params = opts[:header_params] || {}
|
144
|
-
# HTTP header 'Accept' (if needed)
|
145
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
146
|
-
|
147
|
-
# form parameters
|
148
|
-
form_params = opts[:form_params] || {}
|
149
|
-
|
150
|
-
# http body (model)
|
151
|
-
post_body = opts[:debug_body]
|
152
|
-
|
153
|
-
# return_type
|
154
|
-
return_type = opts[:debug_return_type] || 'AddressTransactionList'
|
155
|
-
|
156
|
-
# auth_names
|
157
|
-
auth_names = opts[:debug_auth_names] || []
|
158
|
-
|
159
|
-
new_options = opts.merge(
|
160
|
-
:operation => :"ExternalAddressesApi.list_address_transactions",
|
161
|
-
:header_params => header_params,
|
162
|
-
:query_params => query_params,
|
163
|
-
:form_params => form_params,
|
164
|
-
:body => post_body,
|
165
|
-
:auth_names => auth_names,
|
166
|
-
:return_type => return_type
|
167
|
-
)
|
168
|
-
|
169
|
-
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
170
|
-
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}"
|
172
|
-
end
|
173
|
-
return data, status_code, headers
|
174
|
-
end
|
175
|
-
|
176
97
|
# Get the balances of an external address
|
177
98
|
# List all of the balances of an external address
|
178
99
|
# @param network_id [String] The ID of the blockchain network
|
@@ -0,0 +1,332 @@
|
|
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 SmartContractsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Create a new smart contract
|
23
|
+
# Create a new smart contract
|
24
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
25
|
+
# @param address_id [String] The ID of the address to deploy the smart contract from.
|
26
|
+
# @param create_smart_contract_request [CreateSmartContractRequest]
|
27
|
+
# @param [Hash] opts the optional parameters
|
28
|
+
# @return [SmartContract]
|
29
|
+
def create_smart_contract(wallet_id, address_id, create_smart_contract_request, opts = {})
|
30
|
+
data, _status_code, _headers = create_smart_contract_with_http_info(wallet_id, address_id, create_smart_contract_request, opts)
|
31
|
+
data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Create a new smart contract
|
35
|
+
# Create a new smart contract
|
36
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
37
|
+
# @param address_id [String] The ID of the address to deploy the smart contract from.
|
38
|
+
# @param create_smart_contract_request [CreateSmartContractRequest]
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [Array<(SmartContract, Integer, Hash)>] SmartContract data, response status code and response headers
|
41
|
+
def create_smart_contract_with_http_info(wallet_id, address_id, create_smart_contract_request, opts = {})
|
42
|
+
if @api_client.config.debugging
|
43
|
+
@api_client.config.logger.debug 'Calling API: SmartContractsApi.create_smart_contract ...'
|
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 SmartContractsApi.create_smart_contract"
|
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 SmartContractsApi.create_smart_contract"
|
52
|
+
end
|
53
|
+
# verify the required parameter 'create_smart_contract_request' is set
|
54
|
+
if @api_client.config.client_side_validation && create_smart_contract_request.nil?
|
55
|
+
fail ArgumentError, "Missing the required parameter 'create_smart_contract_request' when calling SmartContractsApi.create_smart_contract"
|
56
|
+
end
|
57
|
+
# resource path
|
58
|
+
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts'.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_smart_contract_request)
|
78
|
+
|
79
|
+
# return_type
|
80
|
+
return_type = opts[:debug_return_type] || 'SmartContract'
|
81
|
+
|
82
|
+
# auth_names
|
83
|
+
auth_names = opts[:debug_auth_names] || []
|
84
|
+
|
85
|
+
new_options = opts.merge(
|
86
|
+
:operation => :"SmartContractsApi.create_smart_contract",
|
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: SmartContractsApi#create_smart_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
98
|
+
end
|
99
|
+
return data, status_code, headers
|
100
|
+
end
|
101
|
+
|
102
|
+
# Deploy a smart contract
|
103
|
+
# Deploys a smart contract, by broadcasting the transaction to the network.
|
104
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
105
|
+
# @param address_id [String] The ID of the address to broadcast the transaction from.
|
106
|
+
# @param smart_contract_id [String] The UUID of the smart contract to broadcast the transaction to.
|
107
|
+
# @param deploy_smart_contract_request [DeploySmartContractRequest]
|
108
|
+
# @param [Hash] opts the optional parameters
|
109
|
+
# @return [SmartContract]
|
110
|
+
def deploy_smart_contract(wallet_id, address_id, smart_contract_id, deploy_smart_contract_request, opts = {})
|
111
|
+
data, _status_code, _headers = deploy_smart_contract_with_http_info(wallet_id, address_id, smart_contract_id, deploy_smart_contract_request, opts)
|
112
|
+
data
|
113
|
+
end
|
114
|
+
|
115
|
+
# Deploy a smart contract
|
116
|
+
# Deploys a smart contract, by broadcasting the transaction to the network.
|
117
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
118
|
+
# @param address_id [String] The ID of the address to broadcast the transaction from.
|
119
|
+
# @param smart_contract_id [String] The UUID of the smart contract to broadcast the transaction to.
|
120
|
+
# @param deploy_smart_contract_request [DeploySmartContractRequest]
|
121
|
+
# @param [Hash] opts the optional parameters
|
122
|
+
# @return [Array<(SmartContract, Integer, Hash)>] SmartContract data, response status code and response headers
|
123
|
+
def deploy_smart_contract_with_http_info(wallet_id, address_id, smart_contract_id, deploy_smart_contract_request, opts = {})
|
124
|
+
if @api_client.config.debugging
|
125
|
+
@api_client.config.logger.debug 'Calling API: SmartContractsApi.deploy_smart_contract ...'
|
126
|
+
end
|
127
|
+
# verify the required parameter 'wallet_id' is set
|
128
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
129
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling SmartContractsApi.deploy_smart_contract"
|
130
|
+
end
|
131
|
+
# verify the required parameter 'address_id' is set
|
132
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
133
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling SmartContractsApi.deploy_smart_contract"
|
134
|
+
end
|
135
|
+
# verify the required parameter 'smart_contract_id' is set
|
136
|
+
if @api_client.config.client_side_validation && smart_contract_id.nil?
|
137
|
+
fail ArgumentError, "Missing the required parameter 'smart_contract_id' when calling SmartContractsApi.deploy_smart_contract"
|
138
|
+
end
|
139
|
+
# verify the required parameter 'deploy_smart_contract_request' is set
|
140
|
+
if @api_client.config.client_side_validation && deploy_smart_contract_request.nil?
|
141
|
+
fail ArgumentError, "Missing the required parameter 'deploy_smart_contract_request' when calling SmartContractsApi.deploy_smart_contract"
|
142
|
+
end
|
143
|
+
# resource path
|
144
|
+
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}/deploy'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'smart_contract_id' + '}', CGI.escape(smart_contract_id.to_s))
|
145
|
+
|
146
|
+
# query parameters
|
147
|
+
query_params = opts[:query_params] || {}
|
148
|
+
|
149
|
+
# header parameters
|
150
|
+
header_params = opts[:header_params] || {}
|
151
|
+
# HTTP header 'Accept' (if needed)
|
152
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
153
|
+
# HTTP header 'Content-Type'
|
154
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
155
|
+
if !content_type.nil?
|
156
|
+
header_params['Content-Type'] = content_type
|
157
|
+
end
|
158
|
+
|
159
|
+
# form parameters
|
160
|
+
form_params = opts[:form_params] || {}
|
161
|
+
|
162
|
+
# http body (model)
|
163
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(deploy_smart_contract_request)
|
164
|
+
|
165
|
+
# return_type
|
166
|
+
return_type = opts[:debug_return_type] || 'SmartContract'
|
167
|
+
|
168
|
+
# auth_names
|
169
|
+
auth_names = opts[:debug_auth_names] || []
|
170
|
+
|
171
|
+
new_options = opts.merge(
|
172
|
+
:operation => :"SmartContractsApi.deploy_smart_contract",
|
173
|
+
:header_params => header_params,
|
174
|
+
:query_params => query_params,
|
175
|
+
:form_params => form_params,
|
176
|
+
:body => post_body,
|
177
|
+
:auth_names => auth_names,
|
178
|
+
:return_type => return_type
|
179
|
+
)
|
180
|
+
|
181
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
182
|
+
if @api_client.config.debugging
|
183
|
+
@api_client.config.logger.debug "API called: SmartContractsApi#deploy_smart_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
184
|
+
end
|
185
|
+
return data, status_code, headers
|
186
|
+
end
|
187
|
+
|
188
|
+
# Get a specific smart contract deployed by address
|
189
|
+
# Get a specific smart contract deployed by address.
|
190
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
191
|
+
# @param address_id [String] The ID of the address to fetch the smart contract for.
|
192
|
+
# @param smart_contract_id [String] The UUID of the smart contract to fetch.
|
193
|
+
# @param [Hash] opts the optional parameters
|
194
|
+
# @return [SmartContract]
|
195
|
+
def get_smart_contract(wallet_id, address_id, smart_contract_id, opts = {})
|
196
|
+
data, _status_code, _headers = get_smart_contract_with_http_info(wallet_id, address_id, smart_contract_id, opts)
|
197
|
+
data
|
198
|
+
end
|
199
|
+
|
200
|
+
# Get a specific smart contract deployed by address
|
201
|
+
# Get a specific smart contract deployed by address.
|
202
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
203
|
+
# @param address_id [String] The ID of the address to fetch the smart contract for.
|
204
|
+
# @param smart_contract_id [String] The UUID of the smart contract to fetch.
|
205
|
+
# @param [Hash] opts the optional parameters
|
206
|
+
# @return [Array<(SmartContract, Integer, Hash)>] SmartContract data, response status code and response headers
|
207
|
+
def get_smart_contract_with_http_info(wallet_id, address_id, smart_contract_id, opts = {})
|
208
|
+
if @api_client.config.debugging
|
209
|
+
@api_client.config.logger.debug 'Calling API: SmartContractsApi.get_smart_contract ...'
|
210
|
+
end
|
211
|
+
# verify the required parameter 'wallet_id' is set
|
212
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
213
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling SmartContractsApi.get_smart_contract"
|
214
|
+
end
|
215
|
+
# verify the required parameter 'address_id' is set
|
216
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
217
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling SmartContractsApi.get_smart_contract"
|
218
|
+
end
|
219
|
+
# verify the required parameter 'smart_contract_id' is set
|
220
|
+
if @api_client.config.client_side_validation && smart_contract_id.nil?
|
221
|
+
fail ArgumentError, "Missing the required parameter 'smart_contract_id' when calling SmartContractsApi.get_smart_contract"
|
222
|
+
end
|
223
|
+
# resource path
|
224
|
+
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'smart_contract_id' + '}', CGI.escape(smart_contract_id.to_s))
|
225
|
+
|
226
|
+
# query parameters
|
227
|
+
query_params = opts[:query_params] || {}
|
228
|
+
|
229
|
+
# header parameters
|
230
|
+
header_params = opts[:header_params] || {}
|
231
|
+
# HTTP header 'Accept' (if needed)
|
232
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
233
|
+
|
234
|
+
# form parameters
|
235
|
+
form_params = opts[:form_params] || {}
|
236
|
+
|
237
|
+
# http body (model)
|
238
|
+
post_body = opts[:debug_body]
|
239
|
+
|
240
|
+
# return_type
|
241
|
+
return_type = opts[:debug_return_type] || 'SmartContract'
|
242
|
+
|
243
|
+
# auth_names
|
244
|
+
auth_names = opts[:debug_auth_names] || []
|
245
|
+
|
246
|
+
new_options = opts.merge(
|
247
|
+
:operation => :"SmartContractsApi.get_smart_contract",
|
248
|
+
:header_params => header_params,
|
249
|
+
:query_params => query_params,
|
250
|
+
:form_params => form_params,
|
251
|
+
:body => post_body,
|
252
|
+
:auth_names => auth_names,
|
253
|
+
:return_type => return_type
|
254
|
+
)
|
255
|
+
|
256
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
257
|
+
if @api_client.config.debugging
|
258
|
+
@api_client.config.logger.debug "API called: SmartContractsApi#get_smart_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
259
|
+
end
|
260
|
+
return data, status_code, headers
|
261
|
+
end
|
262
|
+
|
263
|
+
# List smart contracts deployed by address
|
264
|
+
# List all smart contracts deployed by address.
|
265
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
266
|
+
# @param address_id [String] The ID of the address to fetch the smart contracts for.
|
267
|
+
# @param [Hash] opts the optional parameters
|
268
|
+
# @return [SmartContractList]
|
269
|
+
def list_smart_contracts(wallet_id, address_id, opts = {})
|
270
|
+
data, _status_code, _headers = list_smart_contracts_with_http_info(wallet_id, address_id, opts)
|
271
|
+
data
|
272
|
+
end
|
273
|
+
|
274
|
+
# List smart contracts deployed by address
|
275
|
+
# List all smart contracts deployed by address.
|
276
|
+
# @param wallet_id [String] The ID of the wallet the address belongs to.
|
277
|
+
# @param address_id [String] The ID of the address to fetch the smart contracts for.
|
278
|
+
# @param [Hash] opts the optional parameters
|
279
|
+
# @return [Array<(SmartContractList, Integer, Hash)>] SmartContractList data, response status code and response headers
|
280
|
+
def list_smart_contracts_with_http_info(wallet_id, address_id, opts = {})
|
281
|
+
if @api_client.config.debugging
|
282
|
+
@api_client.config.logger.debug 'Calling API: SmartContractsApi.list_smart_contracts ...'
|
283
|
+
end
|
284
|
+
# verify the required parameter 'wallet_id' is set
|
285
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
286
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling SmartContractsApi.list_smart_contracts"
|
287
|
+
end
|
288
|
+
# verify the required parameter 'address_id' is set
|
289
|
+
if @api_client.config.client_side_validation && address_id.nil?
|
290
|
+
fail ArgumentError, "Missing the required parameter 'address_id' when calling SmartContractsApi.list_smart_contracts"
|
291
|
+
end
|
292
|
+
# resource path
|
293
|
+
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
|
294
|
+
|
295
|
+
# query parameters
|
296
|
+
query_params = opts[:query_params] || {}
|
297
|
+
|
298
|
+
# header parameters
|
299
|
+
header_params = opts[:header_params] || {}
|
300
|
+
# HTTP header 'Accept' (if needed)
|
301
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
302
|
+
|
303
|
+
# form parameters
|
304
|
+
form_params = opts[:form_params] || {}
|
305
|
+
|
306
|
+
# http body (model)
|
307
|
+
post_body = opts[:debug_body]
|
308
|
+
|
309
|
+
# return_type
|
310
|
+
return_type = opts[:debug_return_type] || 'SmartContractList'
|
311
|
+
|
312
|
+
# auth_names
|
313
|
+
auth_names = opts[:debug_auth_names] || []
|
314
|
+
|
315
|
+
new_options = opts.merge(
|
316
|
+
:operation => :"SmartContractsApi.list_smart_contracts",
|
317
|
+
:header_params => header_params,
|
318
|
+
:query_params => query_params,
|
319
|
+
:form_params => form_params,
|
320
|
+
:body => post_body,
|
321
|
+
:auth_names => auth_names,
|
322
|
+
:return_type => return_type
|
323
|
+
)
|
324
|
+
|
325
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
326
|
+
if @api_client.config.debugging
|
327
|
+
@api_client.config.logger.debug "API called: SmartContractsApi#list_smart_contracts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
328
|
+
end
|
329
|
+
return data, status_code, headers
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
@@ -146,18 +146,10 @@ module Coinbase::Client
|
|
146
146
|
if @api_client.config.client_side_validation && start_time.nil?
|
147
147
|
fail ArgumentError, "Missing the required parameter 'start_time' when calling StakeApi.fetch_historical_staking_balances"
|
148
148
|
end
|
149
|
-
if @api_client.config.client_side_validation && start_time.to_s.length > 5000
|
150
|
-
fail ArgumentError, 'invalid value for "start_time" when calling StakeApi.fetch_historical_staking_balances, the character length must be smaller than or equal to 5000.'
|
151
|
-
end
|
152
|
-
|
153
149
|
# verify the required parameter 'end_time' is set
|
154
150
|
if @api_client.config.client_side_validation && end_time.nil?
|
155
151
|
fail ArgumentError, "Missing the required parameter 'end_time' when calling StakeApi.fetch_historical_staking_balances"
|
156
152
|
end
|
157
|
-
if @api_client.config.client_side_validation && end_time.to_s.length > 5000
|
158
|
-
fail ArgumentError, 'invalid value for "end_time" when calling StakeApi.fetch_historical_staking_balances, the character length must be smaller than or equal to 5000.'
|
159
|
-
end
|
160
|
-
|
161
153
|
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
162
154
|
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling StakeApi.fetch_historical_staking_balances, the character length must be smaller than or equal to 5000.'
|
163
155
|
end
|
@@ -0,0 +1,101 @@
|
|
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 TransactionHistoryApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# List transactions for an address.
|
23
|
+
# List all transactions that interact with the address.
|
24
|
+
# @param network_id [String] The ID of the blockchain network
|
25
|
+
# @param address_id [String] The ID of the address to fetch the transactions for.
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @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.
|
28
|
+
# @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.
|
29
|
+
# @return [AddressTransactionList]
|
30
|
+
def list_address_transactions(network_id, address_id, opts = {})
|
31
|
+
data, _status_code, _headers = list_address_transactions_with_http_info(network_id, address_id, opts)
|
32
|
+
data
|
33
|
+
end
|
34
|
+
|
35
|
+
# List transactions for an address.
|
36
|
+
# List all transactions that interact with the address.
|
37
|
+
# @param network_id [String] The ID of the blockchain network
|
38
|
+
# @param address_id [String] The ID of the address to fetch the transactions for.
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @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.
|
41
|
+
# @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.
|
42
|
+
# @return [Array<(AddressTransactionList, Integer, Hash)>] AddressTransactionList data, response status code and response headers
|
43
|
+
def list_address_transactions_with_http_info(network_id, address_id, opts = {})
|
44
|
+
if @api_client.config.debugging
|
45
|
+
@api_client.config.logger.debug 'Calling API: TransactionHistoryApi.list_address_transactions ...'
|
46
|
+
end
|
47
|
+
# verify the required parameter 'network_id' is set
|
48
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
49
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling TransactionHistoryApi.list_address_transactions"
|
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 TransactionHistoryApi.list_address_transactions"
|
54
|
+
end
|
55
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
56
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TransactionHistoryApi.list_address_transactions, the character length must be smaller than or equal to 5000.'
|
57
|
+
end
|
58
|
+
|
59
|
+
# resource path
|
60
|
+
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))
|
61
|
+
|
62
|
+
# query parameters
|
63
|
+
query_params = opts[:query_params] || {}
|
64
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
65
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
66
|
+
|
67
|
+
# header parameters
|
68
|
+
header_params = opts[:header_params] || {}
|
69
|
+
# HTTP header 'Accept' (if needed)
|
70
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
71
|
+
|
72
|
+
# form parameters
|
73
|
+
form_params = opts[:form_params] || {}
|
74
|
+
|
75
|
+
# http body (model)
|
76
|
+
post_body = opts[:debug_body]
|
77
|
+
|
78
|
+
# return_type
|
79
|
+
return_type = opts[:debug_return_type] || 'AddressTransactionList'
|
80
|
+
|
81
|
+
# auth_names
|
82
|
+
auth_names = opts[:debug_auth_names] || []
|
83
|
+
|
84
|
+
new_options = opts.merge(
|
85
|
+
:operation => :"TransactionHistoryApi.list_address_transactions",
|
86
|
+
:header_params => header_params,
|
87
|
+
:query_params => query_params,
|
88
|
+
:form_params => form_params,
|
89
|
+
:body => post_body,
|
90
|
+
:auth_names => auth_names,
|
91
|
+
:return_type => return_type
|
92
|
+
)
|
93
|
+
|
94
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
95
|
+
if @api_client.config.debugging
|
96
|
+
@api_client.config.logger.debug "API called: TransactionHistoryApi#list_address_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
97
|
+
end
|
98
|
+
return data, status_code, headers
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|