coinbase-sdk 0.3.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coinbase/address/wallet_address.rb +35 -2
- data/lib/coinbase/address.rb +5 -1
- data/lib/coinbase/client/api/addresses_api.rb +10 -10
- data/lib/coinbase/client/api/assets_api.rb +2 -2
- data/lib/coinbase/client/api/balance_history_api.rb +107 -0
- data/lib/coinbase/client/api/contract_events_api.rb +4 -4
- data/lib/coinbase/client/api/contract_invocations_api.rb +5 -5
- data/lib/coinbase/client/api/external_addresses_api.rb +5 -90
- data/lib/coinbase/client/api/networks_api.rb +2 -2
- data/lib/coinbase/client/api/server_signers_api.rb +7 -7
- data/lib/coinbase/client/api/smart_contracts_api.rb +332 -0
- data/lib/coinbase/client/api/stake_api.rb +6 -14
- data/lib/coinbase/client/api/trades_api.rb +5 -5
- data/lib/coinbase/client/api/transfers_api.rb +5 -5
- data/lib/coinbase/client/api/users_api.rb +2 -2
- data/lib/coinbase/client/api/validators_api.rb +3 -3
- data/lib/coinbase/client/api/wallet_stake_api.rb +4 -4
- data/lib/coinbase/client/api/wallets_api.rb +6 -6
- data/lib/coinbase/client/api/webhooks_api.rb +5 -5
- data/lib/coinbase/client/api_client.rb +30 -24
- data/lib/coinbase/client/api_error.rb +1 -1
- data/lib/coinbase/client/configuration.rb +1 -1
- data/lib/coinbase/client/models/address.rb +1 -1
- data/lib/coinbase/client/models/address_balance_list.rb +1 -1
- data/lib/coinbase/client/models/address_historical_balance_list.rb +1 -1
- data/lib/coinbase/client/models/address_list.rb +1 -1
- data/lib/coinbase/client/models/address_transaction_list.rb +1 -1
- data/lib/coinbase/client/models/asset.rb +1 -1
- data/lib/coinbase/client/models/balance.rb +1 -1
- data/lib/coinbase/client/models/broadcast_contract_invocation_request.rb +1 -1
- data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +1 -1
- data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
- data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
- data/lib/coinbase/client/models/build_staking_operation_request.rb +1 -1
- data/lib/coinbase/client/models/contract_event.rb +1 -1
- data/lib/coinbase/client/models/contract_event_list.rb +1 -1
- data/lib/coinbase/client/models/contract_invocation.rb +19 -2
- data/lib/coinbase/client/models/contract_invocation_list.rb +1 -1
- data/lib/coinbase/client/models/create_address_request.rb +1 -1
- data/lib/coinbase/client/models/create_contract_invocation_request.rb +15 -5
- data/lib/coinbase/client/models/create_payload_signature_request.rb +1 -1
- data/lib/coinbase/client/models/create_server_signer_request.rb +1 -1
- data/lib/coinbase/client/models/create_smart_contract_request.rb +259 -0
- data/lib/coinbase/client/models/create_staking_operation_request.rb +1 -1
- data/lib/coinbase/client/models/create_trade_request.rb +1 -1
- data/lib/coinbase/client/models/create_transfer_request.rb +2 -2
- data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
- data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
- data/lib/coinbase/client/models/create_webhook_request.rb +11 -9
- data/lib/coinbase/client/models/deploy_smart_contract_request.rb +222 -0
- data/lib/coinbase/client/models/erc20_transfer_event.rb +336 -0
- data/lib/coinbase/client/models/erc721_transfer_event.rb +336 -0
- data/lib/coinbase/client/models/error.rb +15 -5
- data/lib/coinbase/client/models/ethereum_transaction.rb +1 -1
- data/lib/coinbase/client/models/ethereum_transaction_access.rb +1 -1
- data/lib/coinbase/client/models/ethereum_transaction_access_list.rb +1 -1
- data/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb +1 -1
- data/lib/coinbase/client/models/ethereum_validator_metadata.rb +1 -1
- data/lib/coinbase/client/models/faucet_transaction.rb +1 -1
- data/lib/coinbase/client/models/feature_set.rb +1 -1
- data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +1 -1
- data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +1 -1
- data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +1 -1
- data/lib/coinbase/client/models/get_staking_context_request.rb +1 -1
- data/lib/coinbase/client/models/historical_balance.rb +1 -1
- data/lib/coinbase/client/models/network.rb +1 -1
- data/lib/coinbase/client/models/network_identifier.rb +3 -2
- data/lib/coinbase/client/models/nft_contract_options.rb +240 -0
- data/lib/coinbase/client/models/payload_signature.rb +1 -1
- data/lib/coinbase/client/models/payload_signature_list.rb +1 -1
- data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
- data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
- data/lib/coinbase/client/models/server_signer.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
- data/lib/coinbase/client/models/server_signer_list.rb +1 -1
- data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
- data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
- data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +1 -1
- 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 +106 -0
- data/lib/coinbase/client/models/smart_contract_type.rb +41 -0
- data/lib/coinbase/client/models/sponsored_send.rb +1 -1
- data/lib/coinbase/client/models/staking_balance.rb +3 -3
- data/lib/coinbase/client/models/staking_context.rb +1 -1
- data/lib/coinbase/client/models/staking_context_context.rb +1 -1
- data/lib/coinbase/client/models/staking_operation.rb +1 -1
- data/lib/coinbase/client/models/staking_operation_metadata.rb +1 -1
- data/lib/coinbase/client/models/staking_reward.rb +3 -3
- data/lib/coinbase/client/models/staking_reward_format.rb +1 -1
- data/lib/coinbase/client/models/staking_reward_usd_value.rb +1 -1
- data/lib/coinbase/client/models/token_contract_options.rb +257 -0
- data/lib/coinbase/client/models/trade.rb +1 -1
- data/lib/coinbase/client/models/trade_list.rb +1 -1
- data/lib/coinbase/client/models/transaction.rb +1 -1
- data/lib/coinbase/client/models/transaction_content.rb +1 -1
- data/lib/coinbase/client/models/transaction_type.rb +1 -1
- data/lib/coinbase/client/models/transfer.rb +1 -1
- data/lib/coinbase/client/models/transfer_list.rb +1 -1
- data/lib/coinbase/client/models/update_webhook_request.rb +11 -9
- data/lib/coinbase/client/models/user.rb +1 -1
- data/lib/coinbase/client/models/validator.rb +1 -1
- data/lib/coinbase/client/models/validator_details.rb +1 -1
- data/lib/coinbase/client/models/validator_list.rb +1 -1
- data/lib/coinbase/client/models/validator_status.rb +1 -1
- data/lib/coinbase/client/models/wallet.rb +1 -1
- data/lib/coinbase/client/models/wallet_list.rb +1 -1
- data/lib/coinbase/client/models/webhook.rb +11 -2
- data/lib/coinbase/client/models/webhook_event_filter.rb +4 -4
- data/lib/coinbase/client/models/webhook_event_type.rb +3 -2
- data/lib/coinbase/client/models/webhook_event_type_filter.rb +105 -0
- data/lib/coinbase/client/models/webhook_list.rb +1 -1
- data/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +228 -0
- data/lib/coinbase/client/version.rb +1 -1
- data/lib/coinbase/client.rb +15 -1
- data/lib/coinbase/contract_invocation.rb +34 -10
- data/lib/coinbase/smart_contract.rb +216 -45
- 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 +11 -2
- metadata +16 -2
@@ -0,0 +1,336 @@
|
|
1
|
+
=begin
|
2
|
+
#Coinbase Platform API
|
3
|
+
|
4
|
+
#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.0.1-alpha
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.8.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# Represents an event triggered by an ERC-20 token transfer on the blockchain. Contains information about the transaction, block, and involved addresses.
|
18
|
+
class ERC20TransferEvent
|
19
|
+
# Unique identifier for the webhook that triggered this event.
|
20
|
+
attr_accessor :webhook_id
|
21
|
+
|
22
|
+
# Type of event, in this case, an ERC-20 token transfer.
|
23
|
+
attr_accessor :event_type
|
24
|
+
|
25
|
+
# Blockchain network where the event occurred.
|
26
|
+
attr_accessor :network
|
27
|
+
|
28
|
+
# Hash of the block containing the transaction.
|
29
|
+
attr_accessor :block_hash
|
30
|
+
|
31
|
+
# Number of the block containing the transaction.
|
32
|
+
attr_accessor :block_number
|
33
|
+
|
34
|
+
# Timestamp when the block was mined.
|
35
|
+
attr_accessor :block_time
|
36
|
+
|
37
|
+
# Hash of the transaction that triggered the event.
|
38
|
+
attr_accessor :transaction_hash
|
39
|
+
|
40
|
+
# Position of the transaction within the block.
|
41
|
+
attr_accessor :transaction_index
|
42
|
+
|
43
|
+
# Position of the event log within the transaction.
|
44
|
+
attr_accessor :log_index
|
45
|
+
|
46
|
+
# Address of the ERC-20 token contract.
|
47
|
+
attr_accessor :contract_address
|
48
|
+
|
49
|
+
# Address of the sender in the token transfer.
|
50
|
+
attr_accessor :from
|
51
|
+
|
52
|
+
# Address of the recipient in the token transfer.
|
53
|
+
attr_accessor :to
|
54
|
+
|
55
|
+
# Amount of tokens transferred, typically in the smallest unit (e.g., wei for Ethereum).
|
56
|
+
attr_accessor :value
|
57
|
+
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
59
|
+
def self.attribute_map
|
60
|
+
{
|
61
|
+
:'webhook_id' => :'webhookId',
|
62
|
+
:'event_type' => :'eventType',
|
63
|
+
:'network' => :'network',
|
64
|
+
:'block_hash' => :'blockHash',
|
65
|
+
:'block_number' => :'blockNumber',
|
66
|
+
:'block_time' => :'blockTime',
|
67
|
+
:'transaction_hash' => :'transactionHash',
|
68
|
+
:'transaction_index' => :'transactionIndex',
|
69
|
+
:'log_index' => :'logIndex',
|
70
|
+
:'contract_address' => :'contractAddress',
|
71
|
+
:'from' => :'from',
|
72
|
+
:'to' => :'to',
|
73
|
+
:'value' => :'value'
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns all the JSON keys this model knows about
|
78
|
+
def self.acceptable_attributes
|
79
|
+
attribute_map.values
|
80
|
+
end
|
81
|
+
|
82
|
+
# Attribute type mapping.
|
83
|
+
def self.openapi_types
|
84
|
+
{
|
85
|
+
:'webhook_id' => :'String',
|
86
|
+
:'event_type' => :'String',
|
87
|
+
:'network' => :'String',
|
88
|
+
:'block_hash' => :'String',
|
89
|
+
:'block_number' => :'Integer',
|
90
|
+
:'block_time' => :'Time',
|
91
|
+
:'transaction_hash' => :'String',
|
92
|
+
:'transaction_index' => :'Integer',
|
93
|
+
:'log_index' => :'Integer',
|
94
|
+
:'contract_address' => :'String',
|
95
|
+
:'from' => :'String',
|
96
|
+
:'to' => :'String',
|
97
|
+
:'value' => :'String'
|
98
|
+
}
|
99
|
+
end
|
100
|
+
|
101
|
+
# List of attributes with nullable: true
|
102
|
+
def self.openapi_nullable
|
103
|
+
Set.new([
|
104
|
+
])
|
105
|
+
end
|
106
|
+
|
107
|
+
# Initializes the object
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
def initialize(attributes = {})
|
110
|
+
if (!attributes.is_a?(Hash))
|
111
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::ERC20TransferEvent` initialize method"
|
112
|
+
end
|
113
|
+
|
114
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
115
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
116
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
117
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::ERC20TransferEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
118
|
+
end
|
119
|
+
h[k.to_sym] = v
|
120
|
+
}
|
121
|
+
|
122
|
+
if attributes.key?(:'webhook_id')
|
123
|
+
self.webhook_id = attributes[:'webhook_id']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'event_type')
|
127
|
+
self.event_type = attributes[:'event_type']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'network')
|
131
|
+
self.network = attributes[:'network']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'block_hash')
|
135
|
+
self.block_hash = attributes[:'block_hash']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.key?(:'block_number')
|
139
|
+
self.block_number = attributes[:'block_number']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.key?(:'block_time')
|
143
|
+
self.block_time = attributes[:'block_time']
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes.key?(:'transaction_hash')
|
147
|
+
self.transaction_hash = attributes[:'transaction_hash']
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.key?(:'transaction_index')
|
151
|
+
self.transaction_index = attributes[:'transaction_index']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.key?(:'log_index')
|
155
|
+
self.log_index = attributes[:'log_index']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.key?(:'contract_address')
|
159
|
+
self.contract_address = attributes[:'contract_address']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.key?(:'from')
|
163
|
+
self.from = attributes[:'from']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.key?(:'to')
|
167
|
+
self.to = attributes[:'to']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.key?(:'value')
|
171
|
+
self.value = attributes[:'value']
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
176
|
+
# @return Array for valid properties with the reasons
|
177
|
+
def list_invalid_properties
|
178
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
179
|
+
invalid_properties = Array.new
|
180
|
+
invalid_properties
|
181
|
+
end
|
182
|
+
|
183
|
+
# Check to see if the all the properties in the model are valid
|
184
|
+
# @return true if the model is valid
|
185
|
+
def valid?
|
186
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
187
|
+
true
|
188
|
+
end
|
189
|
+
|
190
|
+
# Checks equality by comparing each attribute.
|
191
|
+
# @param [Object] Object to be compared
|
192
|
+
def ==(o)
|
193
|
+
return true if self.equal?(o)
|
194
|
+
self.class == o.class &&
|
195
|
+
webhook_id == o.webhook_id &&
|
196
|
+
event_type == o.event_type &&
|
197
|
+
network == o.network &&
|
198
|
+
block_hash == o.block_hash &&
|
199
|
+
block_number == o.block_number &&
|
200
|
+
block_time == o.block_time &&
|
201
|
+
transaction_hash == o.transaction_hash &&
|
202
|
+
transaction_index == o.transaction_index &&
|
203
|
+
log_index == o.log_index &&
|
204
|
+
contract_address == o.contract_address &&
|
205
|
+
from == o.from &&
|
206
|
+
to == o.to &&
|
207
|
+
value == o.value
|
208
|
+
end
|
209
|
+
|
210
|
+
# @see the `==` method
|
211
|
+
# @param [Object] Object to be compared
|
212
|
+
def eql?(o)
|
213
|
+
self == o
|
214
|
+
end
|
215
|
+
|
216
|
+
# Calculates hash code according to all attributes.
|
217
|
+
# @return [Integer] Hash code
|
218
|
+
def hash
|
219
|
+
[webhook_id, event_type, network, block_hash, block_number, block_time, transaction_hash, transaction_index, log_index, contract_address, from, to, value].hash
|
220
|
+
end
|
221
|
+
|
222
|
+
# Builds the object from hash
|
223
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
224
|
+
# @return [Object] Returns the model itself
|
225
|
+
def self.build_from_hash(attributes)
|
226
|
+
return nil unless attributes.is_a?(Hash)
|
227
|
+
attributes = attributes.transform_keys(&:to_sym)
|
228
|
+
transformed_hash = {}
|
229
|
+
openapi_types.each_pair do |key, type|
|
230
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
231
|
+
transformed_hash["#{key}"] = nil
|
232
|
+
elsif type =~ /\AArray<(.*)>/i
|
233
|
+
# check to ensure the input is an array given that the attribute
|
234
|
+
# is documented as an array but the input is not
|
235
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
236
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
237
|
+
end
|
238
|
+
elsif !attributes[attribute_map[key]].nil?
|
239
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
240
|
+
end
|
241
|
+
end
|
242
|
+
new(transformed_hash)
|
243
|
+
end
|
244
|
+
|
245
|
+
# Deserializes the data based on type
|
246
|
+
# @param string type Data type
|
247
|
+
# @param string value Value to be deserialized
|
248
|
+
# @return [Object] Deserialized data
|
249
|
+
def self._deserialize(type, value)
|
250
|
+
case type.to_sym
|
251
|
+
when :Time
|
252
|
+
Time.parse(value)
|
253
|
+
when :Date
|
254
|
+
Date.parse(value)
|
255
|
+
when :String
|
256
|
+
value.to_s
|
257
|
+
when :Integer
|
258
|
+
value.to_i
|
259
|
+
when :Float
|
260
|
+
value.to_f
|
261
|
+
when :Boolean
|
262
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
263
|
+
true
|
264
|
+
else
|
265
|
+
false
|
266
|
+
end
|
267
|
+
when :Object
|
268
|
+
# generic object (usually a Hash), return directly
|
269
|
+
value
|
270
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
271
|
+
inner_type = Regexp.last_match[:inner_type]
|
272
|
+
value.map { |v| _deserialize(inner_type, v) }
|
273
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
274
|
+
k_type = Regexp.last_match[:k_type]
|
275
|
+
v_type = Regexp.last_match[:v_type]
|
276
|
+
{}.tap do |hash|
|
277
|
+
value.each do |k, v|
|
278
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
else # model
|
282
|
+
# models (e.g. Pet) or oneOf
|
283
|
+
klass = Coinbase::Client.const_get(type)
|
284
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
# Returns the string representation of the object
|
289
|
+
# @return [String] String presentation of the object
|
290
|
+
def to_s
|
291
|
+
to_hash.to_s
|
292
|
+
end
|
293
|
+
|
294
|
+
# to_body is an alias to to_hash (backward compatibility)
|
295
|
+
# @return [Hash] Returns the object in the form of hash
|
296
|
+
def to_body
|
297
|
+
to_hash
|
298
|
+
end
|
299
|
+
|
300
|
+
# Returns the object in the form of hash
|
301
|
+
# @return [Hash] Returns the object in the form of hash
|
302
|
+
def to_hash
|
303
|
+
hash = {}
|
304
|
+
self.class.attribute_map.each_pair do |attr, param|
|
305
|
+
value = self.send(attr)
|
306
|
+
if value.nil?
|
307
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
308
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
309
|
+
end
|
310
|
+
|
311
|
+
hash[param] = _to_hash(value)
|
312
|
+
end
|
313
|
+
hash
|
314
|
+
end
|
315
|
+
|
316
|
+
# Outputs non-array value in the form of hash
|
317
|
+
# For object, use to_hash. Otherwise, just return the value
|
318
|
+
# @param [Object] value Any valid value
|
319
|
+
# @return [Hash] Returns the value in the form of hash
|
320
|
+
def _to_hash(value)
|
321
|
+
if value.is_a?(Array)
|
322
|
+
value.compact.map { |v| _to_hash(v) }
|
323
|
+
elsif value.is_a?(Hash)
|
324
|
+
{}.tap do |hash|
|
325
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
326
|
+
end
|
327
|
+
elsif value.respond_to? :to_hash
|
328
|
+
value.to_hash
|
329
|
+
else
|
330
|
+
value
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
end
|
335
|
+
|
336
|
+
end
|
@@ -0,0 +1,336 @@
|
|
1
|
+
=begin
|
2
|
+
#Coinbase Platform API
|
3
|
+
|
4
|
+
#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.0.1-alpha
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.8.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# Represents an event triggered by an ERC-721 token transfer on the blockchain. Contains information about the transaction, block, and involved addresses.
|
18
|
+
class ERC721TransferEvent
|
19
|
+
# Unique identifier for the webhook that triggered this event.
|
20
|
+
attr_accessor :webhook_id
|
21
|
+
|
22
|
+
# Type of event, in this case, an ERC-721 token transfer.
|
23
|
+
attr_accessor :event_type
|
24
|
+
|
25
|
+
# Blockchain network where the event occurred.
|
26
|
+
attr_accessor :network
|
27
|
+
|
28
|
+
# Hash of the block containing the transaction.
|
29
|
+
attr_accessor :block_hash
|
30
|
+
|
31
|
+
# Number of the block containing the transaction.
|
32
|
+
attr_accessor :block_number
|
33
|
+
|
34
|
+
# Timestamp when the block was mined.
|
35
|
+
attr_accessor :block_time
|
36
|
+
|
37
|
+
# Hash of the transaction that triggered the event.
|
38
|
+
attr_accessor :transaction_hash
|
39
|
+
|
40
|
+
# Position of the transaction within the block.
|
41
|
+
attr_accessor :transaction_index
|
42
|
+
|
43
|
+
# Position of the event log within the transaction.
|
44
|
+
attr_accessor :log_index
|
45
|
+
|
46
|
+
# Address of the ERC-721 token contract.
|
47
|
+
attr_accessor :contract_address
|
48
|
+
|
49
|
+
# Address of the sender in the token transfer.
|
50
|
+
attr_accessor :from
|
51
|
+
|
52
|
+
# Address of the recipient in the token transfer.
|
53
|
+
attr_accessor :to
|
54
|
+
|
55
|
+
# Unique identifier of the NFT being transferred.
|
56
|
+
attr_accessor :token_id
|
57
|
+
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
59
|
+
def self.attribute_map
|
60
|
+
{
|
61
|
+
:'webhook_id' => :'webhookId',
|
62
|
+
:'event_type' => :'eventType',
|
63
|
+
:'network' => :'network',
|
64
|
+
:'block_hash' => :'blockHash',
|
65
|
+
:'block_number' => :'blockNumber',
|
66
|
+
:'block_time' => :'blockTime',
|
67
|
+
:'transaction_hash' => :'transactionHash',
|
68
|
+
:'transaction_index' => :'transactionIndex',
|
69
|
+
:'log_index' => :'logIndex',
|
70
|
+
:'contract_address' => :'contractAddress',
|
71
|
+
:'from' => :'from',
|
72
|
+
:'to' => :'to',
|
73
|
+
:'token_id' => :'tokenId'
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns all the JSON keys this model knows about
|
78
|
+
def self.acceptable_attributes
|
79
|
+
attribute_map.values
|
80
|
+
end
|
81
|
+
|
82
|
+
# Attribute type mapping.
|
83
|
+
def self.openapi_types
|
84
|
+
{
|
85
|
+
:'webhook_id' => :'String',
|
86
|
+
:'event_type' => :'String',
|
87
|
+
:'network' => :'String',
|
88
|
+
:'block_hash' => :'String',
|
89
|
+
:'block_number' => :'Integer',
|
90
|
+
:'block_time' => :'Time',
|
91
|
+
:'transaction_hash' => :'String',
|
92
|
+
:'transaction_index' => :'Integer',
|
93
|
+
:'log_index' => :'Integer',
|
94
|
+
:'contract_address' => :'String',
|
95
|
+
:'from' => :'String',
|
96
|
+
:'to' => :'String',
|
97
|
+
:'token_id' => :'String'
|
98
|
+
}
|
99
|
+
end
|
100
|
+
|
101
|
+
# List of attributes with nullable: true
|
102
|
+
def self.openapi_nullable
|
103
|
+
Set.new([
|
104
|
+
])
|
105
|
+
end
|
106
|
+
|
107
|
+
# Initializes the object
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
def initialize(attributes = {})
|
110
|
+
if (!attributes.is_a?(Hash))
|
111
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::ERC721TransferEvent` initialize method"
|
112
|
+
end
|
113
|
+
|
114
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
115
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
116
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
117
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::ERC721TransferEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
118
|
+
end
|
119
|
+
h[k.to_sym] = v
|
120
|
+
}
|
121
|
+
|
122
|
+
if attributes.key?(:'webhook_id')
|
123
|
+
self.webhook_id = attributes[:'webhook_id']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'event_type')
|
127
|
+
self.event_type = attributes[:'event_type']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'network')
|
131
|
+
self.network = attributes[:'network']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'block_hash')
|
135
|
+
self.block_hash = attributes[:'block_hash']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.key?(:'block_number')
|
139
|
+
self.block_number = attributes[:'block_number']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.key?(:'block_time')
|
143
|
+
self.block_time = attributes[:'block_time']
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes.key?(:'transaction_hash')
|
147
|
+
self.transaction_hash = attributes[:'transaction_hash']
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.key?(:'transaction_index')
|
151
|
+
self.transaction_index = attributes[:'transaction_index']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.key?(:'log_index')
|
155
|
+
self.log_index = attributes[:'log_index']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.key?(:'contract_address')
|
159
|
+
self.contract_address = attributes[:'contract_address']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.key?(:'from')
|
163
|
+
self.from = attributes[:'from']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.key?(:'to')
|
167
|
+
self.to = attributes[:'to']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.key?(:'token_id')
|
171
|
+
self.token_id = attributes[:'token_id']
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
176
|
+
# @return Array for valid properties with the reasons
|
177
|
+
def list_invalid_properties
|
178
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
179
|
+
invalid_properties = Array.new
|
180
|
+
invalid_properties
|
181
|
+
end
|
182
|
+
|
183
|
+
# Check to see if the all the properties in the model are valid
|
184
|
+
# @return true if the model is valid
|
185
|
+
def valid?
|
186
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
187
|
+
true
|
188
|
+
end
|
189
|
+
|
190
|
+
# Checks equality by comparing each attribute.
|
191
|
+
# @param [Object] Object to be compared
|
192
|
+
def ==(o)
|
193
|
+
return true if self.equal?(o)
|
194
|
+
self.class == o.class &&
|
195
|
+
webhook_id == o.webhook_id &&
|
196
|
+
event_type == o.event_type &&
|
197
|
+
network == o.network &&
|
198
|
+
block_hash == o.block_hash &&
|
199
|
+
block_number == o.block_number &&
|
200
|
+
block_time == o.block_time &&
|
201
|
+
transaction_hash == o.transaction_hash &&
|
202
|
+
transaction_index == o.transaction_index &&
|
203
|
+
log_index == o.log_index &&
|
204
|
+
contract_address == o.contract_address &&
|
205
|
+
from == o.from &&
|
206
|
+
to == o.to &&
|
207
|
+
token_id == o.token_id
|
208
|
+
end
|
209
|
+
|
210
|
+
# @see the `==` method
|
211
|
+
# @param [Object] Object to be compared
|
212
|
+
def eql?(o)
|
213
|
+
self == o
|
214
|
+
end
|
215
|
+
|
216
|
+
# Calculates hash code according to all attributes.
|
217
|
+
# @return [Integer] Hash code
|
218
|
+
def hash
|
219
|
+
[webhook_id, event_type, network, block_hash, block_number, block_time, transaction_hash, transaction_index, log_index, contract_address, from, to, token_id].hash
|
220
|
+
end
|
221
|
+
|
222
|
+
# Builds the object from hash
|
223
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
224
|
+
# @return [Object] Returns the model itself
|
225
|
+
def self.build_from_hash(attributes)
|
226
|
+
return nil unless attributes.is_a?(Hash)
|
227
|
+
attributes = attributes.transform_keys(&:to_sym)
|
228
|
+
transformed_hash = {}
|
229
|
+
openapi_types.each_pair do |key, type|
|
230
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
231
|
+
transformed_hash["#{key}"] = nil
|
232
|
+
elsif type =~ /\AArray<(.*)>/i
|
233
|
+
# check to ensure the input is an array given that the attribute
|
234
|
+
# is documented as an array but the input is not
|
235
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
236
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
237
|
+
end
|
238
|
+
elsif !attributes[attribute_map[key]].nil?
|
239
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
240
|
+
end
|
241
|
+
end
|
242
|
+
new(transformed_hash)
|
243
|
+
end
|
244
|
+
|
245
|
+
# Deserializes the data based on type
|
246
|
+
# @param string type Data type
|
247
|
+
# @param string value Value to be deserialized
|
248
|
+
# @return [Object] Deserialized data
|
249
|
+
def self._deserialize(type, value)
|
250
|
+
case type.to_sym
|
251
|
+
when :Time
|
252
|
+
Time.parse(value)
|
253
|
+
when :Date
|
254
|
+
Date.parse(value)
|
255
|
+
when :String
|
256
|
+
value.to_s
|
257
|
+
when :Integer
|
258
|
+
value.to_i
|
259
|
+
when :Float
|
260
|
+
value.to_f
|
261
|
+
when :Boolean
|
262
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
263
|
+
true
|
264
|
+
else
|
265
|
+
false
|
266
|
+
end
|
267
|
+
when :Object
|
268
|
+
# generic object (usually a Hash), return directly
|
269
|
+
value
|
270
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
271
|
+
inner_type = Regexp.last_match[:inner_type]
|
272
|
+
value.map { |v| _deserialize(inner_type, v) }
|
273
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
274
|
+
k_type = Regexp.last_match[:k_type]
|
275
|
+
v_type = Regexp.last_match[:v_type]
|
276
|
+
{}.tap do |hash|
|
277
|
+
value.each do |k, v|
|
278
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
else # model
|
282
|
+
# models (e.g. Pet) or oneOf
|
283
|
+
klass = Coinbase::Client.const_get(type)
|
284
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
# Returns the string representation of the object
|
289
|
+
# @return [String] String presentation of the object
|
290
|
+
def to_s
|
291
|
+
to_hash.to_s
|
292
|
+
end
|
293
|
+
|
294
|
+
# to_body is an alias to to_hash (backward compatibility)
|
295
|
+
# @return [Hash] Returns the object in the form of hash
|
296
|
+
def to_body
|
297
|
+
to_hash
|
298
|
+
end
|
299
|
+
|
300
|
+
# Returns the object in the form of hash
|
301
|
+
# @return [Hash] Returns the object in the form of hash
|
302
|
+
def to_hash
|
303
|
+
hash = {}
|
304
|
+
self.class.attribute_map.each_pair do |attr, param|
|
305
|
+
value = self.send(attr)
|
306
|
+
if value.nil?
|
307
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
308
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
309
|
+
end
|
310
|
+
|
311
|
+
hash[param] = _to_hash(value)
|
312
|
+
end
|
313
|
+
hash
|
314
|
+
end
|
315
|
+
|
316
|
+
# Outputs non-array value in the form of hash
|
317
|
+
# For object, use to_hash. Otherwise, just return the value
|
318
|
+
# @param [Object] value Any valid value
|
319
|
+
# @return [Hash] Returns the value in the form of hash
|
320
|
+
def _to_hash(value)
|
321
|
+
if value.is_a?(Array)
|
322
|
+
value.compact.map { |v| _to_hash(v) }
|
323
|
+
elsif value.is_a?(Hash)
|
324
|
+
{}.tap do |hash|
|
325
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
326
|
+
end
|
327
|
+
elsif value.respond_to? :to_hash
|
328
|
+
value.to_hash
|
329
|
+
else
|
330
|
+
value
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
end
|
335
|
+
|
336
|
+
end
|