coinbase-sdk 0.11.0 → 0.13.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.rb +22 -3
- data/lib/coinbase/address_reputation.rb +67 -0
- 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 +2 -2
- data/lib/coinbase/client/api/contract_events_api.rb +2 -2
- data/lib/coinbase/client/api/contract_invocations_api.rb +5 -5
- data/lib/coinbase/client/api/external_addresses_api.rb +246 -5
- data/lib/coinbase/client/api/fund_api.rb +5 -5
- data/lib/coinbase/client/api/mpc_wallet_stake_api.rb +4 -4
- data/lib/coinbase/client/api/networks_api.rb +2 -2
- data/lib/coinbase/client/api/onchain_identity_api.rb +2 -2
- data/lib/coinbase/client/api/reputation_api.rb +2 -71
- data/lib/coinbase/client/api/server_signers_api.rb +7 -7
- data/lib/coinbase/client/api/smart_contracts_api.rb +169 -26
- data/lib/coinbase/client/api/stake_api.rb +8 -8
- data/lib/coinbase/client/api/trades_api.rb +5 -5
- data/lib/coinbase/client/api/transaction_history_api.rb +2 -2
- data/lib/coinbase/client/api/transfers_api.rb +14 -14
- data/lib/coinbase/client/api/users_api.rb +1 -1
- data/lib/coinbase/client/api/wallets_api.rb +6 -6
- data/lib/coinbase/client/api/webhooks_api.rb +6 -6
- data/lib/coinbase/client/api_client.rb +1 -1
- data/lib/coinbase/client/api_error.rb +1 -1
- data/lib/coinbase/client/configuration.rb +15 -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_reputation.rb +16 -9
- data/lib/coinbase/client/models/address_reputation_metadata.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_transfer_request.rb → broadcast_external_transfer_request.rb} +4 -4
- 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/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 +1 -1
- 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 +1 -1
- data/lib/coinbase/client/models/create_external_transfer_request.rb +273 -0
- data/lib/coinbase/client/models/create_fund_operation_request.rb +2 -2
- data/lib/coinbase/client/models/create_fund_quote_request.rb +2 -2
- 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 +1 -1
- 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_wallet_webhook_request.rb +1 -1
- data/lib/coinbase/client/models/create_webhook_request.rb +1 -1
- data/lib/coinbase/client/models/crypto_amount.rb +1 -1
- data/lib/coinbase/client/models/deploy_smart_contract_request.rb +1 -1
- data/lib/coinbase/client/models/erc20_transfer_event.rb +1 -1
- data/lib/coinbase/client/models/erc721_transfer_event.rb +1 -1
- data/lib/coinbase/client/models/error.rb +1 -1
- data/lib/coinbase/client/models/ethereum_token_transfer.rb +1 -1
- data/lib/coinbase/client/models/ethereum_transaction.rb +15 -5
- 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/fiat_amount.rb +1 -1
- data/lib/coinbase/client/models/fund_operation.rb +1 -1
- data/lib/coinbase/client/models/fund_operation_fees.rb +1 -1
- data/lib/coinbase/client/models/fund_operation_list.rb +1 -1
- data/lib/coinbase/client/models/fund_quote.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/multi_token_contract_options.rb +1 -1
- data/lib/coinbase/client/models/network.rb +1 -1
- data/lib/coinbase/client/models/network_identifier.rb +1 -1
- data/lib/coinbase/client/models/nft_contract_options.rb +1 -1
- data/lib/coinbase/client/models/onchain_name.rb +1 -1
- data/lib/coinbase/client/models/onchain_name_list.rb +1 -1
- 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/read_contract_request.rb +1 -1
- data/lib/coinbase/client/models/register_smart_contract_request.rb +252 -0
- 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 +37 -31
- data/lib/coinbase/client/models/smart_contract_activity_event.rb +386 -0
- data/lib/coinbase/client/models/smart_contract_list.rb +1 -1
- data/lib/coinbase/client/models/smart_contract_options.rb +1 -1
- data/lib/coinbase/client/models/smart_contract_type.rb +3 -2
- data/lib/coinbase/client/models/solidity_value.rb +1 -1
- data/lib/coinbase/client/models/sponsored_send.rb +1 -1
- data/lib/coinbase/client/models/staking_balance.rb +1 -1
- 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 +1 -1
- 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 +1 -1
- data/lib/coinbase/client/models/token_transfer_type.rb +1 -1
- 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 +2 -37
- data/lib/coinbase/client/models/transfer_list.rb +1 -1
- data/lib/coinbase/client/models/update_smart_contract_request.rb +245 -0
- data/lib/coinbase/client/models/update_webhook_request.rb +1 -1
- 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 +1 -1
- data/lib/coinbase/client/models/webhook_event_filter.rb +1 -1
- data/lib/coinbase/client/models/webhook_event_type.rb +3 -2
- data/lib/coinbase/client/models/webhook_event_type_filter.rb +2 -1
- data/lib/coinbase/client/models/webhook_list.rb +1 -1
- data/lib/coinbase/client/models/{address_risk.rb → webhook_smart_contract_event_filter.rb} +19 -17
- data/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +8 -1
- data/lib/coinbase/client/version.rb +1 -1
- data/lib/coinbase/client.rb +7 -3
- data/lib/coinbase/errors.rb +8 -0
- data/lib/coinbase/smart_contract.rb +338 -245
- data/lib/coinbase/version.rb +1 -1
- data/lib/coinbase/wallet/data.rb +6 -4
- data/lib/coinbase/wallet.rb +3 -2
- data/lib/coinbase.rb +2 -1
- metadata +12 -7
@@ -0,0 +1,386 @@
|
|
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.10.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# Represents an event triggered by a smart contract activity on the blockchain. Contains information about the function, transaction, block, and involved addresses.
|
18
|
+
class SmartContractActivityEvent
|
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
|
+
# Name of the project this smart contract belongs to.
|
29
|
+
attr_accessor :project_name
|
30
|
+
|
31
|
+
# Name of the contract.
|
32
|
+
attr_accessor :contract_name
|
33
|
+
|
34
|
+
# Name of the function.
|
35
|
+
attr_accessor :func
|
36
|
+
|
37
|
+
# Signature of the function.
|
38
|
+
attr_accessor :sig
|
39
|
+
|
40
|
+
# First 4 bytes of the Transaction, a unique ID.
|
41
|
+
attr_accessor :four_bytes
|
42
|
+
|
43
|
+
# Address of the smart contract.
|
44
|
+
attr_accessor :contract_address
|
45
|
+
|
46
|
+
# Hash of the block containing the transaction.
|
47
|
+
attr_accessor :block_hash
|
48
|
+
|
49
|
+
# Number of the block containing the transaction.
|
50
|
+
attr_accessor :block_number
|
51
|
+
|
52
|
+
# Timestamp when the block was mined.
|
53
|
+
attr_accessor :block_time
|
54
|
+
|
55
|
+
# Hash of the transaction that triggered the event.
|
56
|
+
attr_accessor :transaction_hash
|
57
|
+
|
58
|
+
# Position of the transaction within the block.
|
59
|
+
attr_accessor :transaction_index
|
60
|
+
|
61
|
+
# Position of the event log within the transaction.
|
62
|
+
attr_accessor :log_index
|
63
|
+
|
64
|
+
# Address of the initiator in the transfer.
|
65
|
+
attr_accessor :from
|
66
|
+
|
67
|
+
# Address of the recipient in the transfer.
|
68
|
+
attr_accessor :to
|
69
|
+
|
70
|
+
# Amount of tokens transferred, typically in the smallest unit (e.g., wei for Ethereum).
|
71
|
+
attr_accessor :value
|
72
|
+
|
73
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
74
|
+
def self.attribute_map
|
75
|
+
{
|
76
|
+
:'webhook_id' => :'webhookId',
|
77
|
+
:'event_type' => :'eventType',
|
78
|
+
:'network' => :'network',
|
79
|
+
:'project_name' => :'projectName',
|
80
|
+
:'contract_name' => :'contractName',
|
81
|
+
:'func' => :'func',
|
82
|
+
:'sig' => :'sig',
|
83
|
+
:'four_bytes' => :'fourBytes',
|
84
|
+
:'contract_address' => :'contractAddress',
|
85
|
+
:'block_hash' => :'blockHash',
|
86
|
+
:'block_number' => :'blockNumber',
|
87
|
+
:'block_time' => :'blockTime',
|
88
|
+
:'transaction_hash' => :'transactionHash',
|
89
|
+
:'transaction_index' => :'transactionIndex',
|
90
|
+
:'log_index' => :'logIndex',
|
91
|
+
:'from' => :'from',
|
92
|
+
:'to' => :'to',
|
93
|
+
:'value' => :'value'
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
97
|
+
# Returns all the JSON keys this model knows about
|
98
|
+
def self.acceptable_attributes
|
99
|
+
attribute_map.values
|
100
|
+
end
|
101
|
+
|
102
|
+
# Attribute type mapping.
|
103
|
+
def self.openapi_types
|
104
|
+
{
|
105
|
+
:'webhook_id' => :'String',
|
106
|
+
:'event_type' => :'String',
|
107
|
+
:'network' => :'String',
|
108
|
+
:'project_name' => :'String',
|
109
|
+
:'contract_name' => :'String',
|
110
|
+
:'func' => :'String',
|
111
|
+
:'sig' => :'String',
|
112
|
+
:'four_bytes' => :'String',
|
113
|
+
:'contract_address' => :'String',
|
114
|
+
:'block_hash' => :'String',
|
115
|
+
:'block_number' => :'Integer',
|
116
|
+
:'block_time' => :'Time',
|
117
|
+
:'transaction_hash' => :'String',
|
118
|
+
:'transaction_index' => :'Integer',
|
119
|
+
:'log_index' => :'Integer',
|
120
|
+
:'from' => :'String',
|
121
|
+
:'to' => :'String',
|
122
|
+
:'value' => :'Integer'
|
123
|
+
}
|
124
|
+
end
|
125
|
+
|
126
|
+
# List of attributes with nullable: true
|
127
|
+
def self.openapi_nullable
|
128
|
+
Set.new([
|
129
|
+
])
|
130
|
+
end
|
131
|
+
|
132
|
+
# Initializes the object
|
133
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
134
|
+
def initialize(attributes = {})
|
135
|
+
if (!attributes.is_a?(Hash))
|
136
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::SmartContractActivityEvent` initialize method"
|
137
|
+
end
|
138
|
+
|
139
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
140
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
141
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
142
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::SmartContractActivityEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
143
|
+
end
|
144
|
+
h[k.to_sym] = v
|
145
|
+
}
|
146
|
+
|
147
|
+
if attributes.key?(:'webhook_id')
|
148
|
+
self.webhook_id = attributes[:'webhook_id']
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.key?(:'event_type')
|
152
|
+
self.event_type = attributes[:'event_type']
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.key?(:'network')
|
156
|
+
self.network = attributes[:'network']
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'project_name')
|
160
|
+
self.project_name = attributes[:'project_name']
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'contract_name')
|
164
|
+
self.contract_name = attributes[:'contract_name']
|
165
|
+
end
|
166
|
+
|
167
|
+
if attributes.key?(:'func')
|
168
|
+
self.func = attributes[:'func']
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.key?(:'sig')
|
172
|
+
self.sig = attributes[:'sig']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.key?(:'four_bytes')
|
176
|
+
self.four_bytes = attributes[:'four_bytes']
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.key?(:'contract_address')
|
180
|
+
self.contract_address = attributes[:'contract_address']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.key?(:'block_hash')
|
184
|
+
self.block_hash = attributes[:'block_hash']
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.key?(:'block_number')
|
188
|
+
self.block_number = attributes[:'block_number']
|
189
|
+
end
|
190
|
+
|
191
|
+
if attributes.key?(:'block_time')
|
192
|
+
self.block_time = attributes[:'block_time']
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.key?(:'transaction_hash')
|
196
|
+
self.transaction_hash = attributes[:'transaction_hash']
|
197
|
+
end
|
198
|
+
|
199
|
+
if attributes.key?(:'transaction_index')
|
200
|
+
self.transaction_index = attributes[:'transaction_index']
|
201
|
+
end
|
202
|
+
|
203
|
+
if attributes.key?(:'log_index')
|
204
|
+
self.log_index = attributes[:'log_index']
|
205
|
+
end
|
206
|
+
|
207
|
+
if attributes.key?(:'from')
|
208
|
+
self.from = attributes[:'from']
|
209
|
+
end
|
210
|
+
|
211
|
+
if attributes.key?(:'to')
|
212
|
+
self.to = attributes[:'to']
|
213
|
+
end
|
214
|
+
|
215
|
+
if attributes.key?(:'value')
|
216
|
+
self.value = attributes[:'value']
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
221
|
+
# @return Array for valid properties with the reasons
|
222
|
+
def list_invalid_properties
|
223
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
224
|
+
invalid_properties = Array.new
|
225
|
+
invalid_properties
|
226
|
+
end
|
227
|
+
|
228
|
+
# Check to see if the all the properties in the model are valid
|
229
|
+
# @return true if the model is valid
|
230
|
+
def valid?
|
231
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
232
|
+
true
|
233
|
+
end
|
234
|
+
|
235
|
+
# Checks equality by comparing each attribute.
|
236
|
+
# @param [Object] Object to be compared
|
237
|
+
def ==(o)
|
238
|
+
return true if self.equal?(o)
|
239
|
+
self.class == o.class &&
|
240
|
+
webhook_id == o.webhook_id &&
|
241
|
+
event_type == o.event_type &&
|
242
|
+
network == o.network &&
|
243
|
+
project_name == o.project_name &&
|
244
|
+
contract_name == o.contract_name &&
|
245
|
+
func == o.func &&
|
246
|
+
sig == o.sig &&
|
247
|
+
four_bytes == o.four_bytes &&
|
248
|
+
contract_address == o.contract_address &&
|
249
|
+
block_hash == o.block_hash &&
|
250
|
+
block_number == o.block_number &&
|
251
|
+
block_time == o.block_time &&
|
252
|
+
transaction_hash == o.transaction_hash &&
|
253
|
+
transaction_index == o.transaction_index &&
|
254
|
+
log_index == o.log_index &&
|
255
|
+
from == o.from &&
|
256
|
+
to == o.to &&
|
257
|
+
value == o.value
|
258
|
+
end
|
259
|
+
|
260
|
+
# @see the `==` method
|
261
|
+
# @param [Object] Object to be compared
|
262
|
+
def eql?(o)
|
263
|
+
self == o
|
264
|
+
end
|
265
|
+
|
266
|
+
# Calculates hash code according to all attributes.
|
267
|
+
# @return [Integer] Hash code
|
268
|
+
def hash
|
269
|
+
[webhook_id, event_type, network, project_name, contract_name, func, sig, four_bytes, contract_address, block_hash, block_number, block_time, transaction_hash, transaction_index, log_index, from, to, value].hash
|
270
|
+
end
|
271
|
+
|
272
|
+
# Builds the object from hash
|
273
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
274
|
+
# @return [Object] Returns the model itself
|
275
|
+
def self.build_from_hash(attributes)
|
276
|
+
return nil unless attributes.is_a?(Hash)
|
277
|
+
attributes = attributes.transform_keys(&:to_sym)
|
278
|
+
transformed_hash = {}
|
279
|
+
openapi_types.each_pair do |key, type|
|
280
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
281
|
+
transformed_hash["#{key}"] = nil
|
282
|
+
elsif type =~ /\AArray<(.*)>/i
|
283
|
+
# check to ensure the input is an array given that the attribute
|
284
|
+
# is documented as an array but the input is not
|
285
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
286
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
287
|
+
end
|
288
|
+
elsif !attributes[attribute_map[key]].nil?
|
289
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
290
|
+
end
|
291
|
+
end
|
292
|
+
new(transformed_hash)
|
293
|
+
end
|
294
|
+
|
295
|
+
# Deserializes the data based on type
|
296
|
+
# @param string type Data type
|
297
|
+
# @param string value Value to be deserialized
|
298
|
+
# @return [Object] Deserialized data
|
299
|
+
def self._deserialize(type, value)
|
300
|
+
case type.to_sym
|
301
|
+
when :Time
|
302
|
+
Time.parse(value)
|
303
|
+
when :Date
|
304
|
+
Date.parse(value)
|
305
|
+
when :String
|
306
|
+
value.to_s
|
307
|
+
when :Integer
|
308
|
+
value.to_i
|
309
|
+
when :Float
|
310
|
+
value.to_f
|
311
|
+
when :Boolean
|
312
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
313
|
+
true
|
314
|
+
else
|
315
|
+
false
|
316
|
+
end
|
317
|
+
when :Object
|
318
|
+
# generic object (usually a Hash), return directly
|
319
|
+
value
|
320
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
321
|
+
inner_type = Regexp.last_match[:inner_type]
|
322
|
+
value.map { |v| _deserialize(inner_type, v) }
|
323
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
324
|
+
k_type = Regexp.last_match[:k_type]
|
325
|
+
v_type = Regexp.last_match[:v_type]
|
326
|
+
{}.tap do |hash|
|
327
|
+
value.each do |k, v|
|
328
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
else # model
|
332
|
+
# models (e.g. Pet) or oneOf
|
333
|
+
klass = Coinbase::Client.const_get(type)
|
334
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
# Returns the string representation of the object
|
339
|
+
# @return [String] String presentation of the object
|
340
|
+
def to_s
|
341
|
+
to_hash.to_s
|
342
|
+
end
|
343
|
+
|
344
|
+
# to_body is an alias to to_hash (backward compatibility)
|
345
|
+
# @return [Hash] Returns the object in the form of hash
|
346
|
+
def to_body
|
347
|
+
to_hash
|
348
|
+
end
|
349
|
+
|
350
|
+
# Returns the object in the form of hash
|
351
|
+
# @return [Hash] Returns the object in the form of hash
|
352
|
+
def to_hash
|
353
|
+
hash = {}
|
354
|
+
self.class.attribute_map.each_pair do |attr, param|
|
355
|
+
value = self.send(attr)
|
356
|
+
if value.nil?
|
357
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
358
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
359
|
+
end
|
360
|
+
|
361
|
+
hash[param] = _to_hash(value)
|
362
|
+
end
|
363
|
+
hash
|
364
|
+
end
|
365
|
+
|
366
|
+
# Outputs non-array value in the form of hash
|
367
|
+
# For object, use to_hash. Otherwise, just return the value
|
368
|
+
# @param [Object] value Any valid value
|
369
|
+
# @return [Hash] Returns the value in the form of hash
|
370
|
+
def _to_hash(value)
|
371
|
+
if value.is_a?(Array)
|
372
|
+
value.compact.map { |v| _to_hash(v) }
|
373
|
+
elsif value.is_a?(Hash)
|
374
|
+
{}.tap do |hash|
|
375
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
376
|
+
end
|
377
|
+
elsif value.respond_to? :to_hash
|
378
|
+
value.to_hash
|
379
|
+
else
|
380
|
+
value
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
end
|
385
|
+
|
386
|
+
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.
|
9
|
+
Generator version: 7.10.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -18,10 +18,11 @@ module Coinbase::Client
|
|
18
18
|
ERC20 = "erc20".freeze
|
19
19
|
ERC721 = "erc721".freeze
|
20
20
|
ERC1155 = "erc1155".freeze
|
21
|
+
CUSTOM = "custom".freeze
|
21
22
|
UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
|
22
23
|
|
23
24
|
def self.all_vars
|
24
|
-
@all_vars ||= [ERC20, ERC721, ERC1155, UNKNOWN_DEFAULT_OPEN_API].freeze
|
25
|
+
@all_vars ||= [ERC20, ERC721, ERC1155, CUSTOM, UNKNOWN_DEFAULT_OPEN_API].freeze
|
25
26
|
end
|
26
27
|
|
27
28
|
# Builds the enum from string
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.
|
9
|
+
Generator version: 7.10.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -31,7 +31,7 @@ module Coinbase::Client
|
|
31
31
|
# The amount in the atomic units of the asset
|
32
32
|
attr_accessor :amount
|
33
33
|
|
34
|
-
# The ID of the asset being transferred
|
34
|
+
# The ID of the asset being transferred. Use `asset.asset_id` instead.
|
35
35
|
attr_accessor :asset_id
|
36
36
|
|
37
37
|
attr_accessor :asset
|
@@ -52,34 +52,11 @@ module Coinbase::Client
|
|
52
52
|
# The hash of the transfer transaction
|
53
53
|
attr_accessor :transaction_hash
|
54
54
|
|
55
|
-
# The status of the transfer
|
56
55
|
attr_accessor :status
|
57
56
|
|
58
57
|
# Whether the transfer uses sponsored gas
|
59
58
|
attr_accessor :gasless
|
60
59
|
|
61
|
-
class EnumAttributeValidator
|
62
|
-
attr_reader :datatype
|
63
|
-
attr_reader :allowable_values
|
64
|
-
|
65
|
-
def initialize(datatype, allowable_values)
|
66
|
-
@allowable_values = allowable_values.map do |value|
|
67
|
-
case datatype.to_s
|
68
|
-
when /Integer/i
|
69
|
-
value.to_i
|
70
|
-
when /Float/i
|
71
|
-
value.to_f
|
72
|
-
else
|
73
|
-
value
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def valid?(value)
|
79
|
-
!value || allowable_values.include?(value)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
60
|
# Attribute mapping from ruby-style variable name to JSON key.
|
84
61
|
def self.attribute_map
|
85
62
|
{
|
@@ -283,22 +260,10 @@ module Coinbase::Client
|
|
283
260
|
return false if @asset_id.nil?
|
284
261
|
return false if @asset.nil?
|
285
262
|
return false if @transfer_id.nil?
|
286
|
-
status_validator = EnumAttributeValidator.new('String', ["pending", "broadcast", "complete", "failed", "unknown_default_open_api"])
|
287
|
-
return false unless status_validator.valid?(@status)
|
288
263
|
return false if @gasless.nil?
|
289
264
|
true
|
290
265
|
end
|
291
266
|
|
292
|
-
# Custom attribute writer method checking allowed values (enum).
|
293
|
-
# @param [Object] status Object to be assigned
|
294
|
-
def status=(status)
|
295
|
-
validator = EnumAttributeValidator.new('String', ["pending", "broadcast", "complete", "failed", "unknown_default_open_api"])
|
296
|
-
unless validator.valid?(status)
|
297
|
-
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
298
|
-
end
|
299
|
-
@status = status
|
300
|
-
end
|
301
|
-
|
302
267
|
# Checks equality by comparing each attribute.
|
303
268
|
# @param [Object] Object to be compared
|
304
269
|
def ==(o)
|