coinbase-sdk 0.0.4 → 0.0.6
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 +79 -42
- data/lib/coinbase/authenticator.rb +1 -1
- data/lib/coinbase/balance.rb +3 -5
- data/lib/coinbase/balance_map.rb +4 -4
- data/lib/coinbase/client/api/server_signers_api.rb +419 -0
- data/lib/coinbase/client/api/trades_api.rb +342 -0
- data/lib/coinbase/client/models/broadcast_trade_request.rb +222 -0
- data/lib/coinbase/client/models/create_address_request.rb +0 -14
- data/lib/coinbase/client/models/create_server_signer_request.rb +239 -0
- data/lib/coinbase/client/models/create_trade_request.rb +256 -0
- data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
- data/lib/coinbase/client/models/create_wallet_request_wallet.rb +233 -0
- data/lib/coinbase/client/models/seed_creation_event.rb +240 -0
- data/lib/coinbase/client/models/seed_creation_event_result.rb +274 -0
- data/lib/coinbase/client/models/server_signer.rb +235 -0
- data/lib/coinbase/client/models/server_signer_event.rb +239 -0
- data/lib/coinbase/client/models/server_signer_event_event.rb +105 -0
- data/lib/coinbase/client/models/server_signer_event_list.rb +275 -0
- data/lib/coinbase/client/models/signature_creation_event.rb +363 -0
- data/lib/coinbase/client/models/signature_creation_event_result.rb +329 -0
- data/lib/coinbase/client/models/trade.rb +356 -0
- data/lib/coinbase/client/models/trade_list.rb +275 -0
- data/lib/coinbase/client/models/transaction.rb +294 -0
- data/lib/coinbase/client/models/transaction_type.rb +39 -0
- data/lib/coinbase/client/models/wallet.rb +55 -4
- data/lib/coinbase/client.rb +18 -0
- data/lib/coinbase/middleware.rb +4 -1
- data/lib/coinbase/transfer.rb +21 -21
- data/lib/coinbase/user.rb +43 -104
- data/lib/coinbase/wallet.rb +312 -58
- data/lib/coinbase.rb +16 -4
- metadata +48 -2
data/lib/coinbase.rb
CHANGED
@@ -27,27 +27,33 @@ module Coinbase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# Configures the Coinbase SDK.
|
30
|
+
# @return [String] A string indicating successful configuration
|
30
31
|
def self.configure
|
31
32
|
yield(configuration)
|
32
33
|
|
33
34
|
raise InvalidConfiguration, 'API key private key is not set' unless configuration.api_key_private_key
|
34
35
|
raise InvalidConfiguration, 'API key name is not set' unless configuration.api_key_name
|
36
|
+
|
37
|
+
'Successfully configured Coinbase SDK'
|
35
38
|
end
|
36
39
|
|
37
40
|
# Configures the Coinbase SDK from the given CDP API Key JSON file.
|
38
41
|
# @param file_path [String] (Optional) the path to the CDP API Key JSON file
|
39
42
|
# file in the root directory by default.
|
40
|
-
|
43
|
+
# @return [String] A string indicating successful configuration
|
44
|
+
def self.configure_from_json(file_path = 'cdp_api_key.json')
|
41
45
|
configuration.from_json(file_path)
|
42
46
|
|
43
47
|
raise InvalidConfiguration, 'API key private key is not set' unless configuration.api_key_private_key
|
44
48
|
raise InvalidConfiguration, 'API key name is not set' unless configuration.api_key_name
|
49
|
+
|
50
|
+
'Successfully configured Coinbase SDK'
|
45
51
|
end
|
46
52
|
|
47
53
|
# Configuration object for the Coinbase SDK.
|
48
54
|
class Configuration
|
49
55
|
attr_reader :base_sepolia_rpc_url, :base_sepolia_client
|
50
|
-
attr_accessor :api_url, :api_key_name, :api_key_private_key, :debug_api, :
|
56
|
+
attr_accessor :api_url, :api_key_name, :api_key_private_key, :debug_api, :use_server_signer
|
51
57
|
|
52
58
|
# Initializes the configuration object.
|
53
59
|
def initialize
|
@@ -55,13 +61,13 @@ module Coinbase
|
|
55
61
|
@base_sepolia_client = Jimson::Client.new(@base_sepolia_rpc_url)
|
56
62
|
@api_url = 'https://api.cdp.coinbase.com'
|
57
63
|
@debug_api = false
|
58
|
-
@
|
64
|
+
@use_server_signer = false
|
59
65
|
end
|
60
66
|
|
61
67
|
# Sets configuration values based on the provided CDP API Key JSON file.
|
62
68
|
# @param file_path [String] (Optional) the path to the CDP API Key JSON file
|
63
69
|
# file in the root directory by default.
|
64
|
-
def from_json(file_path = '
|
70
|
+
def from_json(file_path = 'cdp_api_key.json')
|
65
71
|
# Expand paths to respect shortcuts like ~.
|
66
72
|
file_path = File.expand_path(file_path)
|
67
73
|
|
@@ -117,4 +123,10 @@ module Coinbase
|
|
117
123
|
rescue StandardError => e
|
118
124
|
raise e
|
119
125
|
end
|
126
|
+
|
127
|
+
# Returns whether to use a server signer to manage private keys.
|
128
|
+
# @return [bool] whether to use a server signer to manage private keys.
|
129
|
+
def self.use_server_signer?
|
130
|
+
Coinbase.configuration.use_server_signer
|
131
|
+
end
|
120
132
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coinbase-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuga Cohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bigdecimal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: eth
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +192,20 @@ dependencies:
|
|
178
192
|
- - '='
|
179
193
|
- !ruby/object:Gem::Version
|
180
194
|
version: 1.63.1
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: simplecov
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
181
209
|
- !ruby/object:Gem::Dependency
|
182
210
|
name: yard
|
183
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,6 +248,8 @@ files:
|
|
220
248
|
- lib/coinbase/balance_map.rb
|
221
249
|
- lib/coinbase/client.rb
|
222
250
|
- lib/coinbase/client/api/addresses_api.rb
|
251
|
+
- lib/coinbase/client/api/server_signers_api.rb
|
252
|
+
- lib/coinbase/client/api/trades_api.rb
|
223
253
|
- lib/coinbase/client/api/transfers_api.rb
|
224
254
|
- lib/coinbase/client/api/users_api.rb
|
225
255
|
- lib/coinbase/client/api/wallets_api.rb
|
@@ -231,12 +261,28 @@ files:
|
|
231
261
|
- lib/coinbase/client/models/address_list.rb
|
232
262
|
- lib/coinbase/client/models/asset.rb
|
233
263
|
- lib/coinbase/client/models/balance.rb
|
264
|
+
- lib/coinbase/client/models/broadcast_trade_request.rb
|
234
265
|
- lib/coinbase/client/models/broadcast_transfer_request.rb
|
235
266
|
- lib/coinbase/client/models/create_address_request.rb
|
267
|
+
- lib/coinbase/client/models/create_server_signer_request.rb
|
268
|
+
- lib/coinbase/client/models/create_trade_request.rb
|
236
269
|
- lib/coinbase/client/models/create_transfer_request.rb
|
237
270
|
- lib/coinbase/client/models/create_wallet_request.rb
|
271
|
+
- lib/coinbase/client/models/create_wallet_request_wallet.rb
|
238
272
|
- lib/coinbase/client/models/error.rb
|
239
273
|
- lib/coinbase/client/models/faucet_transaction.rb
|
274
|
+
- lib/coinbase/client/models/seed_creation_event.rb
|
275
|
+
- lib/coinbase/client/models/seed_creation_event_result.rb
|
276
|
+
- lib/coinbase/client/models/server_signer.rb
|
277
|
+
- lib/coinbase/client/models/server_signer_event.rb
|
278
|
+
- lib/coinbase/client/models/server_signer_event_event.rb
|
279
|
+
- lib/coinbase/client/models/server_signer_event_list.rb
|
280
|
+
- lib/coinbase/client/models/signature_creation_event.rb
|
281
|
+
- lib/coinbase/client/models/signature_creation_event_result.rb
|
282
|
+
- lib/coinbase/client/models/trade.rb
|
283
|
+
- lib/coinbase/client/models/trade_list.rb
|
284
|
+
- lib/coinbase/client/models/transaction.rb
|
285
|
+
- lib/coinbase/client/models/transaction_type.rb
|
240
286
|
- lib/coinbase/client/models/transfer.rb
|
241
287
|
- lib/coinbase/client/models/transfer_list.rb
|
242
288
|
- lib/coinbase/client/models/user.rb
|