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
data/lib/coinbase/transfer.rb
CHANGED
@@ -22,9 +22,24 @@ module Coinbase
|
|
22
22
|
# If the destination is a String, it uses it as the Address ID.
|
23
23
|
# @param network [Coinbase::Network, Symbol] The Network or Network ID of the Asset
|
24
24
|
# @param wallet_id [String] The Wallet ID of the sending Wallet
|
25
|
+
# @param gasless [Boolean] Whether the transfer should be gasless. Defaults to false.
|
26
|
+
# @param skip_batching [Boolean] When true, the Transfer will be submitted immediately.
|
27
|
+
# Otherwise, the Transfer will be batched. Defaults to false.
|
28
|
+
# Note: requires gasless option to be set to true.
|
25
29
|
# @return [Transfer] The new pending Transfer object
|
26
30
|
# @raise [Coinbase::ApiError] If the Transfer fails
|
27
|
-
def create(
|
31
|
+
def create(
|
32
|
+
address_id:,
|
33
|
+
amount:,
|
34
|
+
asset_id:,
|
35
|
+
destination:,
|
36
|
+
network:,
|
37
|
+
wallet_id:,
|
38
|
+
gasless: false,
|
39
|
+
skip_batching: false
|
40
|
+
)
|
41
|
+
ensure_can_skip_batching!(gasless, skip_batching)
|
42
|
+
|
28
43
|
network = Coinbase::Network.from_id(network)
|
29
44
|
asset = network.get_asset(asset_id)
|
30
45
|
|
@@ -37,7 +52,8 @@ module Coinbase
|
|
37
52
|
asset_id: asset.primary_denomination.to_s,
|
38
53
|
destination: Coinbase::Destination.new(destination, network: network).address_id,
|
39
54
|
network_id: network.normalized_id,
|
40
|
-
gasless: gasless
|
55
|
+
gasless: gasless,
|
56
|
+
skip_batching: skip_batching
|
41
57
|
}
|
42
58
|
)
|
43
59
|
end
|
@@ -66,6 +82,12 @@ module Coinbase
|
|
66
82
|
def fetch_page(wallet_id, address_id, page)
|
67
83
|
transfers_api.list_transfers(wallet_id, address_id, { limit: DEFAULT_PAGE_LIMIT, page: page })
|
68
84
|
end
|
85
|
+
|
86
|
+
def ensure_can_skip_batching!(gasless, skip_batching)
|
87
|
+
return unless skip_batching && !gasless
|
88
|
+
|
89
|
+
raise ArgumentError, 'Cannot skip batching without gasless option set to true'
|
90
|
+
end
|
69
91
|
end
|
70
92
|
|
71
93
|
# Returns a new Transfer object. Do not use this method directly. Instead, use Wallet#transfer or
|
data/lib/coinbase/version.rb
CHANGED
data/lib/coinbase/wallet/data.rb
CHANGED
@@ -4,27 +4,29 @@ module Coinbase
|
|
4
4
|
class Wallet
|
5
5
|
# The data required to recreate a Wallet.
|
6
6
|
class Data
|
7
|
-
attr_reader :wallet_id, :seed
|
7
|
+
attr_reader :wallet_id, :seed, :network_id
|
8
8
|
|
9
9
|
# Returns a new Data object.
|
10
10
|
# @param wallet_id [String] The ID of the Wallet
|
11
11
|
# @param seed [String] The seed of the Wallet
|
12
|
-
|
12
|
+
# @param network_id [String, nil] The network ID of the Wallet (optional)
|
13
|
+
def initialize(wallet_id:, seed:, network_id: nil)
|
13
14
|
@wallet_id = wallet_id
|
14
15
|
@seed = seed
|
16
|
+
@network_id = network_id
|
15
17
|
end
|
16
18
|
|
17
19
|
# Converts the Data object to a Hash.
|
18
20
|
# @return [Hash] The Hash representation of the Data object
|
19
21
|
def to_hash
|
20
|
-
{ wallet_id: wallet_id, seed: seed }
|
22
|
+
{ wallet_id: wallet_id, seed: seed, network_id: network_id }
|
21
23
|
end
|
22
24
|
|
23
25
|
# Creates a Data object from the given Hash.
|
24
26
|
# @param data [Hash] The Hash to create the Data object from
|
25
27
|
# @return [Data] The new Data object
|
26
28
|
def self.from_hash(data)
|
27
|
-
Data.new(wallet_id: data['wallet_id'], seed: data['seed'])
|
29
|
+
Data.new(wallet_id: data['wallet_id'], seed: data['seed'], network_id: data['network_id'])
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
data/lib/coinbase/wallet.rb
CHANGED
@@ -406,7 +406,7 @@ module Coinbase
|
|
406
406
|
|
407
407
|
raise 'Cannot export Wallet without loaded seed' if @master.nil?
|
408
408
|
|
409
|
-
Data.new(wallet_id: id, seed: @master.seed_hex)
|
409
|
+
Data.new(wallet_id: id, seed: @master.seed_hex, network_id: network.id)
|
410
410
|
end
|
411
411
|
|
412
412
|
# Returns whether the Wallet has a seed with which to derive keys and sign transactions.
|
@@ -447,7 +447,8 @@ module Coinbase
|
|
447
447
|
seed: seed_to_store,
|
448
448
|
encrypted: encrypt,
|
449
449
|
auth_tag: auth_tag,
|
450
|
-
iv: iv
|
450
|
+
iv: iv,
|
451
|
+
network_id: network.id
|
451
452
|
}
|
452
453
|
|
453
454
|
File.write(file_path, JSON.pretty_generate(existing_seeds_in_store))
|
data/lib/coinbase.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'coinbase/client'
|
3
4
|
require_relative 'coinbase/address'
|
4
5
|
require_relative 'coinbase/address/wallet_address'
|
5
6
|
require_relative 'coinbase/address/external_address'
|
7
|
+
require_relative 'coinbase/address_reputation'
|
6
8
|
require_relative 'coinbase/asset'
|
7
9
|
require_relative 'coinbase/authenticator'
|
8
10
|
require_relative 'coinbase/correlation'
|
9
11
|
require_relative 'coinbase/balance'
|
10
12
|
require_relative 'coinbase/balance_map'
|
11
13
|
require_relative 'coinbase/historical_balance'
|
12
|
-
require_relative 'coinbase/client'
|
13
14
|
require_relative 'coinbase/constants'
|
14
15
|
require_relative 'coinbase/contract_event'
|
15
16
|
require_relative 'coinbase/contract_invocation'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coinbase-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuga Cohler
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|
@@ -272,6 +272,7 @@ files:
|
|
272
272
|
- lib/coinbase/address.rb
|
273
273
|
- lib/coinbase/address/external_address.rb
|
274
274
|
- lib/coinbase/address/wallet_address.rb
|
275
|
+
- lib/coinbase/address_reputation.rb
|
275
276
|
- lib/coinbase/asset.rb
|
276
277
|
- lib/coinbase/authenticator.rb
|
277
278
|
- lib/coinbase/balance.rb
|
@@ -306,11 +307,11 @@ files:
|
|
306
307
|
- lib/coinbase/client/models/address_list.rb
|
307
308
|
- lib/coinbase/client/models/address_reputation.rb
|
308
309
|
- lib/coinbase/client/models/address_reputation_metadata.rb
|
309
|
-
- lib/coinbase/client/models/address_risk.rb
|
310
310
|
- lib/coinbase/client/models/address_transaction_list.rb
|
311
311
|
- lib/coinbase/client/models/asset.rb
|
312
312
|
- lib/coinbase/client/models/balance.rb
|
313
313
|
- lib/coinbase/client/models/broadcast_contract_invocation_request.rb
|
314
|
+
- lib/coinbase/client/models/broadcast_external_transfer_request.rb
|
314
315
|
- lib/coinbase/client/models/broadcast_staking_operation_request.rb
|
315
316
|
- lib/coinbase/client/models/broadcast_trade_request.rb
|
316
317
|
- lib/coinbase/client/models/broadcast_transfer_request.rb
|
@@ -321,6 +322,7 @@ files:
|
|
321
322
|
- lib/coinbase/client/models/contract_invocation_list.rb
|
322
323
|
- lib/coinbase/client/models/create_address_request.rb
|
323
324
|
- lib/coinbase/client/models/create_contract_invocation_request.rb
|
325
|
+
- lib/coinbase/client/models/create_external_transfer_request.rb
|
324
326
|
- lib/coinbase/client/models/create_fund_operation_request.rb
|
325
327
|
- lib/coinbase/client/models/create_fund_quote_request.rb
|
326
328
|
- lib/coinbase/client/models/create_payload_signature_request.rb
|
@@ -365,6 +367,7 @@ files:
|
|
365
367
|
- lib/coinbase/client/models/payload_signature.rb
|
366
368
|
- lib/coinbase/client/models/payload_signature_list.rb
|
367
369
|
- lib/coinbase/client/models/read_contract_request.rb
|
370
|
+
- lib/coinbase/client/models/register_smart_contract_request.rb
|
368
371
|
- lib/coinbase/client/models/seed_creation_event.rb
|
369
372
|
- lib/coinbase/client/models/seed_creation_event_result.rb
|
370
373
|
- lib/coinbase/client/models/server_signer.rb
|
@@ -376,6 +379,7 @@ files:
|
|
376
379
|
- lib/coinbase/client/models/signature_creation_event_result.rb
|
377
380
|
- lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb
|
378
381
|
- lib/coinbase/client/models/smart_contract.rb
|
382
|
+
- lib/coinbase/client/models/smart_contract_activity_event.rb
|
379
383
|
- lib/coinbase/client/models/smart_contract_list.rb
|
380
384
|
- lib/coinbase/client/models/smart_contract_options.rb
|
381
385
|
- lib/coinbase/client/models/smart_contract_type.rb
|
@@ -398,6 +402,7 @@ files:
|
|
398
402
|
- lib/coinbase/client/models/transaction_type.rb
|
399
403
|
- lib/coinbase/client/models/transfer.rb
|
400
404
|
- lib/coinbase/client/models/transfer_list.rb
|
405
|
+
- lib/coinbase/client/models/update_smart_contract_request.rb
|
401
406
|
- lib/coinbase/client/models/update_webhook_request.rb
|
402
407
|
- lib/coinbase/client/models/user.rb
|
403
408
|
- lib/coinbase/client/models/validator.rb
|
@@ -411,6 +416,7 @@ files:
|
|
411
416
|
- lib/coinbase/client/models/webhook_event_type.rb
|
412
417
|
- lib/coinbase/client/models/webhook_event_type_filter.rb
|
413
418
|
- lib/coinbase/client/models/webhook_list.rb
|
419
|
+
- lib/coinbase/client/models/webhook_smart_contract_event_filter.rb
|
414
420
|
- lib/coinbase/client/models/webhook_wallet_activity_filter.rb
|
415
421
|
- lib/coinbase/client/version.rb
|
416
422
|
- lib/coinbase/constants.rb
|
@@ -448,7 +454,7 @@ licenses:
|
|
448
454
|
- Apache-2.0
|
449
455
|
metadata:
|
450
456
|
rubygems_mfa_required: 'true'
|
451
|
-
post_install_message:
|
457
|
+
post_install_message:
|
452
458
|
rdoc_options: []
|
453
459
|
require_paths:
|
454
460
|
- lib
|
@@ -456,7 +462,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
456
462
|
requirements:
|
457
463
|
- - ">="
|
458
464
|
- !ruby/object:Gem::Version
|
459
|
-
version:
|
465
|
+
version: 3.0.0
|
460
466
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
461
467
|
requirements:
|
462
468
|
- - ">="
|
@@ -464,7 +470,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
464
470
|
version: '0'
|
465
471
|
requirements: []
|
466
472
|
rubygems_version: 3.1.6
|
467
|
-
signing_key:
|
473
|
+
signing_key:
|
468
474
|
specification_version: 4
|
469
475
|
summary: Coinbase Ruby SDK
|
470
476
|
test_files: []
|