coinbase-sdk 0.7.0 → 0.10.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.rb +8 -3
- data/lib/coinbase/client/api/external_addresses_api.rb +78 -0
- data/lib/coinbase/client/api/fund_api.rb +336 -0
- data/lib/coinbase/client/api/onchain_identity_api.rb +108 -0
- data/lib/coinbase/client/api/smart_contracts_api.rb +80 -0
- data/lib/coinbase/client/api/webhooks_api.rb +5 -5
- data/lib/coinbase/client/models/create_fund_operation_request.rb +249 -0
- data/lib/coinbase/client/models/create_fund_quote_request.rb +239 -0
- data/lib/coinbase/client/models/create_wallet_webhook_request.rb +1 -1
- data/lib/coinbase/client/models/crypto_amount.rb +239 -0
- data/lib/coinbase/client/models/ethereum_token_transfer.rb +327 -0
- data/lib/coinbase/client/models/ethereum_transaction.rb +12 -1
- data/lib/coinbase/client/models/faucet_transaction.rb +20 -4
- data/lib/coinbase/client/models/fiat_amount.rb +240 -0
- data/lib/coinbase/client/models/fund_operation.rb +373 -0
- data/lib/coinbase/client/models/fund_operation_fees.rb +238 -0
- data/lib/coinbase/client/models/fund_operation_list.rb +275 -0
- data/lib/coinbase/client/models/fund_quote.rb +339 -0
- data/lib/coinbase/client/models/onchain_name.rb +357 -0
- data/lib/coinbase/client/models/onchain_name_list.rb +262 -0
- data/lib/coinbase/client/models/read_contract_request.rb +249 -0
- data/lib/coinbase/client/models/solidity_value.rb +287 -0
- data/lib/coinbase/client/models/token_transfer_type.rb +43 -0
- data/lib/coinbase/client/models/update_webhook_request.rb +0 -7
- data/lib/coinbase/client.rb +17 -0
- data/lib/coinbase/faucet_transaction.rb +64 -4
- data/lib/coinbase/smart_contract.rb +95 -0
- data/lib/coinbase/transaction.rb +8 -2
- data/lib/coinbase/version.rb +1 -1
- metadata +18 -2
@@ -0,0 +1,239 @@
|
|
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
|
+
# An amount in cryptocurrency
|
18
|
+
class CryptoAmount
|
19
|
+
# The amount of the crypto in atomic units
|
20
|
+
attr_accessor :amount
|
21
|
+
|
22
|
+
attr_accessor :asset
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'amount' => :'amount',
|
28
|
+
:'asset' => :'asset'
|
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
|
+
:'amount' => :'String',
|
41
|
+
:'asset' => :'Asset'
|
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::CryptoAmount` 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::CryptoAmount`. 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?(:'amount')
|
67
|
+
self.amount = attributes[:'amount']
|
68
|
+
else
|
69
|
+
self.amount = nil
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'asset')
|
73
|
+
self.asset = attributes[:'asset']
|
74
|
+
else
|
75
|
+
self.asset = nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
83
|
+
invalid_properties = Array.new
|
84
|
+
if @amount.nil?
|
85
|
+
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
86
|
+
end
|
87
|
+
|
88
|
+
if @asset.nil?
|
89
|
+
invalid_properties.push('invalid value for "asset", asset cannot be nil.')
|
90
|
+
end
|
91
|
+
|
92
|
+
invalid_properties
|
93
|
+
end
|
94
|
+
|
95
|
+
# Check to see if the all the properties in the model are valid
|
96
|
+
# @return true if the model is valid
|
97
|
+
def valid?
|
98
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
99
|
+
return false if @amount.nil?
|
100
|
+
return false if @asset.nil?
|
101
|
+
true
|
102
|
+
end
|
103
|
+
|
104
|
+
# Checks equality by comparing each attribute.
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def ==(o)
|
107
|
+
return true if self.equal?(o)
|
108
|
+
self.class == o.class &&
|
109
|
+
amount == o.amount &&
|
110
|
+
asset == o.asset
|
111
|
+
end
|
112
|
+
|
113
|
+
# @see the `==` method
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def eql?(o)
|
116
|
+
self == o
|
117
|
+
end
|
118
|
+
|
119
|
+
# Calculates hash code according to all attributes.
|
120
|
+
# @return [Integer] Hash code
|
121
|
+
def hash
|
122
|
+
[amount, asset].hash
|
123
|
+
end
|
124
|
+
|
125
|
+
# Builds the object from hash
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
+
# @return [Object] Returns the model itself
|
128
|
+
def self.build_from_hash(attributes)
|
129
|
+
return nil unless attributes.is_a?(Hash)
|
130
|
+
attributes = attributes.transform_keys(&:to_sym)
|
131
|
+
transformed_hash = {}
|
132
|
+
openapi_types.each_pair do |key, type|
|
133
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
134
|
+
transformed_hash["#{key}"] = nil
|
135
|
+
elsif type =~ /\AArray<(.*)>/i
|
136
|
+
# check to ensure the input is an array given that the attribute
|
137
|
+
# is documented as an array but the input is not
|
138
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
139
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
140
|
+
end
|
141
|
+
elsif !attributes[attribute_map[key]].nil?
|
142
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
143
|
+
end
|
144
|
+
end
|
145
|
+
new(transformed_hash)
|
146
|
+
end
|
147
|
+
|
148
|
+
# Deserializes the data based on type
|
149
|
+
# @param string type Data type
|
150
|
+
# @param string value Value to be deserialized
|
151
|
+
# @return [Object] Deserialized data
|
152
|
+
def self._deserialize(type, value)
|
153
|
+
case type.to_sym
|
154
|
+
when :Time
|
155
|
+
Time.parse(value)
|
156
|
+
when :Date
|
157
|
+
Date.parse(value)
|
158
|
+
when :String
|
159
|
+
value.to_s
|
160
|
+
when :Integer
|
161
|
+
value.to_i
|
162
|
+
when :Float
|
163
|
+
value.to_f
|
164
|
+
when :Boolean
|
165
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
166
|
+
true
|
167
|
+
else
|
168
|
+
false
|
169
|
+
end
|
170
|
+
when :Object
|
171
|
+
# generic object (usually a Hash), return directly
|
172
|
+
value
|
173
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
174
|
+
inner_type = Regexp.last_match[:inner_type]
|
175
|
+
value.map { |v| _deserialize(inner_type, v) }
|
176
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
177
|
+
k_type = Regexp.last_match[:k_type]
|
178
|
+
v_type = Regexp.last_match[:v_type]
|
179
|
+
{}.tap do |hash|
|
180
|
+
value.each do |k, v|
|
181
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
else # model
|
185
|
+
# models (e.g. Pet) or oneOf
|
186
|
+
klass = Coinbase::Client.const_get(type)
|
187
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Returns the string representation of the object
|
192
|
+
# @return [String] String presentation of the object
|
193
|
+
def to_s
|
194
|
+
to_hash.to_s
|
195
|
+
end
|
196
|
+
|
197
|
+
# to_body is an alias to to_hash (backward compatibility)
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
199
|
+
def to_body
|
200
|
+
to_hash
|
201
|
+
end
|
202
|
+
|
203
|
+
# Returns the object in the form of hash
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_hash
|
206
|
+
hash = {}
|
207
|
+
self.class.attribute_map.each_pair do |attr, param|
|
208
|
+
value = self.send(attr)
|
209
|
+
if value.nil?
|
210
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
211
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
212
|
+
end
|
213
|
+
|
214
|
+
hash[param] = _to_hash(value)
|
215
|
+
end
|
216
|
+
hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Outputs non-array value in the form of hash
|
220
|
+
# For object, use to_hash. Otherwise, just return the value
|
221
|
+
# @param [Object] value Any valid value
|
222
|
+
# @return [Hash] Returns the value in the form of hash
|
223
|
+
def _to_hash(value)
|
224
|
+
if value.is_a?(Array)
|
225
|
+
value.compact.map { |v| _to_hash(v) }
|
226
|
+
elsif value.is_a?(Hash)
|
227
|
+
{}.tap do |hash|
|
228
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
229
|
+
end
|
230
|
+
elsif value.respond_to? :to_hash
|
231
|
+
value.to_hash
|
232
|
+
else
|
233
|
+
value
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|
@@ -0,0 +1,327 @@
|
|
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 EthereumTokenTransfer
|
18
|
+
attr_accessor :contract_address
|
19
|
+
|
20
|
+
attr_accessor :from_address
|
21
|
+
|
22
|
+
attr_accessor :to_address
|
23
|
+
|
24
|
+
# The value of the transaction in atomic units of the token being transfer for ERC20 or ERC1155 contracts.
|
25
|
+
attr_accessor :value
|
26
|
+
|
27
|
+
# The ID of ERC721 or ERC1155 token being transferred.
|
28
|
+
attr_accessor :token_id
|
29
|
+
|
30
|
+
attr_accessor :log_index
|
31
|
+
|
32
|
+
attr_accessor :token_transfer_type
|
33
|
+
|
34
|
+
class EnumAttributeValidator
|
35
|
+
attr_reader :datatype
|
36
|
+
attr_reader :allowable_values
|
37
|
+
|
38
|
+
def initialize(datatype, allowable_values)
|
39
|
+
@allowable_values = allowable_values.map do |value|
|
40
|
+
case datatype.to_s
|
41
|
+
when /Integer/i
|
42
|
+
value.to_i
|
43
|
+
when /Float/i
|
44
|
+
value.to_f
|
45
|
+
else
|
46
|
+
value
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def valid?(value)
|
52
|
+
!value || allowable_values.include?(value)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
57
|
+
def self.attribute_map
|
58
|
+
{
|
59
|
+
:'contract_address' => :'contract_address',
|
60
|
+
:'from_address' => :'from_address',
|
61
|
+
:'to_address' => :'to_address',
|
62
|
+
:'value' => :'value',
|
63
|
+
:'token_id' => :'token_id',
|
64
|
+
:'log_index' => :'log_index',
|
65
|
+
:'token_transfer_type' => :'token_transfer_type'
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Returns all the JSON keys this model knows about
|
70
|
+
def self.acceptable_attributes
|
71
|
+
attribute_map.values
|
72
|
+
end
|
73
|
+
|
74
|
+
# Attribute type mapping.
|
75
|
+
def self.openapi_types
|
76
|
+
{
|
77
|
+
:'contract_address' => :'String',
|
78
|
+
:'from_address' => :'String',
|
79
|
+
:'to_address' => :'String',
|
80
|
+
:'value' => :'String',
|
81
|
+
:'token_id' => :'String',
|
82
|
+
:'log_index' => :'Integer',
|
83
|
+
:'token_transfer_type' => :'TokenTransferType'
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
# List of attributes with nullable: true
|
88
|
+
def self.openapi_nullable
|
89
|
+
Set.new([
|
90
|
+
])
|
91
|
+
end
|
92
|
+
|
93
|
+
# Initializes the object
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
def initialize(attributes = {})
|
96
|
+
if (!attributes.is_a?(Hash))
|
97
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::EthereumTokenTransfer` initialize method"
|
98
|
+
end
|
99
|
+
|
100
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
101
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
102
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
103
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::EthereumTokenTransfer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
104
|
+
end
|
105
|
+
h[k.to_sym] = v
|
106
|
+
}
|
107
|
+
|
108
|
+
if attributes.key?(:'contract_address')
|
109
|
+
self.contract_address = attributes[:'contract_address']
|
110
|
+
else
|
111
|
+
self.contract_address = nil
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'from_address')
|
115
|
+
self.from_address = attributes[:'from_address']
|
116
|
+
else
|
117
|
+
self.from_address = nil
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'to_address')
|
121
|
+
self.to_address = attributes[:'to_address']
|
122
|
+
else
|
123
|
+
self.to_address = nil
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'value')
|
127
|
+
self.value = attributes[:'value']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'token_id')
|
131
|
+
self.token_id = attributes[:'token_id']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'log_index')
|
135
|
+
self.log_index = attributes[:'log_index']
|
136
|
+
else
|
137
|
+
self.log_index = nil
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'token_transfer_type')
|
141
|
+
self.token_transfer_type = attributes[:'token_transfer_type']
|
142
|
+
else
|
143
|
+
self.token_transfer_type = nil
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
148
|
+
# @return Array for valid properties with the reasons
|
149
|
+
def list_invalid_properties
|
150
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
151
|
+
invalid_properties = Array.new
|
152
|
+
if @contract_address.nil?
|
153
|
+
invalid_properties.push('invalid value for "contract_address", contract_address cannot be nil.')
|
154
|
+
end
|
155
|
+
|
156
|
+
if @from_address.nil?
|
157
|
+
invalid_properties.push('invalid value for "from_address", from_address cannot be nil.')
|
158
|
+
end
|
159
|
+
|
160
|
+
if @to_address.nil?
|
161
|
+
invalid_properties.push('invalid value for "to_address", to_address cannot be nil.')
|
162
|
+
end
|
163
|
+
|
164
|
+
if @log_index.nil?
|
165
|
+
invalid_properties.push('invalid value for "log_index", log_index cannot be nil.')
|
166
|
+
end
|
167
|
+
|
168
|
+
if @token_transfer_type.nil?
|
169
|
+
invalid_properties.push('invalid value for "token_transfer_type", token_transfer_type cannot be nil.')
|
170
|
+
end
|
171
|
+
|
172
|
+
invalid_properties
|
173
|
+
end
|
174
|
+
|
175
|
+
# Check to see if the all the properties in the model are valid
|
176
|
+
# @return true if the model is valid
|
177
|
+
def valid?
|
178
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
179
|
+
return false if @contract_address.nil?
|
180
|
+
return false if @from_address.nil?
|
181
|
+
return false if @to_address.nil?
|
182
|
+
return false if @log_index.nil?
|
183
|
+
return false if @token_transfer_type.nil?
|
184
|
+
true
|
185
|
+
end
|
186
|
+
|
187
|
+
# Checks equality by comparing each attribute.
|
188
|
+
# @param [Object] Object to be compared
|
189
|
+
def ==(o)
|
190
|
+
return true if self.equal?(o)
|
191
|
+
self.class == o.class &&
|
192
|
+
contract_address == o.contract_address &&
|
193
|
+
from_address == o.from_address &&
|
194
|
+
to_address == o.to_address &&
|
195
|
+
value == o.value &&
|
196
|
+
token_id == o.token_id &&
|
197
|
+
log_index == o.log_index &&
|
198
|
+
token_transfer_type == o.token_transfer_type
|
199
|
+
end
|
200
|
+
|
201
|
+
# @see the `==` method
|
202
|
+
# @param [Object] Object to be compared
|
203
|
+
def eql?(o)
|
204
|
+
self == o
|
205
|
+
end
|
206
|
+
|
207
|
+
# Calculates hash code according to all attributes.
|
208
|
+
# @return [Integer] Hash code
|
209
|
+
def hash
|
210
|
+
[contract_address, from_address, to_address, value, token_id, log_index, token_transfer_type].hash
|
211
|
+
end
|
212
|
+
|
213
|
+
# Builds the object from hash
|
214
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
215
|
+
# @return [Object] Returns the model itself
|
216
|
+
def self.build_from_hash(attributes)
|
217
|
+
return nil unless attributes.is_a?(Hash)
|
218
|
+
attributes = attributes.transform_keys(&:to_sym)
|
219
|
+
transformed_hash = {}
|
220
|
+
openapi_types.each_pair do |key, type|
|
221
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
222
|
+
transformed_hash["#{key}"] = nil
|
223
|
+
elsif type =~ /\AArray<(.*)>/i
|
224
|
+
# check to ensure the input is an array given that the attribute
|
225
|
+
# is documented as an array but the input is not
|
226
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
227
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
228
|
+
end
|
229
|
+
elsif !attributes[attribute_map[key]].nil?
|
230
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
231
|
+
end
|
232
|
+
end
|
233
|
+
new(transformed_hash)
|
234
|
+
end
|
235
|
+
|
236
|
+
# Deserializes the data based on type
|
237
|
+
# @param string type Data type
|
238
|
+
# @param string value Value to be deserialized
|
239
|
+
# @return [Object] Deserialized data
|
240
|
+
def self._deserialize(type, value)
|
241
|
+
case type.to_sym
|
242
|
+
when :Time
|
243
|
+
Time.parse(value)
|
244
|
+
when :Date
|
245
|
+
Date.parse(value)
|
246
|
+
when :String
|
247
|
+
value.to_s
|
248
|
+
when :Integer
|
249
|
+
value.to_i
|
250
|
+
when :Float
|
251
|
+
value.to_f
|
252
|
+
when :Boolean
|
253
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
254
|
+
true
|
255
|
+
else
|
256
|
+
false
|
257
|
+
end
|
258
|
+
when :Object
|
259
|
+
# generic object (usually a Hash), return directly
|
260
|
+
value
|
261
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
262
|
+
inner_type = Regexp.last_match[:inner_type]
|
263
|
+
value.map { |v| _deserialize(inner_type, v) }
|
264
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
265
|
+
k_type = Regexp.last_match[:k_type]
|
266
|
+
v_type = Regexp.last_match[:v_type]
|
267
|
+
{}.tap do |hash|
|
268
|
+
value.each do |k, v|
|
269
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
else # model
|
273
|
+
# models (e.g. Pet) or oneOf
|
274
|
+
klass = Coinbase::Client.const_get(type)
|
275
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
# Returns the string representation of the object
|
280
|
+
# @return [String] String presentation of the object
|
281
|
+
def to_s
|
282
|
+
to_hash.to_s
|
283
|
+
end
|
284
|
+
|
285
|
+
# to_body is an alias to to_hash (backward compatibility)
|
286
|
+
# @return [Hash] Returns the object in the form of hash
|
287
|
+
def to_body
|
288
|
+
to_hash
|
289
|
+
end
|
290
|
+
|
291
|
+
# Returns the object in the form of hash
|
292
|
+
# @return [Hash] Returns the object in the form of hash
|
293
|
+
def to_hash
|
294
|
+
hash = {}
|
295
|
+
self.class.attribute_map.each_pair do |attr, param|
|
296
|
+
value = self.send(attr)
|
297
|
+
if value.nil?
|
298
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
299
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
300
|
+
end
|
301
|
+
|
302
|
+
hash[param] = _to_hash(value)
|
303
|
+
end
|
304
|
+
hash
|
305
|
+
end
|
306
|
+
|
307
|
+
# Outputs non-array value in the form of hash
|
308
|
+
# For object, use to_hash. Otherwise, just return the value
|
309
|
+
# @param [Object] value Any valid value
|
310
|
+
# @return [Hash] Returns the value in the form of hash
|
311
|
+
def _to_hash(value)
|
312
|
+
if value.is_a?(Array)
|
313
|
+
value.compact.map { |v| _to_hash(v) }
|
314
|
+
elsif value.is_a?(Hash)
|
315
|
+
{}.tap do |hash|
|
316
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
317
|
+
end
|
318
|
+
elsif value.respond_to? :to_hash
|
319
|
+
value.to_hash
|
320
|
+
else
|
321
|
+
value
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
end
|
326
|
+
|
327
|
+
end
|
@@ -56,6 +56,8 @@ module Coinbase::Client
|
|
56
56
|
|
57
57
|
attr_accessor :transaction_access_list
|
58
58
|
|
59
|
+
attr_accessor :token_transfers
|
60
|
+
|
59
61
|
attr_accessor :flattened_traces
|
60
62
|
|
61
63
|
# The timestamp of the block in which the event was emitted
|
@@ -81,6 +83,7 @@ module Coinbase::Client
|
|
81
83
|
:'max_priority_fee_per_gas' => :'max_priority_fee_per_gas',
|
82
84
|
:'priority_fee_per_gas' => :'priority_fee_per_gas',
|
83
85
|
:'transaction_access_list' => :'transaction_access_list',
|
86
|
+
:'token_transfers' => :'token_transfers',
|
84
87
|
:'flattened_traces' => :'flattened_traces',
|
85
88
|
:'block_timestamp' => :'block_timestamp',
|
86
89
|
:'mint' => :'mint'
|
@@ -109,6 +112,7 @@ module Coinbase::Client
|
|
109
112
|
:'max_priority_fee_per_gas' => :'Integer',
|
110
113
|
:'priority_fee_per_gas' => :'Integer',
|
111
114
|
:'transaction_access_list' => :'EthereumTransactionAccessList',
|
115
|
+
:'token_transfers' => :'Array<EthereumTokenTransfer>',
|
112
116
|
:'flattened_traces' => :'Array<EthereumTransactionFlattenedTrace>',
|
113
117
|
:'block_timestamp' => :'Time',
|
114
118
|
:'mint' => :'String'
|
@@ -196,6 +200,12 @@ module Coinbase::Client
|
|
196
200
|
self.transaction_access_list = attributes[:'transaction_access_list']
|
197
201
|
end
|
198
202
|
|
203
|
+
if attributes.key?(:'token_transfers')
|
204
|
+
if (value = attributes[:'token_transfers']).is_a?(Array)
|
205
|
+
self.token_transfers = value
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
199
209
|
if attributes.key?(:'flattened_traces')
|
200
210
|
if (value = attributes[:'flattened_traces']).is_a?(Array)
|
201
211
|
self.flattened_traces = value
|
@@ -255,6 +265,7 @@ module Coinbase::Client
|
|
255
265
|
max_priority_fee_per_gas == o.max_priority_fee_per_gas &&
|
256
266
|
priority_fee_per_gas == o.priority_fee_per_gas &&
|
257
267
|
transaction_access_list == o.transaction_access_list &&
|
268
|
+
token_transfers == o.token_transfers &&
|
258
269
|
flattened_traces == o.flattened_traces &&
|
259
270
|
block_timestamp == o.block_timestamp &&
|
260
271
|
mint == o.mint
|
@@ -269,7 +280,7 @@ module Coinbase::Client
|
|
269
280
|
# Calculates hash code according to all attributes.
|
270
281
|
# @return [Integer] Hash code
|
271
282
|
def hash
|
272
|
-
[from, gas, gas_price, hash, input, nonce, to, index, value, type, max_fee_per_gas, max_priority_fee_per_gas, priority_fee_per_gas, transaction_access_list, flattened_traces, block_timestamp, mint].hash
|
283
|
+
[from, gas, gas_price, hash, input, nonce, to, index, value, type, max_fee_per_gas, max_priority_fee_per_gas, priority_fee_per_gas, transaction_access_list, token_transfers, flattened_traces, block_timestamp, mint].hash
|
273
284
|
end
|
274
285
|
|
275
286
|
# Builds the object from hash
|
@@ -22,11 +22,14 @@ module Coinbase::Client
|
|
22
22
|
# Link to the transaction on the blockchain explorer.
|
23
23
|
attr_accessor :transaction_link
|
24
24
|
|
25
|
+
attr_accessor :transaction
|
26
|
+
|
25
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
28
|
def self.attribute_map
|
27
29
|
{
|
28
30
|
:'transaction_hash' => :'transaction_hash',
|
29
|
-
:'transaction_link' => :'transaction_link'
|
31
|
+
:'transaction_link' => :'transaction_link',
|
32
|
+
:'transaction' => :'transaction'
|
30
33
|
}
|
31
34
|
end
|
32
35
|
|
@@ -39,7 +42,8 @@ module Coinbase::Client
|
|
39
42
|
def self.openapi_types
|
40
43
|
{
|
41
44
|
:'transaction_hash' => :'String',
|
42
|
-
:'transaction_link' => :'String'
|
45
|
+
:'transaction_link' => :'String',
|
46
|
+
:'transaction' => :'Transaction'
|
43
47
|
}
|
44
48
|
end
|
45
49
|
|
@@ -75,6 +79,12 @@ module Coinbase::Client
|
|
75
79
|
else
|
76
80
|
self.transaction_link = nil
|
77
81
|
end
|
82
|
+
|
83
|
+
if attributes.key?(:'transaction')
|
84
|
+
self.transaction = attributes[:'transaction']
|
85
|
+
else
|
86
|
+
self.transaction = nil
|
87
|
+
end
|
78
88
|
end
|
79
89
|
|
80
90
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -90,6 +100,10 @@ module Coinbase::Client
|
|
90
100
|
invalid_properties.push('invalid value for "transaction_link", transaction_link cannot be nil.')
|
91
101
|
end
|
92
102
|
|
103
|
+
if @transaction.nil?
|
104
|
+
invalid_properties.push('invalid value for "transaction", transaction cannot be nil.')
|
105
|
+
end
|
106
|
+
|
93
107
|
invalid_properties
|
94
108
|
end
|
95
109
|
|
@@ -99,6 +113,7 @@ module Coinbase::Client
|
|
99
113
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
100
114
|
return false if @transaction_hash.nil?
|
101
115
|
return false if @transaction_link.nil?
|
116
|
+
return false if @transaction.nil?
|
102
117
|
true
|
103
118
|
end
|
104
119
|
|
@@ -108,7 +123,8 @@ module Coinbase::Client
|
|
108
123
|
return true if self.equal?(o)
|
109
124
|
self.class == o.class &&
|
110
125
|
transaction_hash == o.transaction_hash &&
|
111
|
-
transaction_link == o.transaction_link
|
126
|
+
transaction_link == o.transaction_link &&
|
127
|
+
transaction == o.transaction
|
112
128
|
end
|
113
129
|
|
114
130
|
# @see the `==` method
|
@@ -120,7 +136,7 @@ module Coinbase::Client
|
|
120
136
|
# Calculates hash code according to all attributes.
|
121
137
|
# @return [Integer] Hash code
|
122
138
|
def hash
|
123
|
-
[transaction_hash, transaction_link].hash
|
139
|
+
[transaction_hash, transaction_link, transaction].hash
|
124
140
|
end
|
125
141
|
|
126
142
|
# Builds the object from hash
|