coinbase-sdk 0.6.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/wallet_address.rb +44 -0
- data/lib/coinbase/address.rb +13 -4
- data/lib/coinbase/client/api/external_addresses_api.rb +26 -27
- 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/transaction_history_api.rb +101 -0
- data/lib/coinbase/client/api/webhooks_api.rb +70 -0
- 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 +232 -0
- 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/multi_token_contract_options.rb +223 -0
- data/lib/coinbase/client/models/network_identifier.rb +2 -1
- data/lib/coinbase/client/models/nft_contract_options.rb +21 -4
- 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/smart_contract_options.rb +1 -0
- data/lib/coinbase/client/models/smart_contract_type.rb +2 -1
- data/lib/coinbase/client/models/solidity_value.rb +287 -0
- data/lib/coinbase/client/models/{feature.rb → token_transfer_type.rb} +10 -10
- data/lib/coinbase/client/models/update_webhook_request.rb +0 -7
- data/lib/coinbase/client.rb +19 -0
- data/lib/coinbase/faucet_transaction.rb +64 -4
- data/lib/coinbase/smart_contract.rb +149 -0
- data/lib/coinbase/transaction.rb +8 -2
- data/lib/coinbase/version.rb +1 -1
- data/lib/coinbase/wallet.rb +35 -1
- data/lib/coinbase/webhook.rb +3 -7
- metadata +21 -3
data/lib/coinbase/transaction.rb
CHANGED
@@ -41,6 +41,12 @@ module Coinbase
|
|
41
41
|
@model = model
|
42
42
|
end
|
43
43
|
|
44
|
+
# Returns the Network of the Transaction.
|
45
|
+
# @return [Coinbase::Network] The Network
|
46
|
+
def network
|
47
|
+
@network ||= Coinbase::Network.from_id(@model.network_id)
|
48
|
+
end
|
49
|
+
|
44
50
|
# Returns the Unsigned Payload of the Transaction.
|
45
51
|
# @return [String] The Unsigned Payload
|
46
52
|
def unsigned_payload
|
@@ -101,8 +107,8 @@ module Coinbase
|
|
101
107
|
@model.transaction_link
|
102
108
|
end
|
103
109
|
|
104
|
-
# Returns
|
105
|
-
# @return [
|
110
|
+
# Returns detailed content the Transaction.
|
111
|
+
# @return [EthereumTransaction] The transaction content
|
106
112
|
def content
|
107
113
|
@model.content
|
108
114
|
end
|
data/lib/coinbase/version.rb
CHANGED
data/lib/coinbase/wallet.rb
CHANGED
@@ -244,9 +244,23 @@ module Coinbase
|
|
244
244
|
# @return [Coinbase::SmartContract] The deployed token contract.
|
245
245
|
# @raise [AddressCannotSignError] if the Address does not have a private key backing it.
|
246
246
|
|
247
|
+
# @!method deploy_nft
|
248
|
+
# Deploys a new ERC721 NFT contract with the given name, symbol, and base URI.
|
249
|
+
# @param name [String] The name of the NFT contract.
|
250
|
+
# @param symbol [String] The symbol of the NFT contract.
|
251
|
+
# @param base_uri [String] The base URI for the NFT contract.
|
252
|
+
# @return [Coinbase::SmartContract] The deployed NFT contract.
|
253
|
+
# @raise [AddressCannotSignError] if the Address does not have a private key backing it.
|
254
|
+
|
255
|
+
# @!method deploy_multi_token
|
256
|
+
# Deploys a new ERC1155 multi-token contract with the given URI.
|
257
|
+
# @param uri [String] The URI for the token metadata, where {id} will be replaced with the token ID.
|
258
|
+
# @return [Coinbase::SmartContract] The deployed multi-token contract.
|
259
|
+
# @raise [AddressCannotSignError] if the Address does not have a private key backing it.
|
260
|
+
|
247
261
|
def_delegators :default_address, :transfer, :trade, :faucet, :stake, :unstake, :claim_stake, :staking_balances,
|
248
262
|
:stakeable_balance, :unstakeable_balance, :claimable_balance, :sign_payload, :invoke_contract,
|
249
|
-
:deploy_token
|
263
|
+
:deploy_token, :deploy_nft, :deploy_multi_token
|
250
264
|
|
251
265
|
# Returns the addresses belonging to the Wallet.
|
252
266
|
# @return [Array<Coinbase::WalletAddress>] The addresses belonging to the Wallet
|
@@ -468,6 +482,22 @@ module Coinbase
|
|
468
482
|
"Successfully loaded seed for wallet #{id} from #{file_path}."
|
469
483
|
end
|
470
484
|
|
485
|
+
# Creates a new webhook on the current wallet for tracking wallet activity events.
|
486
|
+
#
|
487
|
+
# @param notification_uri [String] The URI to which the webhook notifications will be sent.
|
488
|
+
#
|
489
|
+
# @return [Coinbase::Client::Webhook] The newly created webhook instance.
|
490
|
+
def create_webhook(notification_uri:)
|
491
|
+
Coinbase.call_api do
|
492
|
+
webhooks_api.create_wallet_webhook(
|
493
|
+
id,
|
494
|
+
create_wallet_webhook_request: {
|
495
|
+
notification_uri: notification_uri
|
496
|
+
}
|
497
|
+
)
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
471
501
|
# Returns a String representation of the Wallet.
|
472
502
|
# @return [String] a String representation of the Wallet
|
473
503
|
def to_s
|
@@ -592,6 +622,10 @@ module Coinbase
|
|
592
622
|
@wallets_api ||= Coinbase::Client::WalletsApi.new(Coinbase.configuration.api_client)
|
593
623
|
end
|
594
624
|
|
625
|
+
def webhooks_api
|
626
|
+
@webhooks_api ||= Coinbase::Client::WebhooksApi.new(Coinbase.configuration.api_client)
|
627
|
+
end
|
628
|
+
|
595
629
|
def set_addresses
|
596
630
|
address_list = Coinbase.call_api do
|
597
631
|
addresses_api.list_addresses(@model.id, { limit: MAX_ADDRESSES })
|
data/lib/coinbase/webhook.rb
CHANGED
@@ -22,8 +22,6 @@ module Coinbase
|
|
22
22
|
# @param event_filters [Array<Hash>] Filters applied to the events that determine
|
23
23
|
# which specific events trigger the webhook. Each filter should be a hash that
|
24
24
|
# can include keys like `contract_address`, `from_address`, or `to_address`.
|
25
|
-
# @param signature_header [String] The custom header to be used for x-webhook-signature header on callbacks,
|
26
|
-
# so developers can verify the requests are coming from Coinbase.
|
27
25
|
# @return [Coinbase::Webhook] A new instance of Webhook.
|
28
26
|
#
|
29
27
|
# @example Create a new webhook
|
@@ -31,18 +29,16 @@ module Coinbase
|
|
31
29
|
# network_id: :ethereum_mainnet,
|
32
30
|
# notification_uri: 'https://example.com/callback',
|
33
31
|
# event_type: 'transaction',
|
34
|
-
# event_filters: [{ 'contract_address' => '0x...', 'from_address' => '0x...', 'to_address' => '0x...' }]
|
35
|
-
# signature_header: 'example_header'
|
32
|
+
# event_filters: [{ 'contract_address' => '0x...', 'from_address' => '0x...', 'to_address' => '0x...' }]
|
36
33
|
# )
|
37
|
-
def create(network_id:, notification_uri:, event_type:, event_filters
|
34
|
+
def create(network_id:, notification_uri:, event_type:, event_filters:)
|
38
35
|
model = Coinbase.call_api do
|
39
36
|
webhooks_api.create_webhook(
|
40
37
|
create_webhook_request: {
|
41
38
|
network_id: Coinbase.normalize_network(network_id),
|
42
39
|
notification_uri: notification_uri,
|
43
40
|
event_type: event_type,
|
44
|
-
event_filters: event_filters
|
45
|
-
signature_header: signature_header
|
41
|
+
event_filters: event_filters
|
46
42
|
}
|
47
43
|
)
|
48
44
|
end
|
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.10.0
|
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-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|
@@ -283,11 +283,14 @@ files:
|
|
283
283
|
- lib/coinbase/client/api/contract_events_api.rb
|
284
284
|
- lib/coinbase/client/api/contract_invocations_api.rb
|
285
285
|
- lib/coinbase/client/api/external_addresses_api.rb
|
286
|
+
- lib/coinbase/client/api/fund_api.rb
|
286
287
|
- lib/coinbase/client/api/networks_api.rb
|
288
|
+
- lib/coinbase/client/api/onchain_identity_api.rb
|
287
289
|
- lib/coinbase/client/api/server_signers_api.rb
|
288
290
|
- lib/coinbase/client/api/smart_contracts_api.rb
|
289
291
|
- lib/coinbase/client/api/stake_api.rb
|
290
292
|
- lib/coinbase/client/api/trades_api.rb
|
293
|
+
- lib/coinbase/client/api/transaction_history_api.rb
|
291
294
|
- lib/coinbase/client/api/transfers_api.rb
|
292
295
|
- lib/coinbase/client/api/users_api.rb
|
293
296
|
- lib/coinbase/client/api/validators_api.rb
|
@@ -315,6 +318,8 @@ files:
|
|
315
318
|
- lib/coinbase/client/models/contract_invocation_list.rb
|
316
319
|
- lib/coinbase/client/models/create_address_request.rb
|
317
320
|
- lib/coinbase/client/models/create_contract_invocation_request.rb
|
321
|
+
- lib/coinbase/client/models/create_fund_operation_request.rb
|
322
|
+
- lib/coinbase/client/models/create_fund_quote_request.rb
|
318
323
|
- lib/coinbase/client/models/create_payload_signature_request.rb
|
319
324
|
- lib/coinbase/client/models/create_server_signer_request.rb
|
320
325
|
- lib/coinbase/client/models/create_smart_contract_request.rb
|
@@ -323,29 +328,40 @@ files:
|
|
323
328
|
- lib/coinbase/client/models/create_transfer_request.rb
|
324
329
|
- lib/coinbase/client/models/create_wallet_request.rb
|
325
330
|
- lib/coinbase/client/models/create_wallet_request_wallet.rb
|
331
|
+
- lib/coinbase/client/models/create_wallet_webhook_request.rb
|
326
332
|
- lib/coinbase/client/models/create_webhook_request.rb
|
333
|
+
- lib/coinbase/client/models/crypto_amount.rb
|
327
334
|
- lib/coinbase/client/models/deploy_smart_contract_request.rb
|
328
335
|
- lib/coinbase/client/models/erc20_transfer_event.rb
|
329
336
|
- lib/coinbase/client/models/erc721_transfer_event.rb
|
330
337
|
- lib/coinbase/client/models/error.rb
|
338
|
+
- lib/coinbase/client/models/ethereum_token_transfer.rb
|
331
339
|
- lib/coinbase/client/models/ethereum_transaction.rb
|
332
340
|
- lib/coinbase/client/models/ethereum_transaction_access.rb
|
333
341
|
- lib/coinbase/client/models/ethereum_transaction_access_list.rb
|
334
342
|
- lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb
|
335
343
|
- lib/coinbase/client/models/ethereum_validator_metadata.rb
|
336
344
|
- lib/coinbase/client/models/faucet_transaction.rb
|
337
|
-
- lib/coinbase/client/models/feature.rb
|
338
345
|
- lib/coinbase/client/models/feature_set.rb
|
339
346
|
- lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb
|
340
347
|
- lib/coinbase/client/models/fetch_staking_rewards200_response.rb
|
341
348
|
- lib/coinbase/client/models/fetch_staking_rewards_request.rb
|
349
|
+
- lib/coinbase/client/models/fiat_amount.rb
|
350
|
+
- lib/coinbase/client/models/fund_operation.rb
|
351
|
+
- lib/coinbase/client/models/fund_operation_fees.rb
|
352
|
+
- lib/coinbase/client/models/fund_operation_list.rb
|
353
|
+
- lib/coinbase/client/models/fund_quote.rb
|
342
354
|
- lib/coinbase/client/models/get_staking_context_request.rb
|
343
355
|
- lib/coinbase/client/models/historical_balance.rb
|
356
|
+
- lib/coinbase/client/models/multi_token_contract_options.rb
|
344
357
|
- lib/coinbase/client/models/network.rb
|
345
358
|
- lib/coinbase/client/models/network_identifier.rb
|
346
359
|
- lib/coinbase/client/models/nft_contract_options.rb
|
360
|
+
- lib/coinbase/client/models/onchain_name.rb
|
361
|
+
- lib/coinbase/client/models/onchain_name_list.rb
|
347
362
|
- lib/coinbase/client/models/payload_signature.rb
|
348
363
|
- lib/coinbase/client/models/payload_signature_list.rb
|
364
|
+
- lib/coinbase/client/models/read_contract_request.rb
|
349
365
|
- lib/coinbase/client/models/seed_creation_event.rb
|
350
366
|
- lib/coinbase/client/models/seed_creation_event_result.rb
|
351
367
|
- lib/coinbase/client/models/server_signer.rb
|
@@ -360,6 +376,7 @@ files:
|
|
360
376
|
- lib/coinbase/client/models/smart_contract_list.rb
|
361
377
|
- lib/coinbase/client/models/smart_contract_options.rb
|
362
378
|
- lib/coinbase/client/models/smart_contract_type.rb
|
379
|
+
- lib/coinbase/client/models/solidity_value.rb
|
363
380
|
- lib/coinbase/client/models/sponsored_send.rb
|
364
381
|
- lib/coinbase/client/models/staking_balance.rb
|
365
382
|
- lib/coinbase/client/models/staking_context.rb
|
@@ -370,6 +387,7 @@ files:
|
|
370
387
|
- lib/coinbase/client/models/staking_reward_format.rb
|
371
388
|
- lib/coinbase/client/models/staking_reward_usd_value.rb
|
372
389
|
- lib/coinbase/client/models/token_contract_options.rb
|
390
|
+
- lib/coinbase/client/models/token_transfer_type.rb
|
373
391
|
- lib/coinbase/client/models/trade.rb
|
374
392
|
- lib/coinbase/client/models/trade_list.rb
|
375
393
|
- lib/coinbase/client/models/transaction.rb
|