coinbase-sdk 0.0.16 → 0.1.1
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/wallet_address.rb +24 -17
- data/lib/coinbase/address.rb +17 -19
- data/lib/coinbase/asset.rb +11 -8
- data/lib/coinbase/client/api/addresses_api.rb +1 -1
- data/lib/coinbase/client/api/assets_api.rb +1 -1
- data/lib/coinbase/client/api/contract_events_api.rb +18 -10
- data/lib/coinbase/client/api/external_addresses_api.rb +1 -1
- data/lib/coinbase/client/api/networks_api.rb +1 -1
- data/lib/coinbase/client/api/server_signers_api.rb +1 -1
- data/lib/coinbase/client/api/stake_api.rb +1 -242
- data/lib/coinbase/client/api/trades_api.rb +1 -1
- data/lib/coinbase/client/api/transfers_api.rb +1 -1
- data/lib/coinbase/client/api/users_api.rb +1 -1
- data/lib/coinbase/client/api/validators_api.rb +3 -3
- data/lib/coinbase/client/api/wallet_stake_api.rb +263 -0
- data/lib/coinbase/client/api/wallets_api.rb +1 -1
- data/lib/coinbase/client/api/webhooks_api.rb +1 -1
- data/lib/coinbase/client/api_client.rb +1 -1
- data/lib/coinbase/client/api_error.rb +1 -1
- data/lib/coinbase/client/configuration.rb +11 -1
- data/lib/coinbase/client/models/address.rb +22 -5
- 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/asset.rb +1 -1
- data/lib/coinbase/client/models/balance.rb +1 -1
- 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/broadcast_transfer_request.rb +1 -1
- data/lib/coinbase/client/models/build_staking_operation_request.rb +1 -1
- data/lib/coinbase/client/models/contract_event.rb +100 -9
- data/lib/coinbase/client/models/contract_event_list.rb +1 -1
- data/lib/coinbase/client/models/create_address_request.rb +15 -5
- data/lib/coinbase/client/models/create_server_signer_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 +1 -1
- 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_webhook_request.rb +1 -1
- data/lib/coinbase/client/models/error.rb +1 -1
- data/lib/coinbase/client/models/ethereum_validator_metadata.rb +12 -12
- data/lib/coinbase/client/models/faucet_transaction.rb +1 -1
- data/lib/coinbase/client/models/feature.rb +3 -2
- 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/get_staking_context_request.rb +1 -1
- data/lib/coinbase/client/models/historical_balance.rb +1 -1
- data/lib/coinbase/client/models/network.rb +15 -5
- data/lib/coinbase/client/models/network_identifier.rb +1 -1
- 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/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 +3 -3
- 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/trade.rb +1 -1
- data/lib/coinbase/client/models/trade_list.rb +1 -1
- data/lib/coinbase/client/models/transaction.rb +16 -6
- data/lib/coinbase/client/models/transaction_type.rb +1 -1
- data/lib/coinbase/client/models/transfer.rb +1 -1
- data/lib/coinbase/client/models/transfer_list.rb +1 -1
- 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 +24 -3
- 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 +52 -0
- 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 +1 -1
- data/lib/coinbase/client/models/webhook_list.rb +1 -1
- data/lib/coinbase/client/version.rb +1 -1
- data/lib/coinbase/client.rb +3 -1
- data/lib/coinbase/constants.rb +0 -10
- data/lib/coinbase/contract_event.rb +104 -0
- data/lib/coinbase/correlation.rb +30 -0
- data/lib/coinbase/destination.rb +11 -9
- data/lib/coinbase/errors.rb +7 -0
- data/lib/coinbase/middleware.rb +2 -0
- data/lib/coinbase/network.rb +103 -20
- data/lib/coinbase/smart_contract.rb +106 -0
- data/lib/coinbase/staking_balance.rb +11 -5
- data/lib/coinbase/staking_operation.rb +132 -36
- data/lib/coinbase/staking_reward.rb +1 -1
- data/lib/coinbase/trade.rb +10 -9
- data/lib/coinbase/transaction.rb +6 -0
- data/lib/coinbase/transfer.rb +11 -10
- data/lib/coinbase/validator.rb +18 -10
- data/lib/coinbase/version.rb +5 -0
- data/lib/coinbase/wallet.rb +137 -145
- data/lib/coinbase/webhook.rb +181 -0
- data/lib/coinbase.rb +50 -19
- metadata +9 -9
- data/lib/coinbase/client/models/ethereum_validator.rb +0 -374
- data/lib/coinbase/client/models/get_validator200_response.rb +0 -221
- data/lib/coinbase/client/models/get_validator200_response_validator.rb +0 -214
- data/lib/coinbase/client/models/native_eth_staking_context.rb +0 -254
- data/lib/coinbase/client/models/partial_eth_staking_context.rb +0 -254
- data/lib/coinbase/client/models/validator_list_data.rb +0 -216
- data/lib/coinbase/user.rb +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7282200e25117b148ba99b4fa055c604edfdfa41b66e2632ba7107b2ae21fc7f
|
4
|
+
data.tar.gz: a8ea9dc85e68fc0f40397e8f00f0007a5dc6d8952b1d59e2b674b86921ae5da2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2f7da4368fd8c033b0566e1bf0851b7c5d9fdde368995d53923cd1535113b7ae9dba55aafaf4e6ec22f4525e7ad80399fa470b77d0dd1326ca6cf71fe1d3bcf
|
7
|
+
data.tar.gz: 1bcfa5eb7782d6946f11c4ca60a65a05c92805ac737529b9ad4ca4136b1e0a5b1f9bceb9a4a042367fc846307510badb96f74ffe3433c210285ee93b4fdf34ff
|
@@ -52,7 +52,7 @@ module Coinbase
|
|
52
52
|
amount: amount,
|
53
53
|
asset_id: asset_id,
|
54
54
|
destination: destination,
|
55
|
-
|
55
|
+
network: network,
|
56
56
|
wallet_id: wallet_id,
|
57
57
|
gasless: gasless
|
58
58
|
)
|
@@ -80,7 +80,7 @@ module Coinbase
|
|
80
80
|
amount: amount,
|
81
81
|
from_asset_id: from_asset_id,
|
82
82
|
to_asset_id: to_asset_id,
|
83
|
-
|
83
|
+
network: network,
|
84
84
|
wallet_id: wallet_id
|
85
85
|
)
|
86
86
|
|
@@ -100,11 +100,16 @@ module Coinbase
|
|
100
100
|
# @param asset_id [Symbol] The ID of the Asset to stake. For Ether, :eth, :gwei, and :wei are supported.
|
101
101
|
# @param mode [Symbol] The staking mode. Defaults to :default.
|
102
102
|
# @param options [Hash] Additional options for the stake operation
|
103
|
+
# @param interval_seconds [Integer] The number of seconds to wait between polling for updates. Defaults to 5.
|
104
|
+
# @param timeout_seconds [Integer] The number of seconds to wait before timing out. Defaults to 600.
|
103
105
|
# @return [Coinbase::StakingOperation] The staking operation
|
104
|
-
|
106
|
+
# @raise [Timeout::Error] if the Staking Operation takes longer than the given timeout.
|
107
|
+
def stake(amount, asset_id, mode: :default, options: {}, interval_seconds: 5, timeout_seconds: 600)
|
105
108
|
validate_can_perform_staking_action!(amount, asset_id, 'stakeable_balance', mode, options)
|
106
109
|
|
107
|
-
|
110
|
+
op = StakingOperation.create(amount, network, asset_id, id, wallet_id, 'stake', mode, options)
|
111
|
+
|
112
|
+
op.complete(@key, interval_seconds: interval_seconds, timeout_seconds: timeout_seconds)
|
108
113
|
end
|
109
114
|
|
110
115
|
# Unstakes the given amount of the given Asset
|
@@ -112,11 +117,16 @@ module Coinbase
|
|
112
117
|
# @param asset_id [Symbol] The ID of the Asset to stake. For Ether, :eth, :gwei, and :wei are supported.
|
113
118
|
# @param mode [Symbol] The staking mode. Defaults to :default.
|
114
119
|
# @param options [Hash] Additional options for the stake operation
|
120
|
+
# @param interval_seconds [Integer] The number of seconds to wait between polling for updates. Defaults to 5.
|
121
|
+
# @param timeout_seconds [Integer] The number of seconds to wait before timing out. Defaults to 600.
|
115
122
|
# @return [Coinbase::StakingOperation] The staking operation
|
116
|
-
|
123
|
+
# @raise [Timeout::Error] if the Staking Operation takes longer than the given timeout.
|
124
|
+
def unstake(amount, asset_id, mode: :default, options: {}, interval_seconds: 5, timeout_seconds: 600)
|
117
125
|
validate_can_perform_staking_action!(amount, asset_id, 'unstakeable_balance', mode, options)
|
118
126
|
|
119
|
-
|
127
|
+
op = StakingOperation.create(amount, network, asset_id, id, wallet_id, 'unstake', mode, options)
|
128
|
+
|
129
|
+
op.complete(@key, interval_seconds: interval_seconds, timeout_seconds: timeout_seconds)
|
120
130
|
end
|
121
131
|
|
122
132
|
# Claims the given amount of the given Asset
|
@@ -124,11 +134,16 @@ module Coinbase
|
|
124
134
|
# @param asset_id [Symbol] The ID of the Asset to stake. For Ether, :eth, :gwei, and :wei are supported.
|
125
135
|
# @param mode [Symbol] The staking mode. Defaults to :default.
|
126
136
|
# @param options [Hash] Additional options for the stake operation
|
137
|
+
# @param interval_seconds [Integer] The number of seconds to wait between polling for updates. Defaults to 5.
|
138
|
+
# @param timeout_seconds [Integer] The number of seconds to wait before timing out. Defaults to 600.
|
127
139
|
# @return [Coinbase::StakingOperation] The staking operation
|
128
|
-
|
140
|
+
# @raise [Timeout::Error] if the Staking Operation takes longer than the given timeout.
|
141
|
+
def claim_stake(amount, asset_id, mode: :default, options: {}, interval_seconds: 5, timeout_seconds: 600)
|
129
142
|
validate_can_perform_staking_action!(amount, asset_id, 'claimable_balance', mode, options)
|
130
143
|
|
131
|
-
|
144
|
+
op = StakingOperation.create(amount, network, asset_id, id, wallet_id, 'claim_stake', mode, options)
|
145
|
+
|
146
|
+
op.complete(@key, interval_seconds: interval_seconds, timeout_seconds: timeout_seconds)
|
132
147
|
end
|
133
148
|
|
134
149
|
# Returns whether the Address has a private key backing it to sign transactions.
|
@@ -164,7 +179,7 @@ module Coinbase
|
|
164
179
|
# Returns a String representation of the WalletAddress.
|
165
180
|
# @return [String] a String representation of the WalletAddress
|
166
181
|
def to_s
|
167
|
-
"Coinbase::Address{id: '#{id}', network_id: '#{
|
182
|
+
"Coinbase::Address{id: '#{id}', network_id: '#{network.id}', wallet_id: '#{wallet_id}'}"
|
168
183
|
end
|
169
184
|
|
170
185
|
private
|
@@ -183,13 +198,5 @@ module Coinbase
|
|
183
198
|
|
184
199
|
raise InsufficientFundsError.new(amount, current_balance)
|
185
200
|
end
|
186
|
-
|
187
|
-
def complete_staking_operation(amount, asset_id, action, mode: :default, options: {})
|
188
|
-
op = StakingOperation.create(amount, network_id, asset_id, id, wallet_id, action, mode, options)
|
189
|
-
op.transactions.each do |transaction|
|
190
|
-
transaction.sign(@key)
|
191
|
-
end
|
192
|
-
op.broadcast!
|
193
|
-
end
|
194
201
|
end
|
195
202
|
end
|
data/lib/coinbase/address.rb
CHANGED
@@ -1,25 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Coinbase
|
4
|
-
# A representation of a blockchain Address, which is a user-controlled account on a Network.
|
5
|
-
# send and receive Assets.
|
6
|
-
# @attr_reader [Symbol] network_id The Network ID
|
7
|
-
# @attr_reader [String] id The onchain Address ID
|
4
|
+
# A representation of a blockchain Address, which is a user-controlled account on a Network.
|
5
|
+
# Addresses are used to send and receive Assets.
|
8
6
|
class Address
|
9
|
-
attr_reader :
|
7
|
+
attr_reader :network, :id
|
10
8
|
|
11
9
|
# Returns a new Address object.
|
12
|
-
# @param
|
10
|
+
# @param network [Coinbase::Network, Symbol] The Network or Network ID
|
13
11
|
# @param id [String] The onchain Address ID
|
14
|
-
def initialize(
|
15
|
-
@
|
12
|
+
def initialize(network, id)
|
13
|
+
@network = Coinbase::Network.from_id(network)
|
16
14
|
@id = id
|
17
15
|
end
|
18
16
|
|
19
17
|
# Returns a String representation of the Address.
|
20
18
|
# @return [String] a String representation of the Address
|
21
19
|
def to_s
|
22
|
-
|
20
|
+
Coinbase.pretty_print_object(self.class, id: id, network_id: network.id)
|
23
21
|
end
|
24
22
|
|
25
23
|
# Same as to_s.
|
@@ -39,7 +37,7 @@ module Coinbase
|
|
39
37
|
# in ETH.
|
40
38
|
def balances
|
41
39
|
response = Coinbase.call_api do
|
42
|
-
addresses_api.list_external_address_balances(
|
40
|
+
addresses_api.list_external_address_balances(network.normalized_id, id)
|
43
41
|
end
|
44
42
|
|
45
43
|
Coinbase::BalanceMap.from_balances(response.data)
|
@@ -51,7 +49,7 @@ module Coinbase
|
|
51
49
|
def balance(asset_id)
|
52
50
|
response = Coinbase.call_api do
|
53
51
|
addresses_api.get_external_address_balance(
|
54
|
-
|
52
|
+
network.normalized_id,
|
55
53
|
id,
|
56
54
|
Coinbase::Asset.primary_denomination(asset_id).to_s
|
57
55
|
)
|
@@ -82,7 +80,7 @@ module Coinbase
|
|
82
80
|
def faucet
|
83
81
|
Coinbase.call_api do
|
84
82
|
Coinbase::FaucetTransaction.new(
|
85
|
-
addresses_api.request_external_faucet_funds(
|
83
|
+
addresses_api.request_external_faucet_funds(network.normalized_id, id)
|
86
84
|
)
|
87
85
|
end
|
88
86
|
end
|
@@ -97,7 +95,7 @@ module Coinbase
|
|
97
95
|
def build_stake_operation(amount, asset_id, mode: :default, options: {})
|
98
96
|
validate_can_perform_staking_action!(amount, asset_id, 'stakeable_balance', mode, options)
|
99
97
|
|
100
|
-
StakingOperation.build(amount,
|
98
|
+
StakingOperation.build(amount, network, asset_id, id, 'stake', mode, options)
|
101
99
|
end
|
102
100
|
|
103
101
|
# Builds an unstake operation for the supplied asset.
|
@@ -109,7 +107,7 @@ module Coinbase
|
|
109
107
|
def build_unstake_operation(amount, asset_id, mode: :default, options: {})
|
110
108
|
validate_can_perform_staking_action!(amount, asset_id, 'unstakeable_balance', mode, options)
|
111
109
|
|
112
|
-
StakingOperation.build(amount,
|
110
|
+
StakingOperation.build(amount, network, asset_id, id, 'unstake', mode, options)
|
113
111
|
end
|
114
112
|
|
115
113
|
# Builds a claim_stake operation for the supplied asset.
|
@@ -121,7 +119,7 @@ module Coinbase
|
|
121
119
|
def build_claim_stake_operation(amount, asset_id, mode: :default, options: {})
|
122
120
|
validate_can_perform_staking_action!(amount, asset_id, 'claimable_balance', mode, options)
|
123
121
|
|
124
|
-
StakingOperation.build(amount,
|
122
|
+
StakingOperation.build(amount, network, asset_id, id, 'claim_stake', mode, options)
|
125
123
|
end
|
126
124
|
|
127
125
|
# Retrieves the balances used for staking for the supplied asset.
|
@@ -137,7 +135,7 @@ module Coinbase
|
|
137
135
|
stake_api.get_staking_context(
|
138
136
|
{
|
139
137
|
asset_id: asset_id,
|
140
|
-
network_id:
|
138
|
+
network_id: network.normalized_id,
|
141
139
|
address_id: id,
|
142
140
|
options: {
|
143
141
|
mode: mode
|
@@ -197,7 +195,7 @@ module Coinbase
|
|
197
195
|
# @return [Enumerable<Coinbase::StakingReward>] The staking rewards
|
198
196
|
def staking_rewards(asset_id, start_time: DateTime.now.prev_week(1), end_time: DateTime.now, format: :usd)
|
199
197
|
StakingReward.list(
|
200
|
-
|
198
|
+
network,
|
201
199
|
asset_id,
|
202
200
|
[id],
|
203
201
|
start_time: start_time,
|
@@ -213,7 +211,7 @@ module Coinbase
|
|
213
211
|
# @return [Enumerable<Coinbase::StakingBalance>] The staking rewards
|
214
212
|
def historical_staking_balances(asset_id, start_time: DateTime.now.prev_week(1), end_time: DateTime.now)
|
215
213
|
StakingBalance.list(
|
216
|
-
|
214
|
+
network,
|
217
215
|
asset_id,
|
218
216
|
id,
|
219
217
|
start_time: start_time,
|
@@ -238,7 +236,7 @@ module Coinbase
|
|
238
236
|
|
239
237
|
def list_page(asset_id, page)
|
240
238
|
addresses_api.list_address_historical_balance(
|
241
|
-
|
239
|
+
network.normalized_id,
|
242
240
|
id,
|
243
241
|
Coinbase::Asset.primary_denomination(asset_id).to_s,
|
244
242
|
{ limit: DEFAULT_PAGE_LIMIT, page: page }
|
data/lib/coinbase/asset.rb
CHANGED
@@ -35,7 +35,7 @@ module Coinbase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
new(
|
38
|
-
|
38
|
+
network: Coinbase.to_sym(asset_model.network_id),
|
39
39
|
asset_id: asset_id || Coinbase.to_sym(asset_model.asset_id),
|
40
40
|
address_id: asset_model.contract_address,
|
41
41
|
decimals: decimals
|
@@ -43,12 +43,15 @@ module Coinbase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
# Fetches the Asset with the provided Asset ID.
|
46
|
+
# @param network [Coinbase::Network, Symbol] The Network or Network ID
|
46
47
|
# @param asset_id [Symbol] The Asset ID
|
47
48
|
# @return [Coinbase::Asset] The Asset
|
48
|
-
def fetch(
|
49
|
+
def fetch(network, asset_id)
|
50
|
+
network = Coinbase::Network.from_id(network)
|
51
|
+
|
49
52
|
asset_model = Coinbase.call_api do
|
50
53
|
assets_api.get_asset(
|
51
|
-
|
54
|
+
network.normalized_id,
|
52
55
|
primary_denomination(asset_id).to_s
|
53
56
|
)
|
54
57
|
end
|
@@ -65,18 +68,18 @@ module Coinbase
|
|
65
68
|
|
66
69
|
# Returns a new Asset object. Do not use this method. Instead, use the Asset constants defined in
|
67
70
|
# the Coinbase module.
|
68
|
-
# @param
|
71
|
+
# @param network [Symbol] The Network or Network ID to which the Asset belongs
|
69
72
|
# @param asset_id [Symbol] The Asset ID
|
70
73
|
# @param address_id [String] (Optional) The Asset's address ID, if one exists
|
71
74
|
# @param decimals [Integer] (Optional) The number of decimal places the Asset uses
|
72
|
-
def initialize(
|
73
|
-
@
|
75
|
+
def initialize(network:, asset_id:, decimals:, address_id: nil)
|
76
|
+
@network = Coinbase::Network.from_id(network)
|
74
77
|
@asset_id = asset_id
|
75
78
|
@address_id = address_id
|
76
79
|
@decimals = decimals
|
77
80
|
end
|
78
81
|
|
79
|
-
attr_reader :
|
82
|
+
attr_reader :network, :asset_id, :address_id, :decimals
|
80
83
|
|
81
84
|
# Converts the amount of the Asset from atomic to whole units.
|
82
85
|
# @param atomic_amount [Integer, Float, BigDecimal] The atomic amount to convert to whole units.
|
@@ -103,7 +106,7 @@ module Coinbase
|
|
103
106
|
# Returns a string representation of the Asset.
|
104
107
|
# @return [String] a string representation of the Asset
|
105
108
|
def to_s
|
106
|
-
"Coinbase::Asset{network_id: '#{
|
109
|
+
"Coinbase::Asset{network_id: '#{network.id}', asset_id: '#{asset_id}', decimals: '#{decimals}'" \
|
107
110
|
"#{address_id.nil? ? '' : ", address_id: '#{address_id}'"}}"
|
108
111
|
end
|
109
112
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
7
7
|
Contact: yuga.cohler@coinbase.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.
|
9
|
+
Generator version: 7.7.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -24,15 +24,15 @@ module Coinbase::Client
|
|
24
24
|
# @param network_id [String] Unique identifier for the blockchain network
|
25
25
|
# @param protocol_name [String] Case-sensitive name of the blockchain protocol
|
26
26
|
# @param contract_address [String] EVM address of the smart contract (42 characters, including '0x', in lowercase)
|
27
|
+
# @param contract_name [String] Case-sensitive name of the specific contract within the project
|
28
|
+
# @param event_name [String] Case-sensitive name of the event to filter for in the contract's logs
|
27
29
|
# @param from_block_height [Integer] Lower bound of the block range to query (inclusive)
|
28
30
|
# @param to_block_height [Integer] Upper bound of the block range to query (inclusive)
|
29
31
|
# @param [Hash] opts the optional parameters
|
30
|
-
# @option opts [String] :contract_name Case-sensitive name of the specific contract within the project
|
31
|
-
# @option opts [String] :event_name Case-sensitive name of the event to filter for in the contract's logs
|
32
32
|
# @option opts [String] :next_page Pagination token for retrieving the next set of results
|
33
33
|
# @return [ContractEventList]
|
34
|
-
def list_contract_events(network_id, protocol_name, contract_address, from_block_height, to_block_height, opts = {})
|
35
|
-
data, _status_code, _headers = list_contract_events_with_http_info(network_id, protocol_name, contract_address, from_block_height, to_block_height, opts)
|
34
|
+
def list_contract_events(network_id, protocol_name, contract_address, contract_name, event_name, from_block_height, to_block_height, opts = {})
|
35
|
+
data, _status_code, _headers = list_contract_events_with_http_info(network_id, protocol_name, contract_address, contract_name, event_name, from_block_height, to_block_height, opts)
|
36
36
|
data
|
37
37
|
end
|
38
38
|
|
@@ -41,14 +41,14 @@ module Coinbase::Client
|
|
41
41
|
# @param network_id [String] Unique identifier for the blockchain network
|
42
42
|
# @param protocol_name [String] Case-sensitive name of the blockchain protocol
|
43
43
|
# @param contract_address [String] EVM address of the smart contract (42 characters, including '0x', in lowercase)
|
44
|
+
# @param contract_name [String] Case-sensitive name of the specific contract within the project
|
45
|
+
# @param event_name [String] Case-sensitive name of the event to filter for in the contract's logs
|
44
46
|
# @param from_block_height [Integer] Lower bound of the block range to query (inclusive)
|
45
47
|
# @param to_block_height [Integer] Upper bound of the block range to query (inclusive)
|
46
48
|
# @param [Hash] opts the optional parameters
|
47
|
-
# @option opts [String] :contract_name Case-sensitive name of the specific contract within the project
|
48
|
-
# @option opts [String] :event_name Case-sensitive name of the event to filter for in the contract's logs
|
49
49
|
# @option opts [String] :next_page Pagination token for retrieving the next set of results
|
50
50
|
# @return [Array<(ContractEventList, Integer, Hash)>] ContractEventList data, response status code and response headers
|
51
|
-
def list_contract_events_with_http_info(network_id, protocol_name, contract_address, from_block_height, to_block_height, opts = {})
|
51
|
+
def list_contract_events_with_http_info(network_id, protocol_name, contract_address, contract_name, event_name, from_block_height, to_block_height, opts = {})
|
52
52
|
if @api_client.config.debugging
|
53
53
|
@api_client.config.logger.debug 'Calling API: ContractEventsApi.list_contract_events ...'
|
54
54
|
end
|
@@ -64,6 +64,14 @@ module Coinbase::Client
|
|
64
64
|
if @api_client.config.client_side_validation && contract_address.nil?
|
65
65
|
fail ArgumentError, "Missing the required parameter 'contract_address' when calling ContractEventsApi.list_contract_events"
|
66
66
|
end
|
67
|
+
# verify the required parameter 'contract_name' is set
|
68
|
+
if @api_client.config.client_side_validation && contract_name.nil?
|
69
|
+
fail ArgumentError, "Missing the required parameter 'contract_name' when calling ContractEventsApi.list_contract_events"
|
70
|
+
end
|
71
|
+
# verify the required parameter 'event_name' is set
|
72
|
+
if @api_client.config.client_side_validation && event_name.nil?
|
73
|
+
fail ArgumentError, "Missing the required parameter 'event_name' when calling ContractEventsApi.list_contract_events"
|
74
|
+
end
|
67
75
|
# verify the required parameter 'from_block_height' is set
|
68
76
|
if @api_client.config.client_side_validation && from_block_height.nil?
|
69
77
|
fail ArgumentError, "Missing the required parameter 'from_block_height' when calling ContractEventsApi.list_contract_events"
|
@@ -78,10 +86,10 @@ module Coinbase::Client
|
|
78
86
|
# query parameters
|
79
87
|
query_params = opts[:query_params] || {}
|
80
88
|
query_params[:'protocol_name'] = protocol_name
|
89
|
+
query_params[:'contract_name'] = contract_name
|
90
|
+
query_params[:'event_name'] = event_name
|
81
91
|
query_params[:'from_block_height'] = from_block_height
|
82
92
|
query_params[:'to_block_height'] = to_block_height
|
83
|
-
query_params[:'contract_name'] = opts[:'contract_name'] if !opts[:'contract_name'].nil?
|
84
|
-
query_params[:'event_name'] = opts[:'event_name'] if !opts[:'event_name'].nil?
|
85
93
|
query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil?
|
86
94
|
|
87
95
|
# header parameters
|