coinbase-sdk 0.6.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 +44 -0
- data/lib/coinbase/address.rb +5 -1
- data/lib/coinbase/client/api/external_addresses_api.rb +0 -79
- data/lib/coinbase/client/api/transaction_history_api.rb +101 -0
- data/lib/coinbase/client/api/webhooks_api.rb +72 -2
- data/lib/coinbase/client/models/create_wallet_webhook_request.rb +232 -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 +21 -4
- data/lib/coinbase/client/models/smart_contract_options.rb +1 -0
- data/lib/coinbase/client/models/smart_contract_type.rb +2 -1
- data/lib/coinbase/client.rb +2 -0
- data/lib/coinbase/smart_contract.rb +54 -0
- data/lib/coinbase/version.rb +1 -1
- data/lib/coinbase/wallet.rb +35 -1
- data/lib/coinbase/webhook.rb +3 -7
- metadata +5 -3
- data/lib/coinbase/client/models/feature.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 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
|
@@ -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
|
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,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
|
@@ -19,6 +19,76 @@ module Coinbase::Client
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
# Create a new webhook scoped to a wallet
|
23
|
+
# Create a new webhook scoped to a wallet
|
24
|
+
# @param wallet_id [String] The ID of the wallet to create the webhook for.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @option opts [CreateWalletWebhookRequest] :create_wallet_webhook_request
|
27
|
+
# @return [Webhook]
|
28
|
+
def create_wallet_webhook(wallet_id, opts = {})
|
29
|
+
data, _status_code, _headers = create_wallet_webhook_with_http_info(wallet_id, opts)
|
30
|
+
data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Create a new webhook scoped to a wallet
|
34
|
+
# Create a new webhook scoped to a wallet
|
35
|
+
# @param wallet_id [String] The ID of the wallet to create the webhook for.
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @option opts [CreateWalletWebhookRequest] :create_wallet_webhook_request
|
38
|
+
# @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
|
39
|
+
def create_wallet_webhook_with_http_info(wallet_id, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.create_wallet_webhook ...'
|
42
|
+
end
|
43
|
+
# verify the required parameter 'wallet_id' is set
|
44
|
+
if @api_client.config.client_side_validation && wallet_id.nil?
|
45
|
+
fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WebhooksApi.create_wallet_webhook"
|
46
|
+
end
|
47
|
+
# resource path
|
48
|
+
local_var_path = '/v1/wallets/{wallet_id}/webhooks'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s))
|
49
|
+
|
50
|
+
# query parameters
|
51
|
+
query_params = opts[:query_params] || {}
|
52
|
+
|
53
|
+
# header parameters
|
54
|
+
header_params = opts[:header_params] || {}
|
55
|
+
# HTTP header 'Accept' (if needed)
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
57
|
+
# HTTP header 'Content-Type'
|
58
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
59
|
+
if !content_type.nil?
|
60
|
+
header_params['Content-Type'] = content_type
|
61
|
+
end
|
62
|
+
|
63
|
+
# form parameters
|
64
|
+
form_params = opts[:form_params] || {}
|
65
|
+
|
66
|
+
# http body (model)
|
67
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_wallet_webhook_request'])
|
68
|
+
|
69
|
+
# return_type
|
70
|
+
return_type = opts[:debug_return_type] || 'Webhook'
|
71
|
+
|
72
|
+
# auth_names
|
73
|
+
auth_names = opts[:debug_auth_names] || []
|
74
|
+
|
75
|
+
new_options = opts.merge(
|
76
|
+
:operation => :"WebhooksApi.create_wallet_webhook",
|
77
|
+
:header_params => header_params,
|
78
|
+
:query_params => query_params,
|
79
|
+
:form_params => form_params,
|
80
|
+
:body => post_body,
|
81
|
+
:auth_names => auth_names,
|
82
|
+
:return_type => return_type
|
83
|
+
)
|
84
|
+
|
85
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
86
|
+
if @api_client.config.debugging
|
87
|
+
@api_client.config.logger.debug "API called: WebhooksApi#create_wallet_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
88
|
+
end
|
89
|
+
return data, status_code, headers
|
90
|
+
end
|
91
|
+
|
22
92
|
# Create a new webhook
|
23
93
|
# Create a new webhook
|
24
94
|
# @param [Hash] opts the optional parameters
|
@@ -51,7 +121,7 @@ module Coinbase::Client
|
|
51
121
|
# HTTP header 'Content-Type'
|
52
122
|
content_type = @api_client.select_header_content_type(['application/json'])
|
53
123
|
if !content_type.nil?
|
54
|
-
|
124
|
+
header_params['Content-Type'] = content_type
|
55
125
|
end
|
56
126
|
|
57
127
|
# form parameters
|
@@ -251,7 +321,7 @@ module Coinbase::Client
|
|
251
321
|
# HTTP header 'Content-Type'
|
252
322
|
content_type = @api_client.select_header_content_type(['application/json'])
|
253
323
|
if !content_type.nil?
|
254
|
-
|
324
|
+
header_params['Content-Type'] = content_type
|
255
325
|
end
|
256
326
|
|
257
327
|
# form parameters
|
@@ -0,0 +1,232 @@
|
|
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 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
class CreateWalletWebhookRequest
|
18
|
+
# The URL to which the notifications will be sent
|
19
|
+
attr_accessor :notification_uri
|
20
|
+
|
21
|
+
# The custom header to be used for x-webhook-signature header on callbacks, so developers can verify the requests are coming from Coinbase.
|
22
|
+
attr_accessor :signature_header
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'notification_uri' => :'notification_uri',
|
28
|
+
:'signature_header' => :'signature_header'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns all the JSON keys this model knows about
|
33
|
+
def self.acceptable_attributes
|
34
|
+
attribute_map.values
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.openapi_types
|
39
|
+
{
|
40
|
+
:'notification_uri' => :'String',
|
41
|
+
:'signature_header' => :'String'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of attributes with nullable: true
|
46
|
+
def self.openapi_nullable
|
47
|
+
Set.new([
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
if (!attributes.is_a?(Hash))
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::CreateWalletWebhookRequest` initialize method"
|
56
|
+
end
|
57
|
+
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::CreateWalletWebhookRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
62
|
+
end
|
63
|
+
h[k.to_sym] = v
|
64
|
+
}
|
65
|
+
|
66
|
+
if attributes.key?(:'notification_uri')
|
67
|
+
self.notification_uri = attributes[:'notification_uri']
|
68
|
+
else
|
69
|
+
self.notification_uri = nil
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'signature_header')
|
73
|
+
self.signature_header = attributes[:'signature_header']
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
78
|
+
# @return Array for valid properties with the reasons
|
79
|
+
def list_invalid_properties
|
80
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
81
|
+
invalid_properties = Array.new
|
82
|
+
if @notification_uri.nil?
|
83
|
+
invalid_properties.push('invalid value for "notification_uri", notification_uri cannot be nil.')
|
84
|
+
end
|
85
|
+
|
86
|
+
invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
93
|
+
return false if @notification_uri.nil?
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
# Checks equality by comparing each attribute.
|
98
|
+
# @param [Object] Object to be compared
|
99
|
+
def ==(o)
|
100
|
+
return true if self.equal?(o)
|
101
|
+
self.class == o.class &&
|
102
|
+
notification_uri == o.notification_uri &&
|
103
|
+
signature_header == o.signature_header
|
104
|
+
end
|
105
|
+
|
106
|
+
# @see the `==` method
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def eql?(o)
|
109
|
+
self == o
|
110
|
+
end
|
111
|
+
|
112
|
+
# Calculates hash code according to all attributes.
|
113
|
+
# @return [Integer] Hash code
|
114
|
+
def hash
|
115
|
+
[notification_uri, signature_header].hash
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def self.build_from_hash(attributes)
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
123
|
+
attributes = attributes.transform_keys(&:to_sym)
|
124
|
+
transformed_hash = {}
|
125
|
+
openapi_types.each_pair do |key, type|
|
126
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
127
|
+
transformed_hash["#{key}"] = nil
|
128
|
+
elsif type =~ /\AArray<(.*)>/i
|
129
|
+
# check to ensure the input is an array given that the attribute
|
130
|
+
# is documented as an array but the input is not
|
131
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
132
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
133
|
+
end
|
134
|
+
elsif !attributes[attribute_map[key]].nil?
|
135
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
136
|
+
end
|
137
|
+
end
|
138
|
+
new(transformed_hash)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Deserializes the data based on type
|
142
|
+
# @param string type Data type
|
143
|
+
# @param string value Value to be deserialized
|
144
|
+
# @return [Object] Deserialized data
|
145
|
+
def self._deserialize(type, value)
|
146
|
+
case type.to_sym
|
147
|
+
when :Time
|
148
|
+
Time.parse(value)
|
149
|
+
when :Date
|
150
|
+
Date.parse(value)
|
151
|
+
when :String
|
152
|
+
value.to_s
|
153
|
+
when :Integer
|
154
|
+
value.to_i
|
155
|
+
when :Float
|
156
|
+
value.to_f
|
157
|
+
when :Boolean
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
159
|
+
true
|
160
|
+
else
|
161
|
+
false
|
162
|
+
end
|
163
|
+
when :Object
|
164
|
+
# generic object (usually a Hash), return directly
|
165
|
+
value
|
166
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
167
|
+
inner_type = Regexp.last_match[:inner_type]
|
168
|
+
value.map { |v| _deserialize(inner_type, v) }
|
169
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
170
|
+
k_type = Regexp.last_match[:k_type]
|
171
|
+
v_type = Regexp.last_match[:v_type]
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each do |k, v|
|
174
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
else # model
|
178
|
+
# models (e.g. Pet) or oneOf
|
179
|
+
klass = Coinbase::Client.const_get(type)
|
180
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the string representation of the object
|
185
|
+
# @return [String] String presentation of the object
|
186
|
+
def to_s
|
187
|
+
to_hash.to_s
|
188
|
+
end
|
189
|
+
|
190
|
+
# to_body is an alias to to_hash (backward compatibility)
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_body
|
193
|
+
to_hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns the object in the form of hash
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
198
|
+
def to_hash
|
199
|
+
hash = {}
|
200
|
+
self.class.attribute_map.each_pair do |attr, param|
|
201
|
+
value = self.send(attr)
|
202
|
+
if value.nil?
|
203
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
204
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
205
|
+
end
|
206
|
+
|
207
|
+
hash[param] = _to_hash(value)
|
208
|
+
end
|
209
|
+
hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Outputs non-array value in the form of hash
|
213
|
+
# For object, use to_hash. Otherwise, just return the value
|
214
|
+
# @param [Object] value Any valid value
|
215
|
+
# @return [Hash] Returns the value in the form of hash
|
216
|
+
def _to_hash(value)
|
217
|
+
if value.is_a?(Array)
|
218
|
+
value.compact.map { |v| _to_hash(v) }
|
219
|
+
elsif value.is_a?(Hash)
|
220
|
+
{}.tap do |hash|
|
221
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
222
|
+
end
|
223
|
+
elsif value.respond_to? :to_hash
|
224
|
+
value.to_hash
|
225
|
+
else
|
226
|
+
value
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
@@ -0,0 +1,223 @@
|
|
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 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# Options for multi-token contract creation
|
18
|
+
class MultiTokenContractOptions
|
19
|
+
# The URI for all token metadata
|
20
|
+
attr_accessor :uri
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'uri' => :'uri'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns all the JSON keys this model knows about
|
30
|
+
def self.acceptable_attributes
|
31
|
+
attribute_map.values
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:'uri' => :'String'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# List of attributes with nullable: true
|
42
|
+
def self.openapi_nullable
|
43
|
+
Set.new([
|
44
|
+
])
|
45
|
+
end
|
46
|
+
|
47
|
+
# Initializes the object
|
48
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
49
|
+
def initialize(attributes = {})
|
50
|
+
if (!attributes.is_a?(Hash))
|
51
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::MultiTokenContractOptions` initialize method"
|
52
|
+
end
|
53
|
+
|
54
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
55
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
56
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
57
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::MultiTokenContractOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
58
|
+
end
|
59
|
+
h[k.to_sym] = v
|
60
|
+
}
|
61
|
+
|
62
|
+
if attributes.key?(:'uri')
|
63
|
+
self.uri = attributes[:'uri']
|
64
|
+
else
|
65
|
+
self.uri = nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
73
|
+
invalid_properties = Array.new
|
74
|
+
if @uri.nil?
|
75
|
+
invalid_properties.push('invalid value for "uri", uri cannot be nil.')
|
76
|
+
end
|
77
|
+
|
78
|
+
invalid_properties
|
79
|
+
end
|
80
|
+
|
81
|
+
# Check to see if the all the properties in the model are valid
|
82
|
+
# @return true if the model is valid
|
83
|
+
def valid?
|
84
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
85
|
+
return false if @uri.nil?
|
86
|
+
true
|
87
|
+
end
|
88
|
+
|
89
|
+
# Checks equality by comparing each attribute.
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def ==(o)
|
92
|
+
return true if self.equal?(o)
|
93
|
+
self.class == o.class &&
|
94
|
+
uri == o.uri
|
95
|
+
end
|
96
|
+
|
97
|
+
# @see the `==` method
|
98
|
+
# @param [Object] Object to be compared
|
99
|
+
def eql?(o)
|
100
|
+
self == o
|
101
|
+
end
|
102
|
+
|
103
|
+
# Calculates hash code according to all attributes.
|
104
|
+
# @return [Integer] Hash code
|
105
|
+
def hash
|
106
|
+
[uri].hash
|
107
|
+
end
|
108
|
+
|
109
|
+
# Builds the object from hash
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
+
# @return [Object] Returns the model itself
|
112
|
+
def self.build_from_hash(attributes)
|
113
|
+
return nil unless attributes.is_a?(Hash)
|
114
|
+
attributes = attributes.transform_keys(&:to_sym)
|
115
|
+
transformed_hash = {}
|
116
|
+
openapi_types.each_pair do |key, type|
|
117
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
118
|
+
transformed_hash["#{key}"] = nil
|
119
|
+
elsif type =~ /\AArray<(.*)>/i
|
120
|
+
# check to ensure the input is an array given that the attribute
|
121
|
+
# is documented as an array but the input is not
|
122
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
123
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
124
|
+
end
|
125
|
+
elsif !attributes[attribute_map[key]].nil?
|
126
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
127
|
+
end
|
128
|
+
end
|
129
|
+
new(transformed_hash)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Deserializes the data based on type
|
133
|
+
# @param string type Data type
|
134
|
+
# @param string value Value to be deserialized
|
135
|
+
# @return [Object] Deserialized data
|
136
|
+
def self._deserialize(type, value)
|
137
|
+
case type.to_sym
|
138
|
+
when :Time
|
139
|
+
Time.parse(value)
|
140
|
+
when :Date
|
141
|
+
Date.parse(value)
|
142
|
+
when :String
|
143
|
+
value.to_s
|
144
|
+
when :Integer
|
145
|
+
value.to_i
|
146
|
+
when :Float
|
147
|
+
value.to_f
|
148
|
+
when :Boolean
|
149
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
150
|
+
true
|
151
|
+
else
|
152
|
+
false
|
153
|
+
end
|
154
|
+
when :Object
|
155
|
+
# generic object (usually a Hash), return directly
|
156
|
+
value
|
157
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
158
|
+
inner_type = Regexp.last_match[:inner_type]
|
159
|
+
value.map { |v| _deserialize(inner_type, v) }
|
160
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
161
|
+
k_type = Regexp.last_match[:k_type]
|
162
|
+
v_type = Regexp.last_match[:v_type]
|
163
|
+
{}.tap do |hash|
|
164
|
+
value.each do |k, v|
|
165
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
else # model
|
169
|
+
# models (e.g. Pet) or oneOf
|
170
|
+
klass = Coinbase::Client.const_get(type)
|
171
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Returns the string representation of the object
|
176
|
+
# @return [String] String presentation of the object
|
177
|
+
def to_s
|
178
|
+
to_hash.to_s
|
179
|
+
end
|
180
|
+
|
181
|
+
# to_body is an alias to to_hash (backward compatibility)
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
183
|
+
def to_body
|
184
|
+
to_hash
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the object in the form of hash
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_hash
|
190
|
+
hash = {}
|
191
|
+
self.class.attribute_map.each_pair do |attr, param|
|
192
|
+
value = self.send(attr)
|
193
|
+
if value.nil?
|
194
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
195
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
196
|
+
end
|
197
|
+
|
198
|
+
hash[param] = _to_hash(value)
|
199
|
+
end
|
200
|
+
hash
|
201
|
+
end
|
202
|
+
|
203
|
+
# Outputs non-array value in the form of hash
|
204
|
+
# For object, use to_hash. Otherwise, just return the value
|
205
|
+
# @param [Object] value Any valid value
|
206
|
+
# @return [Hash] Returns the value in the form of hash
|
207
|
+
def _to_hash(value)
|
208
|
+
if value.is_a?(Array)
|
209
|
+
value.compact.map { |v| _to_hash(v) }
|
210
|
+
elsif value.is_a?(Hash)
|
211
|
+
{}.tap do |hash|
|
212
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
213
|
+
end
|
214
|
+
elsif value.respond_to? :to_hash
|
215
|
+
value.to_hash
|
216
|
+
else
|
217
|
+
value
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
@@ -21,11 +21,12 @@ module Coinbase::Client
|
|
21
21
|
ETHEREUM_MAINNET = "ethereum-mainnet".freeze
|
22
22
|
POLYGON_MAINNET = "polygon-mainnet".freeze
|
23
23
|
SOLANA_DEVNET = "solana-devnet".freeze
|
24
|
+
SOLANA_MAINNET = "solana-mainnet".freeze
|
24
25
|
ARBITRUM_MAINNET = "arbitrum-mainnet".freeze
|
25
26
|
UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
|
26
27
|
|
27
28
|
def self.all_vars
|
28
|
-
@all_vars ||= [BASE_SEPOLIA, BASE_MAINNET, ETHEREUM_HOLESKY, ETHEREUM_MAINNET, POLYGON_MAINNET, SOLANA_DEVNET, ARBITRUM_MAINNET, UNKNOWN_DEFAULT_OPEN_API].freeze
|
29
|
+
@all_vars ||= [BASE_SEPOLIA, BASE_MAINNET, ETHEREUM_HOLESKY, ETHEREUM_MAINNET, POLYGON_MAINNET, SOLANA_DEVNET, SOLANA_MAINNET, ARBITRUM_MAINNET, UNKNOWN_DEFAULT_OPEN_API].freeze
|
29
30
|
end
|
30
31
|
|
31
32
|
# Builds the enum from string
|
@@ -22,11 +22,15 @@ module Coinbase::Client
|
|
22
22
|
# The symbol of the NFT
|
23
23
|
attr_accessor :symbol
|
24
24
|
|
25
|
+
# The base URI for the NFT metadata
|
26
|
+
attr_accessor :base_uri
|
27
|
+
|
25
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
29
|
def self.attribute_map
|
27
30
|
{
|
28
31
|
:'name' => :'name',
|
29
|
-
:'symbol' => :'symbol'
|
32
|
+
:'symbol' => :'symbol',
|
33
|
+
:'base_uri' => :'base_uri'
|
30
34
|
}
|
31
35
|
end
|
32
36
|
|
@@ -39,7 +43,8 @@ module Coinbase::Client
|
|
39
43
|
def self.openapi_types
|
40
44
|
{
|
41
45
|
:'name' => :'String',
|
42
|
-
:'symbol' => :'String'
|
46
|
+
:'symbol' => :'String',
|
47
|
+
:'base_uri' => :'String'
|
43
48
|
}
|
44
49
|
end
|
45
50
|
|
@@ -75,6 +80,12 @@ module Coinbase::Client
|
|
75
80
|
else
|
76
81
|
self.symbol = nil
|
77
82
|
end
|
83
|
+
|
84
|
+
if attributes.key?(:'base_uri')
|
85
|
+
self.base_uri = attributes[:'base_uri']
|
86
|
+
else
|
87
|
+
self.base_uri = nil
|
88
|
+
end
|
78
89
|
end
|
79
90
|
|
80
91
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -90,6 +101,10 @@ module Coinbase::Client
|
|
90
101
|
invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
|
91
102
|
end
|
92
103
|
|
104
|
+
if @base_uri.nil?
|
105
|
+
invalid_properties.push('invalid value for "base_uri", base_uri cannot be nil.')
|
106
|
+
end
|
107
|
+
|
93
108
|
invalid_properties
|
94
109
|
end
|
95
110
|
|
@@ -99,6 +114,7 @@ module Coinbase::Client
|
|
99
114
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
100
115
|
return false if @name.nil?
|
101
116
|
return false if @symbol.nil?
|
117
|
+
return false if @base_uri.nil?
|
102
118
|
true
|
103
119
|
end
|
104
120
|
|
@@ -108,7 +124,8 @@ module Coinbase::Client
|
|
108
124
|
return true if self.equal?(o)
|
109
125
|
self.class == o.class &&
|
110
126
|
name == o.name &&
|
111
|
-
symbol == o.symbol
|
127
|
+
symbol == o.symbol &&
|
128
|
+
base_uri == o.base_uri
|
112
129
|
end
|
113
130
|
|
114
131
|
# @see the `==` method
|
@@ -120,7 +137,7 @@ module Coinbase::Client
|
|
120
137
|
# Calculates hash code according to all attributes.
|
121
138
|
# @return [Integer] Hash code
|
122
139
|
def hash
|
123
|
-
[name, symbol].hash
|
140
|
+
[name, symbol, base_uri].hash
|
124
141
|
end
|
125
142
|
|
126
143
|
# Builds the object from hash
|
@@ -17,10 +17,11 @@ module Coinbase::Client
|
|
17
17
|
class SmartContractType
|
18
18
|
ERC20 = "erc20".freeze
|
19
19
|
ERC721 = "erc721".freeze
|
20
|
+
ERC1155 = "erc1155".freeze
|
20
21
|
UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
|
21
22
|
|
22
23
|
def self.all_vars
|
23
|
-
@all_vars ||= [ERC20, ERC721, UNKNOWN_DEFAULT_OPEN_API].freeze
|
24
|
+
@all_vars ||= [ERC20, ERC721, ERC1155, UNKNOWN_DEFAULT_OPEN_API].freeze
|
24
25
|
end
|
25
26
|
|
26
27
|
# Builds the enum from string
|
data/lib/coinbase/client.rb
CHANGED
@@ -60,6 +60,7 @@ Coinbase::Client.autoload :FetchStakingRewards200Response, 'coinbase/client/mode
|
|
60
60
|
Coinbase::Client.autoload :FetchStakingRewardsRequest, 'coinbase/client/models/fetch_staking_rewards_request'
|
61
61
|
Coinbase::Client.autoload :GetStakingContextRequest, 'coinbase/client/models/get_staking_context_request'
|
62
62
|
Coinbase::Client.autoload :HistoricalBalance, 'coinbase/client/models/historical_balance'
|
63
|
+
Coinbase::Client.autoload :MultiTokenContractOptions, 'coinbase/client/models/multi_token_contract_options'
|
63
64
|
Coinbase::Client.autoload :NFTContractOptions, 'coinbase/client/models/nft_contract_options'
|
64
65
|
Coinbase::Client.autoload :Network, 'coinbase/client/models/network'
|
65
66
|
Coinbase::Client.autoload :NetworkIdentifier, 'coinbase/client/models/network_identifier'
|
@@ -123,6 +124,7 @@ Coinbase::Client.autoload :ServerSignersApi, 'coinbase/client/api/server_signers
|
|
123
124
|
Coinbase::Client.autoload :SmartContractsApi, 'coinbase/client/api/smart_contracts_api'
|
124
125
|
Coinbase::Client.autoload :StakeApi, 'coinbase/client/api/stake_api'
|
125
126
|
Coinbase::Client.autoload :TradesApi, 'coinbase/client/api/trades_api'
|
127
|
+
Coinbase::Client.autoload :TransactionHistoryApi, 'coinbase/client/api/transaction_history_api'
|
126
128
|
Coinbase::Client.autoload :TransfersApi, 'coinbase/client/api/transfers_api'
|
127
129
|
Coinbase::Client.autoload :UsersApi, 'coinbase/client/api/users_api'
|
128
130
|
Coinbase::Client.autoload :ValidatorsApi, 'coinbase/client/api/validators_api'
|
@@ -72,6 +72,60 @@ module Coinbase
|
|
72
72
|
new(contract)
|
73
73
|
end
|
74
74
|
|
75
|
+
# Creates a new ERC721 token contract, that can subsequently be deployed to
|
76
|
+
# the blockchain.
|
77
|
+
# @param address_id [String] The address ID of deployer
|
78
|
+
# @param wallet_id [String] The wallet ID of the deployer
|
79
|
+
# @param name [String] The name of the token
|
80
|
+
# @param symbol [String] The symbol of the token
|
81
|
+
# @param base_uri [String] The base URI for the token metadata
|
82
|
+
# @return [SmartContract] The new ERC721 Token SmartContract object
|
83
|
+
def self.create_nft_contract(
|
84
|
+
address_id:,
|
85
|
+
wallet_id:,
|
86
|
+
name:,
|
87
|
+
symbol:,
|
88
|
+
base_uri:
|
89
|
+
)
|
90
|
+
contract = Coinbase.call_api do
|
91
|
+
smart_contracts_api.create_smart_contract(
|
92
|
+
wallet_id,
|
93
|
+
address_id,
|
94
|
+
{
|
95
|
+
type: Coinbase::Client::SmartContractType::ERC721,
|
96
|
+
options: Coinbase::Client::NFTContractOptions.new(
|
97
|
+
name: name,
|
98
|
+
symbol: symbol,
|
99
|
+
base_uri: base_uri
|
100
|
+
).to_body
|
101
|
+
}
|
102
|
+
)
|
103
|
+
end
|
104
|
+
|
105
|
+
new(contract)
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.create_multi_token_contract(
|
109
|
+
address_id:,
|
110
|
+
wallet_id:,
|
111
|
+
uri:
|
112
|
+
)
|
113
|
+
contract = Coinbase.call_api do
|
114
|
+
smart_contracts_api.create_smart_contract(
|
115
|
+
wallet_id,
|
116
|
+
address_id,
|
117
|
+
{
|
118
|
+
type: Coinbase::Client::SmartContractType::ERC1155,
|
119
|
+
options: Coinbase::Client::MultiTokenContractOptions.new(
|
120
|
+
uri: uri
|
121
|
+
).to_body
|
122
|
+
}
|
123
|
+
)
|
124
|
+
end
|
125
|
+
|
126
|
+
new(contract)
|
127
|
+
end
|
128
|
+
|
75
129
|
def self.contract_events_api
|
76
130
|
Coinbase::Client::ContractEventsApi.new(Coinbase.configuration.api_client)
|
77
131
|
end
|
data/lib/coinbase/version.rb
CHANGED
data/lib/coinbase/wallet.rb
CHANGED
@@ -244,9 +244,23 @@ module Coinbase
|
|
244
244
|
# @return [Coinbase::SmartContract] The deployed token contract.
|
245
245
|
# @raise [AddressCannotSignError] if the Address does not have a private key backing it.
|
246
246
|
|
247
|
+
# @!method deploy_nft
|
248
|
+
# Deploys a new ERC721 NFT contract with the given name, symbol, and base URI.
|
249
|
+
# @param name [String] The name of the NFT contract.
|
250
|
+
# @param symbol [String] The symbol of the NFT contract.
|
251
|
+
# @param base_uri [String] The base URI for the NFT contract.
|
252
|
+
# @return [Coinbase::SmartContract] The deployed NFT contract.
|
253
|
+
# @raise [AddressCannotSignError] if the Address does not have a private key backing it.
|
254
|
+
|
255
|
+
# @!method deploy_multi_token
|
256
|
+
# Deploys a new ERC1155 multi-token contract with the given URI.
|
257
|
+
# @param uri [String] The URI for the token metadata, where {id} will be replaced with the token ID.
|
258
|
+
# @return [Coinbase::SmartContract] The deployed multi-token contract.
|
259
|
+
# @raise [AddressCannotSignError] if the Address does not have a private key backing it.
|
260
|
+
|
247
261
|
def_delegators :default_address, :transfer, :trade, :faucet, :stake, :unstake, :claim_stake, :staking_balances,
|
248
262
|
:stakeable_balance, :unstakeable_balance, :claimable_balance, :sign_payload, :invoke_contract,
|
249
|
-
:deploy_token
|
263
|
+
:deploy_token, :deploy_nft, :deploy_multi_token
|
250
264
|
|
251
265
|
# Returns the addresses belonging to the Wallet.
|
252
266
|
# @return [Array<Coinbase::WalletAddress>] The addresses belonging to the Wallet
|
@@ -468,6 +482,22 @@ module Coinbase
|
|
468
482
|
"Successfully loaded seed for wallet #{id} from #{file_path}."
|
469
483
|
end
|
470
484
|
|
485
|
+
# Creates a new webhook on the current wallet for tracking wallet activity events.
|
486
|
+
#
|
487
|
+
# @param notification_uri [String] The URI to which the webhook notifications will be sent.
|
488
|
+
#
|
489
|
+
# @return [Coinbase::Client::Webhook] The newly created webhook instance.
|
490
|
+
def create_webhook(notification_uri:)
|
491
|
+
Coinbase.call_api do
|
492
|
+
webhooks_api.create_wallet_webhook(
|
493
|
+
id,
|
494
|
+
create_wallet_webhook_request: {
|
495
|
+
notification_uri: notification_uri
|
496
|
+
}
|
497
|
+
)
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
471
501
|
# Returns a String representation of the Wallet.
|
472
502
|
# @return [String] a String representation of the Wallet
|
473
503
|
def to_s
|
@@ -592,6 +622,10 @@ module Coinbase
|
|
592
622
|
@wallets_api ||= Coinbase::Client::WalletsApi.new(Coinbase.configuration.api_client)
|
593
623
|
end
|
594
624
|
|
625
|
+
def webhooks_api
|
626
|
+
@webhooks_api ||= Coinbase::Client::WebhooksApi.new(Coinbase.configuration.api_client)
|
627
|
+
end
|
628
|
+
|
595
629
|
def set_addresses
|
596
630
|
address_list = Coinbase.call_api do
|
597
631
|
addresses_api.list_addresses(@model.id, { limit: MAX_ADDRESSES })
|
data/lib/coinbase/webhook.rb
CHANGED
@@ -22,8 +22,6 @@ module Coinbase
|
|
22
22
|
# @param event_filters [Array<Hash>] Filters applied to the events that determine
|
23
23
|
# which specific events trigger the webhook. Each filter should be a hash that
|
24
24
|
# can include keys like `contract_address`, `from_address`, or `to_address`.
|
25
|
-
# @param signature_header [String] The custom header to be used for x-webhook-signature header on callbacks,
|
26
|
-
# so developers can verify the requests are coming from Coinbase.
|
27
25
|
# @return [Coinbase::Webhook] A new instance of Webhook.
|
28
26
|
#
|
29
27
|
# @example Create a new webhook
|
@@ -31,18 +29,16 @@ module Coinbase
|
|
31
29
|
# network_id: :ethereum_mainnet,
|
32
30
|
# notification_uri: 'https://example.com/callback',
|
33
31
|
# event_type: 'transaction',
|
34
|
-
# event_filters: [{ 'contract_address' => '0x...', 'from_address' => '0x...', 'to_address' => '0x...' }]
|
35
|
-
# signature_header: 'example_header'
|
32
|
+
# event_filters: [{ 'contract_address' => '0x...', 'from_address' => '0x...', 'to_address' => '0x...' }]
|
36
33
|
# )
|
37
|
-
def create(network_id:, notification_uri:, event_type:, event_filters
|
34
|
+
def create(network_id:, notification_uri:, event_type:, event_filters:)
|
38
35
|
model = Coinbase.call_api do
|
39
36
|
webhooks_api.create_webhook(
|
40
37
|
create_webhook_request: {
|
41
38
|
network_id: Coinbase.normalize_network(network_id),
|
42
39
|
notification_uri: notification_uri,
|
43
40
|
event_type: event_type,
|
44
|
-
event_filters: event_filters
|
45
|
-
signature_header: signature_header
|
41
|
+
event_filters: event_filters
|
46
42
|
}
|
47
43
|
)
|
48
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coinbase-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuga Cohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|
@@ -288,6 +288,7 @@ files:
|
|
288
288
|
- lib/coinbase/client/api/smart_contracts_api.rb
|
289
289
|
- lib/coinbase/client/api/stake_api.rb
|
290
290
|
- lib/coinbase/client/api/trades_api.rb
|
291
|
+
- lib/coinbase/client/api/transaction_history_api.rb
|
291
292
|
- lib/coinbase/client/api/transfers_api.rb
|
292
293
|
- lib/coinbase/client/api/users_api.rb
|
293
294
|
- lib/coinbase/client/api/validators_api.rb
|
@@ -323,6 +324,7 @@ files:
|
|
323
324
|
- lib/coinbase/client/models/create_transfer_request.rb
|
324
325
|
- lib/coinbase/client/models/create_wallet_request.rb
|
325
326
|
- lib/coinbase/client/models/create_wallet_request_wallet.rb
|
327
|
+
- lib/coinbase/client/models/create_wallet_webhook_request.rb
|
326
328
|
- lib/coinbase/client/models/create_webhook_request.rb
|
327
329
|
- lib/coinbase/client/models/deploy_smart_contract_request.rb
|
328
330
|
- lib/coinbase/client/models/erc20_transfer_event.rb
|
@@ -334,13 +336,13 @@ files:
|
|
334
336
|
- lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb
|
335
337
|
- lib/coinbase/client/models/ethereum_validator_metadata.rb
|
336
338
|
- lib/coinbase/client/models/faucet_transaction.rb
|
337
|
-
- lib/coinbase/client/models/feature.rb
|
338
339
|
- lib/coinbase/client/models/feature_set.rb
|
339
340
|
- lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb
|
340
341
|
- lib/coinbase/client/models/fetch_staking_rewards200_response.rb
|
341
342
|
- lib/coinbase/client/models/fetch_staking_rewards_request.rb
|
342
343
|
- lib/coinbase/client/models/get_staking_context_request.rb
|
343
344
|
- lib/coinbase/client/models/historical_balance.rb
|
345
|
+
- lib/coinbase/client/models/multi_token_contract_options.rb
|
344
346
|
- lib/coinbase/client/models/network.rb
|
345
347
|
- lib/coinbase/client/models/network_identifier.rb
|
346
348
|
- lib/coinbase/client/models/nft_contract_options.rb
|
@@ -1,43 +0,0 @@
|
|
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
|
-
Contact: yuga.cohler@coinbase.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.7.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module Coinbase::Client
|
17
|
-
class Feature
|
18
|
-
TRANSFER = "transfer".freeze
|
19
|
-
TRADE = "trade".freeze
|
20
|
-
FAUCET = "faucet".freeze
|
21
|
-
SERVER_SIGNER = "server_signer".freeze
|
22
|
-
UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
|
23
|
-
|
24
|
-
def self.all_vars
|
25
|
-
@all_vars ||= [TRANSFER, TRADE, FAUCET, SERVER_SIGNER, UNKNOWN_DEFAULT_OPEN_API].freeze
|
26
|
-
end
|
27
|
-
|
28
|
-
# Builds the enum from string
|
29
|
-
# @param [String] The enum value in the form of the string
|
30
|
-
# @return [String] The enum value
|
31
|
-
def self.build_from_hash(value)
|
32
|
-
new.build_from_hash(value)
|
33
|
-
end
|
34
|
-
|
35
|
-
# Builds the enum from string
|
36
|
-
# @param [String] The enum value in the form of the string
|
37
|
-
# @return [String] The enum value
|
38
|
-
def build_from_hash(value)
|
39
|
-
return value if Feature.all_vars.include?(value)
|
40
|
-
raise "Invalid ENUM value #{value} for class #Feature"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|