coinbase-sdk 0.11.0 → 0.14.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 +6 -3
- data/lib/coinbase/address.rb +22 -3
- data/lib/coinbase/address_reputation.rb +67 -0
- data/lib/coinbase/client/api/addresses_api.rb +9 -9
- data/lib/coinbase/client/api/assets_api.rb +1 -1
- data/lib/coinbase/client/api/balance_history_api.rb +1 -1
- data/lib/coinbase/client/api/contract_events_api.rb +1 -1
- data/lib/coinbase/client/api/contract_invocations_api.rb +4 -4
- data/lib/coinbase/client/api/external_addresses_api.rb +245 -4
- data/lib/coinbase/client/api/fund_api.rb +4 -4
- data/lib/coinbase/client/api/mpc_wallet_stake_api.rb +3 -3
- data/lib/coinbase/client/api/networks_api.rb +1 -1
- data/lib/coinbase/client/api/onchain_identity_api.rb +1 -1
- data/lib/coinbase/client/api/reputation_api.rb +1 -70
- data/lib/coinbase/client/api/server_signers_api.rb +6 -6
- data/lib/coinbase/client/api/smart_contracts_api.rb +168 -25
- data/lib/coinbase/client/api/stake_api.rb +7 -7
- data/lib/coinbase/client/api/trades_api.rb +4 -4
- data/lib/coinbase/client/api/transaction_history_api.rb +1 -1
- data/lib/coinbase/client/api/transfers_api.rb +4 -4
- data/lib/coinbase/client/api/wallets_api.rb +5 -5
- data/lib/coinbase/client/api/webhooks_api.rb +5 -5
- data/lib/coinbase/client/configuration.rb +14 -0
- data/lib/coinbase/client/models/address_reputation.rb +15 -8
- data/lib/coinbase/client/models/{address_risk.rb → broadcast_external_transfer_request.rb} +15 -16
- data/lib/coinbase/client/models/create_external_transfer_request.rb +283 -0
- data/lib/coinbase/client/models/create_fund_operation_request.rb +1 -1
- data/lib/coinbase/client/models/create_fund_quote_request.rb +1 -1
- data/lib/coinbase/client/models/create_transfer_request.rb +15 -5
- data/lib/coinbase/client/models/ethereum_transaction.rb +14 -4
- data/lib/coinbase/client/models/register_smart_contract_request.rb +252 -0
- data/lib/coinbase/client/models/smart_contract.rb +36 -30
- data/lib/coinbase/client/models/smart_contract_activity_event.rb +386 -0
- data/lib/coinbase/client/models/smart_contract_type.rb +2 -1
- data/lib/coinbase/client/models/transfer.rb +1 -36
- data/lib/coinbase/client/models/update_smart_contract_request.rb +245 -0
- data/lib/coinbase/client/models/webhook_event_type.rb +2 -1
- data/lib/coinbase/client/models/webhook_event_type_filter.rb +1 -0
- data/lib/coinbase/client/models/webhook_smart_contract_event_filter.rb +225 -0
- data/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +7 -0
- data/lib/coinbase/client.rb +6 -1
- data/lib/coinbase/errors.rb +8 -0
- data/lib/coinbase/smart_contract.rb +338 -245
- data/lib/coinbase/transfer.rb +24 -2
- 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 +13 -7
@@ -0,0 +1,252 @@
|
|
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.9.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# Smart Contract data to be registered
|
18
|
+
class RegisterSmartContractRequest
|
19
|
+
# ABI of the smart contract
|
20
|
+
attr_accessor :abi
|
21
|
+
|
22
|
+
# Name of the smart contract
|
23
|
+
attr_accessor :contract_name
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'abi' => :'abi',
|
29
|
+
:'contract_name' => :'contract_name'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'abi' => :'String',
|
42
|
+
:'contract_name' => :'String'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# List of attributes with nullable: true
|
47
|
+
def self.openapi_nullable
|
48
|
+
Set.new([
|
49
|
+
])
|
50
|
+
end
|
51
|
+
|
52
|
+
# Initializes the object
|
53
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
54
|
+
def initialize(attributes = {})
|
55
|
+
if (!attributes.is_a?(Hash))
|
56
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::RegisterSmartContractRequest` initialize method"
|
57
|
+
end
|
58
|
+
|
59
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
60
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
61
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
62
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::RegisterSmartContractRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
63
|
+
end
|
64
|
+
h[k.to_sym] = v
|
65
|
+
}
|
66
|
+
|
67
|
+
if attributes.key?(:'abi')
|
68
|
+
self.abi = attributes[:'abi']
|
69
|
+
else
|
70
|
+
self.abi = nil
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'contract_name')
|
74
|
+
self.contract_name = attributes[:'contract_name']
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
79
|
+
# @return Array for valid properties with the reasons
|
80
|
+
def list_invalid_properties
|
81
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
82
|
+
invalid_properties = Array.new
|
83
|
+
if @abi.nil?
|
84
|
+
invalid_properties.push('invalid value for "abi", abi cannot be nil.')
|
85
|
+
end
|
86
|
+
|
87
|
+
if !@contract_name.nil? && @contract_name.to_s.length > 100
|
88
|
+
invalid_properties.push('invalid value for "contract_name", the character length must be smaller than or equal to 100.')
|
89
|
+
end
|
90
|
+
|
91
|
+
invalid_properties
|
92
|
+
end
|
93
|
+
|
94
|
+
# Check to see if the all the properties in the model are valid
|
95
|
+
# @return true if the model is valid
|
96
|
+
def valid?
|
97
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
98
|
+
return false if @abi.nil?
|
99
|
+
return false if !@contract_name.nil? && @contract_name.to_s.length > 100
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
# Custom attribute writer method with validation
|
104
|
+
# @param [Object] contract_name Value to be assigned
|
105
|
+
def contract_name=(contract_name)
|
106
|
+
if contract_name.nil?
|
107
|
+
fail ArgumentError, 'contract_name cannot be nil'
|
108
|
+
end
|
109
|
+
|
110
|
+
if contract_name.to_s.length > 100
|
111
|
+
fail ArgumentError, 'invalid value for "contract_name", the character length must be smaller than or equal to 100.'
|
112
|
+
end
|
113
|
+
|
114
|
+
@contract_name = contract_name
|
115
|
+
end
|
116
|
+
|
117
|
+
# Checks equality by comparing each attribute.
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def ==(o)
|
120
|
+
return true if self.equal?(o)
|
121
|
+
self.class == o.class &&
|
122
|
+
abi == o.abi &&
|
123
|
+
contract_name == o.contract_name
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Integer] Hash code
|
134
|
+
def hash
|
135
|
+
[abi, contract_name].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def self.build_from_hash(attributes)
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
143
|
+
attributes = attributes.transform_keys(&:to_sym)
|
144
|
+
transformed_hash = {}
|
145
|
+
openapi_types.each_pair do |key, type|
|
146
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
147
|
+
transformed_hash["#{key}"] = nil
|
148
|
+
elsif type =~ /\AArray<(.*)>/i
|
149
|
+
# check to ensure the input is an array given that the attribute
|
150
|
+
# is documented as an array but the input is not
|
151
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
152
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
153
|
+
end
|
154
|
+
elsif !attributes[attribute_map[key]].nil?
|
155
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
156
|
+
end
|
157
|
+
end
|
158
|
+
new(transformed_hash)
|
159
|
+
end
|
160
|
+
|
161
|
+
# Deserializes the data based on type
|
162
|
+
# @param string type Data type
|
163
|
+
# @param string value Value to be deserialized
|
164
|
+
# @return [Object] Deserialized data
|
165
|
+
def self._deserialize(type, value)
|
166
|
+
case type.to_sym
|
167
|
+
when :Time
|
168
|
+
Time.parse(value)
|
169
|
+
when :Date
|
170
|
+
Date.parse(value)
|
171
|
+
when :String
|
172
|
+
value.to_s
|
173
|
+
when :Integer
|
174
|
+
value.to_i
|
175
|
+
when :Float
|
176
|
+
value.to_f
|
177
|
+
when :Boolean
|
178
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
179
|
+
true
|
180
|
+
else
|
181
|
+
false
|
182
|
+
end
|
183
|
+
when :Object
|
184
|
+
# generic object (usually a Hash), return directly
|
185
|
+
value
|
186
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
187
|
+
inner_type = Regexp.last_match[:inner_type]
|
188
|
+
value.map { |v| _deserialize(inner_type, v) }
|
189
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
190
|
+
k_type = Regexp.last_match[:k_type]
|
191
|
+
v_type = Regexp.last_match[:v_type]
|
192
|
+
{}.tap do |hash|
|
193
|
+
value.each do |k, v|
|
194
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
else # model
|
198
|
+
# models (e.g. Pet) or oneOf
|
199
|
+
klass = Coinbase::Client.const_get(type)
|
200
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# Returns the string representation of the object
|
205
|
+
# @return [String] String presentation of the object
|
206
|
+
def to_s
|
207
|
+
to_hash.to_s
|
208
|
+
end
|
209
|
+
|
210
|
+
# to_body is an alias to to_hash (backward compatibility)
|
211
|
+
# @return [Hash] Returns the object in the form of hash
|
212
|
+
def to_body
|
213
|
+
to_hash
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the object in the form of hash
|
217
|
+
# @return [Hash] Returns the object in the form of hash
|
218
|
+
def to_hash
|
219
|
+
hash = {}
|
220
|
+
self.class.attribute_map.each_pair do |attr, param|
|
221
|
+
value = self.send(attr)
|
222
|
+
if value.nil?
|
223
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
224
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
225
|
+
end
|
226
|
+
|
227
|
+
hash[param] = _to_hash(value)
|
228
|
+
end
|
229
|
+
hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# Outputs non-array value in the form of hash
|
233
|
+
# For object, use to_hash. Otherwise, just return the value
|
234
|
+
# @param [Object] value Any valid value
|
235
|
+
# @return [Hash] Returns the value in the form of hash
|
236
|
+
def _to_hash(value)
|
237
|
+
if value.is_a?(Array)
|
238
|
+
value.compact.map { |v| _to_hash(v) }
|
239
|
+
elsif value.is_a?(Hash)
|
240
|
+
{}.tap do |hash|
|
241
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
242
|
+
end
|
243
|
+
elsif value.respond_to? :to_hash
|
244
|
+
value.to_hash
|
245
|
+
else
|
246
|
+
value
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
end
|
251
|
+
|
252
|
+
end
|
@@ -16,19 +16,22 @@ require 'time'
|
|
16
16
|
module Coinbase::Client
|
17
17
|
# Represents a smart contract on the blockchain
|
18
18
|
class SmartContract
|
19
|
-
# The unique identifier of the smart contract
|
19
|
+
# The unique identifier of the smart contract.
|
20
20
|
attr_accessor :smart_contract_id
|
21
21
|
|
22
22
|
# The name of the blockchain network
|
23
23
|
attr_accessor :network_id
|
24
24
|
|
25
|
-
# The ID of the wallet that deployed the smart contract
|
25
|
+
# The ID of the wallet that deployed the smart contract. If this smart contract was deployed externally, this will be omitted.
|
26
26
|
attr_accessor :wallet_id
|
27
27
|
|
28
28
|
# The EVM address of the smart contract
|
29
29
|
attr_accessor :contract_address
|
30
30
|
|
31
|
-
# The
|
31
|
+
# The name of the smart contract
|
32
|
+
attr_accessor :contract_name
|
33
|
+
|
34
|
+
# The EVM address of the account that deployed the smart contract. If this smart contract was deployed externally, this will be omitted.
|
32
35
|
attr_accessor :deployer_address
|
33
36
|
|
34
37
|
attr_accessor :type
|
@@ -40,6 +43,9 @@ module Coinbase::Client
|
|
40
43
|
|
41
44
|
attr_accessor :transaction
|
42
45
|
|
46
|
+
# Whether the smart contract was deployed externally. If true, the deployer_address and transaction will be omitted.
|
47
|
+
attr_accessor :is_external
|
48
|
+
|
43
49
|
class EnumAttributeValidator
|
44
50
|
attr_reader :datatype
|
45
51
|
attr_reader :allowable_values
|
@@ -69,11 +75,13 @@ module Coinbase::Client
|
|
69
75
|
:'network_id' => :'network_id',
|
70
76
|
:'wallet_id' => :'wallet_id',
|
71
77
|
:'contract_address' => :'contract_address',
|
78
|
+
:'contract_name' => :'contract_name',
|
72
79
|
:'deployer_address' => :'deployer_address',
|
73
80
|
:'type' => :'type',
|
74
81
|
:'options' => :'options',
|
75
82
|
:'abi' => :'abi',
|
76
|
-
:'transaction' => :'transaction'
|
83
|
+
:'transaction' => :'transaction',
|
84
|
+
:'is_external' => :'is_external'
|
77
85
|
}
|
78
86
|
end
|
79
87
|
|
@@ -89,11 +97,13 @@ module Coinbase::Client
|
|
89
97
|
:'network_id' => :'String',
|
90
98
|
:'wallet_id' => :'String',
|
91
99
|
:'contract_address' => :'String',
|
100
|
+
:'contract_name' => :'String',
|
92
101
|
:'deployer_address' => :'String',
|
93
102
|
:'type' => :'SmartContractType',
|
94
103
|
:'options' => :'SmartContractOptions',
|
95
104
|
:'abi' => :'String',
|
96
|
-
:'transaction' => :'Transaction'
|
105
|
+
:'transaction' => :'Transaction',
|
106
|
+
:'is_external' => :'Boolean'
|
97
107
|
}
|
98
108
|
end
|
99
109
|
|
@@ -132,8 +142,6 @@ module Coinbase::Client
|
|
132
142
|
|
133
143
|
if attributes.key?(:'wallet_id')
|
134
144
|
self.wallet_id = attributes[:'wallet_id']
|
135
|
-
else
|
136
|
-
self.wallet_id = nil
|
137
145
|
end
|
138
146
|
|
139
147
|
if attributes.key?(:'contract_address')
|
@@ -142,10 +150,14 @@ module Coinbase::Client
|
|
142
150
|
self.contract_address = nil
|
143
151
|
end
|
144
152
|
|
153
|
+
if attributes.key?(:'contract_name')
|
154
|
+
self.contract_name = attributes[:'contract_name']
|
155
|
+
else
|
156
|
+
self.contract_name = nil
|
157
|
+
end
|
158
|
+
|
145
159
|
if attributes.key?(:'deployer_address')
|
146
160
|
self.deployer_address = attributes[:'deployer_address']
|
147
|
-
else
|
148
|
-
self.deployer_address = nil
|
149
161
|
end
|
150
162
|
|
151
163
|
if attributes.key?(:'type')
|
@@ -156,8 +168,6 @@ module Coinbase::Client
|
|
156
168
|
|
157
169
|
if attributes.key?(:'options')
|
158
170
|
self.options = attributes[:'options']
|
159
|
-
else
|
160
|
-
self.options = nil
|
161
171
|
end
|
162
172
|
|
163
173
|
if attributes.key?(:'abi')
|
@@ -168,8 +178,12 @@ module Coinbase::Client
|
|
168
178
|
|
169
179
|
if attributes.key?(:'transaction')
|
170
180
|
self.transaction = attributes[:'transaction']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.key?(:'is_external')
|
184
|
+
self.is_external = attributes[:'is_external']
|
171
185
|
else
|
172
|
-
self.
|
186
|
+
self.is_external = nil
|
173
187
|
end
|
174
188
|
end
|
175
189
|
|
@@ -186,32 +200,24 @@ module Coinbase::Client
|
|
186
200
|
invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
|
187
201
|
end
|
188
202
|
|
189
|
-
if @wallet_id.nil?
|
190
|
-
invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.')
|
191
|
-
end
|
192
|
-
|
193
203
|
if @contract_address.nil?
|
194
204
|
invalid_properties.push('invalid value for "contract_address", contract_address cannot be nil.')
|
195
205
|
end
|
196
206
|
|
197
|
-
if @
|
198
|
-
invalid_properties.push('invalid value for "
|
207
|
+
if @contract_name.nil?
|
208
|
+
invalid_properties.push('invalid value for "contract_name", contract_name cannot be nil.')
|
199
209
|
end
|
200
210
|
|
201
211
|
if @type.nil?
|
202
212
|
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
203
213
|
end
|
204
214
|
|
205
|
-
if @options.nil?
|
206
|
-
invalid_properties.push('invalid value for "options", options cannot be nil.')
|
207
|
-
end
|
208
|
-
|
209
215
|
if @abi.nil?
|
210
216
|
invalid_properties.push('invalid value for "abi", abi cannot be nil.')
|
211
217
|
end
|
212
218
|
|
213
|
-
if @
|
214
|
-
invalid_properties.push('invalid value for "
|
219
|
+
if @is_external.nil?
|
220
|
+
invalid_properties.push('invalid value for "is_external", is_external cannot be nil.')
|
215
221
|
end
|
216
222
|
|
217
223
|
invalid_properties
|
@@ -223,13 +229,11 @@ module Coinbase::Client
|
|
223
229
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
224
230
|
return false if @smart_contract_id.nil?
|
225
231
|
return false if @network_id.nil?
|
226
|
-
return false if @wallet_id.nil?
|
227
232
|
return false if @contract_address.nil?
|
228
|
-
return false if @
|
233
|
+
return false if @contract_name.nil?
|
229
234
|
return false if @type.nil?
|
230
|
-
return false if @options.nil?
|
231
235
|
return false if @abi.nil?
|
232
|
-
return false if @
|
236
|
+
return false if @is_external.nil?
|
233
237
|
true
|
234
238
|
end
|
235
239
|
|
@@ -242,11 +246,13 @@ module Coinbase::Client
|
|
242
246
|
network_id == o.network_id &&
|
243
247
|
wallet_id == o.wallet_id &&
|
244
248
|
contract_address == o.contract_address &&
|
249
|
+
contract_name == o.contract_name &&
|
245
250
|
deployer_address == o.deployer_address &&
|
246
251
|
type == o.type &&
|
247
252
|
options == o.options &&
|
248
253
|
abi == o.abi &&
|
249
|
-
transaction == o.transaction
|
254
|
+
transaction == o.transaction &&
|
255
|
+
is_external == o.is_external
|
250
256
|
end
|
251
257
|
|
252
258
|
# @see the `==` method
|
@@ -258,7 +264,7 @@ module Coinbase::Client
|
|
258
264
|
# Calculates hash code according to all attributes.
|
259
265
|
# @return [Integer] Hash code
|
260
266
|
def hash
|
261
|
-
[smart_contract_id, network_id, wallet_id, contract_address, deployer_address, type, options, abi, transaction].hash
|
267
|
+
[smart_contract_id, network_id, wallet_id, contract_address, contract_name, deployer_address, type, options, abi, transaction, is_external].hash
|
262
268
|
end
|
263
269
|
|
264
270
|
# Builds the object from hash
|