coinbase-sdk 0.7.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/wallet_address.rb +28 -0
  3. data/lib/coinbase/address.rb +8 -3
  4. data/lib/coinbase/balance.rb +1 -1
  5. data/lib/coinbase/client/api/addresses_api.rb +1 -1
  6. data/lib/coinbase/client/api/assets_api.rb +1 -1
  7. data/lib/coinbase/client/api/balance_history_api.rb +1 -1
  8. data/lib/coinbase/client/api/contract_events_api.rb +1 -1
  9. data/lib/coinbase/client/api/contract_invocations_api.rb +1 -1
  10. data/lib/coinbase/client/api/external_addresses_api.rb +79 -1
  11. data/lib/coinbase/client/api/fund_api.rb +336 -0
  12. data/lib/coinbase/client/api/{wallet_stake_api.rb → mpc_wallet_stake_api.rb} +21 -21
  13. data/lib/coinbase/client/api/networks_api.rb +1 -1
  14. data/lib/coinbase/client/api/onchain_identity_api.rb +108 -0
  15. data/lib/coinbase/client/api/reputation_api.rb +160 -0
  16. data/lib/coinbase/client/api/server_signers_api.rb +1 -1
  17. data/lib/coinbase/client/api/smart_contracts_api.rb +81 -1
  18. data/lib/coinbase/client/api/stake_api.rb +158 -1
  19. data/lib/coinbase/client/api/trades_api.rb +1 -1
  20. data/lib/coinbase/client/api/transaction_history_api.rb +1 -1
  21. data/lib/coinbase/client/api/transfers_api.rb +1 -1
  22. data/lib/coinbase/client/api/users_api.rb +1 -1
  23. data/lib/coinbase/client/api/wallets_api.rb +1 -1
  24. data/lib/coinbase/client/api/webhooks_api.rb +6 -6
  25. data/lib/coinbase/client/api_client.rb +1 -1
  26. data/lib/coinbase/client/api_error.rb +1 -1
  27. data/lib/coinbase/client/configuration.rb +1 -1
  28. data/lib/coinbase/client/models/address.rb +1 -1
  29. data/lib/coinbase/client/models/address_balance_list.rb +1 -1
  30. data/lib/coinbase/client/models/address_historical_balance_list.rb +1 -1
  31. data/lib/coinbase/client/models/address_list.rb +1 -1
  32. data/lib/coinbase/client/models/address_reputation.rb +232 -0
  33. data/lib/coinbase/client/models/address_reputation_metadata.rb +376 -0
  34. data/lib/coinbase/client/models/address_risk.rb +223 -0
  35. data/lib/coinbase/client/models/address_transaction_list.rb +1 -1
  36. data/lib/coinbase/client/models/asset.rb +1 -1
  37. data/lib/coinbase/client/models/balance.rb +1 -1
  38. data/lib/coinbase/client/models/broadcast_contract_invocation_request.rb +1 -1
  39. data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +1 -1
  40. data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
  41. data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
  42. data/lib/coinbase/client/models/build_staking_operation_request.rb +2 -1
  43. data/lib/coinbase/client/models/contract_event.rb +1 -1
  44. data/lib/coinbase/client/models/contract_event_list.rb +1 -1
  45. data/lib/coinbase/client/models/contract_invocation.rb +1 -1
  46. data/lib/coinbase/client/models/contract_invocation_list.rb +1 -1
  47. data/lib/coinbase/client/models/create_address_request.rb +1 -1
  48. data/lib/coinbase/client/models/create_contract_invocation_request.rb +1 -1
  49. data/lib/coinbase/client/models/create_fund_operation_request.rb +249 -0
  50. data/lib/coinbase/client/models/create_fund_quote_request.rb +239 -0
  51. data/lib/coinbase/client/models/create_payload_signature_request.rb +1 -1
  52. data/lib/coinbase/client/models/create_server_signer_request.rb +1 -1
  53. data/lib/coinbase/client/models/create_smart_contract_request.rb +1 -1
  54. data/lib/coinbase/client/models/create_staking_operation_request.rb +2 -1
  55. data/lib/coinbase/client/models/create_trade_request.rb +1 -1
  56. data/lib/coinbase/client/models/create_transfer_request.rb +1 -1
  57. data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
  58. data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
  59. data/lib/coinbase/client/models/create_wallet_webhook_request.rb +2 -2
  60. data/lib/coinbase/client/models/create_webhook_request.rb +1 -1
  61. data/lib/coinbase/client/models/crypto_amount.rb +239 -0
  62. data/lib/coinbase/client/models/deploy_smart_contract_request.rb +1 -1
  63. data/lib/coinbase/client/models/erc20_transfer_event.rb +1 -1
  64. data/lib/coinbase/client/models/erc721_transfer_event.rb +1 -1
  65. data/lib/coinbase/client/models/error.rb +1 -1
  66. data/lib/coinbase/client/models/ethereum_token_transfer.rb +327 -0
  67. data/lib/coinbase/client/models/ethereum_transaction.rb +13 -2
  68. data/lib/coinbase/client/models/ethereum_transaction_access.rb +1 -1
  69. data/lib/coinbase/client/models/ethereum_transaction_access_list.rb +1 -1
  70. data/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb +1 -1
  71. data/lib/coinbase/client/models/ethereum_validator_metadata.rb +1 -1
  72. data/lib/coinbase/client/models/faucet_transaction.rb +21 -5
  73. data/lib/coinbase/client/models/feature_set.rb +1 -1
  74. data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +1 -1
  75. data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +1 -1
  76. data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +1 -1
  77. data/lib/coinbase/client/models/fiat_amount.rb +240 -0
  78. data/lib/coinbase/client/models/fund_operation.rb +373 -0
  79. data/lib/coinbase/client/models/fund_operation_fees.rb +238 -0
  80. data/lib/coinbase/client/models/fund_operation_list.rb +275 -0
  81. data/lib/coinbase/client/models/fund_quote.rb +339 -0
  82. data/lib/coinbase/client/models/get_staking_context_request.rb +2 -1
  83. data/lib/coinbase/client/models/historical_balance.rb +1 -1
  84. data/lib/coinbase/client/models/multi_token_contract_options.rb +1 -1
  85. data/lib/coinbase/client/models/network.rb +1 -1
  86. data/lib/coinbase/client/models/network_identifier.rb +1 -1
  87. data/lib/coinbase/client/models/nft_contract_options.rb +1 -1
  88. data/lib/coinbase/client/models/onchain_name.rb +357 -0
  89. data/lib/coinbase/client/models/onchain_name_list.rb +262 -0
  90. data/lib/coinbase/client/models/payload_signature.rb +1 -1
  91. data/lib/coinbase/client/models/payload_signature_list.rb +1 -1
  92. data/lib/coinbase/client/models/read_contract_request.rb +249 -0
  93. data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
  94. data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
  95. data/lib/coinbase/client/models/server_signer.rb +1 -1
  96. data/lib/coinbase/client/models/server_signer_event.rb +1 -1
  97. data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
  98. data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
  99. data/lib/coinbase/client/models/server_signer_list.rb +1 -1
  100. data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
  101. data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
  102. data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +1 -1
  103. data/lib/coinbase/client/models/smart_contract.rb +1 -1
  104. data/lib/coinbase/client/models/smart_contract_list.rb +1 -1
  105. data/lib/coinbase/client/models/smart_contract_options.rb +1 -1
  106. data/lib/coinbase/client/models/smart_contract_type.rb +1 -1
  107. data/lib/coinbase/client/models/solidity_value.rb +287 -0
  108. data/lib/coinbase/client/models/sponsored_send.rb +1 -1
  109. data/lib/coinbase/client/models/staking_balance.rb +1 -1
  110. data/lib/coinbase/client/models/staking_context.rb +1 -1
  111. data/lib/coinbase/client/models/staking_context_context.rb +1 -1
  112. data/lib/coinbase/client/models/staking_operation.rb +1 -1
  113. data/lib/coinbase/client/models/staking_operation_metadata.rb +1 -1
  114. data/lib/coinbase/client/models/staking_reward.rb +1 -1
  115. data/lib/coinbase/client/models/staking_reward_format.rb +1 -1
  116. data/lib/coinbase/client/models/staking_reward_usd_value.rb +1 -1
  117. data/lib/coinbase/client/models/token_contract_options.rb +1 -1
  118. data/lib/coinbase/client/models/token_transfer_type.rb +43 -0
  119. data/lib/coinbase/client/models/trade.rb +1 -1
  120. data/lib/coinbase/client/models/trade_list.rb +1 -1
  121. data/lib/coinbase/client/models/transaction.rb +1 -1
  122. data/lib/coinbase/client/models/transaction_content.rb +1 -1
  123. data/lib/coinbase/client/models/transaction_type.rb +1 -1
  124. data/lib/coinbase/client/models/transfer.rb +1 -1
  125. data/lib/coinbase/client/models/transfer_list.rb +1 -1
  126. data/lib/coinbase/client/models/update_webhook_request.rb +1 -8
  127. data/lib/coinbase/client/models/user.rb +1 -1
  128. data/lib/coinbase/client/models/validator.rb +1 -1
  129. data/lib/coinbase/client/models/validator_details.rb +1 -1
  130. data/lib/coinbase/client/models/validator_list.rb +1 -1
  131. data/lib/coinbase/client/models/validator_status.rb +1 -1
  132. data/lib/coinbase/client/models/wallet.rb +1 -1
  133. data/lib/coinbase/client/models/wallet_list.rb +1 -1
  134. data/lib/coinbase/client/models/webhook.rb +1 -1
  135. data/lib/coinbase/client/models/webhook_event_filter.rb +1 -1
  136. data/lib/coinbase/client/models/webhook_event_type.rb +1 -1
  137. data/lib/coinbase/client/models/webhook_event_type_filter.rb +1 -1
  138. data/lib/coinbase/client/models/webhook_list.rb +1 -1
  139. data/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +1 -1
  140. data/lib/coinbase/client/version.rb +1 -1
  141. data/lib/coinbase/client.rb +23 -3
  142. data/lib/coinbase/crypto_amount.rb +62 -0
  143. data/lib/coinbase/faucet_transaction.rb +64 -4
  144. data/lib/coinbase/fiat_amount.rb +40 -0
  145. data/lib/coinbase/fund_operation.rb +228 -0
  146. data/lib/coinbase/fund_quote.rb +149 -0
  147. data/lib/coinbase/smart_contract.rb +95 -0
  148. data/lib/coinbase/staking_operation.rb +2 -2
  149. data/lib/coinbase/transaction.rb +8 -2
  150. data/lib/coinbase/validator.rb +7 -10
  151. data/lib/coinbase/version.rb +1 -1
  152. data/lib/coinbase/wallet.rb +13 -1
  153. data/lib/coinbase.rb +4 -0
  154. metadata +27 -4
  155. data/lib/coinbase/client/api/validators_api.rb +0 -179
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,43 @@
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
+ class TokenTransferType
18
+ ERC20 = "erc20".freeze
19
+ ERC721 = "erc721".freeze
20
+ ERC1155 = "erc1155".freeze
21
+ UNKNOWN = "unknown".freeze
22
+ UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
23
+
24
+ def self.all_vars
25
+ @all_vars ||= [ERC20, ERC721, ERC1155, UNKNOWN, UNKNOWN_DEFAULT_OPEN_API].freeze
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def self.build_from_hash(value)
32
+ new.build_from_hash(value)
33
+ end
34
+
35
+ # Builds the enum from string
36
+ # @param [String] The enum value in the form of the string
37
+ # @return [String] The enum value
38
+ def build_from_hash(value)
39
+ return value if TokenTransferType.all_vars.include?(value)
40
+ raise "Invalid ENUM value #{value} for class #TokenTransferType"
41
+ end
42
+ end
43
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -79,8 +79,6 @@ module Coinbase::Client
79
79
 
80
80
  if attributes.key?(:'notification_uri')
81
81
  self.notification_uri = attributes[:'notification_uri']
82
- else
83
- self.notification_uri = nil
84
82
  end
85
83
  end
86
84
 
@@ -89,10 +87,6 @@ module Coinbase::Client
89
87
  def list_invalid_properties
90
88
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
91
89
  invalid_properties = Array.new
92
- if @notification_uri.nil?
93
- invalid_properties.push('invalid value for "notification_uri", notification_uri cannot be nil.')
94
- end
95
-
96
90
  invalid_properties
97
91
  end
98
92
 
@@ -100,7 +94,6 @@ module Coinbase::Client
100
94
  # @return true if the model is valid
101
95
  def valid?
102
96
  warn '[DEPRECATED] the `valid?` method is obsolete'
103
- return false if @notification_uri.nil?
104
97
  true
105
98
  end
106
99
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -21,6 +21,9 @@ Coinbase::Client.autoload :Address, 'coinbase/client/models/address'
21
21
  Coinbase::Client.autoload :AddressBalanceList, 'coinbase/client/models/address_balance_list'
22
22
  Coinbase::Client.autoload :AddressHistoricalBalanceList, 'coinbase/client/models/address_historical_balance_list'
23
23
  Coinbase::Client.autoload :AddressList, 'coinbase/client/models/address_list'
24
+ Coinbase::Client.autoload :AddressReputation, 'coinbase/client/models/address_reputation'
25
+ Coinbase::Client.autoload :AddressReputationMetadata, 'coinbase/client/models/address_reputation_metadata'
26
+ Coinbase::Client.autoload :AddressRisk, 'coinbase/client/models/address_risk'
24
27
  Coinbase::Client.autoload :AddressTransactionList, 'coinbase/client/models/address_transaction_list'
25
28
  Coinbase::Client.autoload :Asset, 'coinbase/client/models/asset'
26
29
  Coinbase::Client.autoload :Balance, 'coinbase/client/models/balance'
@@ -35,6 +38,8 @@ Coinbase::Client.autoload :ContractInvocation, 'coinbase/client/models/contract_
35
38
  Coinbase::Client.autoload :ContractInvocationList, 'coinbase/client/models/contract_invocation_list'
36
39
  Coinbase::Client.autoload :CreateAddressRequest, 'coinbase/client/models/create_address_request'
37
40
  Coinbase::Client.autoload :CreateContractInvocationRequest, 'coinbase/client/models/create_contract_invocation_request'
41
+ Coinbase::Client.autoload :CreateFundOperationRequest, 'coinbase/client/models/create_fund_operation_request'
42
+ Coinbase::Client.autoload :CreateFundQuoteRequest, 'coinbase/client/models/create_fund_quote_request'
38
43
  Coinbase::Client.autoload :CreatePayloadSignatureRequest, 'coinbase/client/models/create_payload_signature_request'
39
44
  Coinbase::Client.autoload :CreateServerSignerRequest, 'coinbase/client/models/create_server_signer_request'
40
45
  Coinbase::Client.autoload :CreateSmartContractRequest, 'coinbase/client/models/create_smart_contract_request'
@@ -43,11 +48,14 @@ Coinbase::Client.autoload :CreateTradeRequest, 'coinbase/client/models/create_tr
43
48
  Coinbase::Client.autoload :CreateTransferRequest, 'coinbase/client/models/create_transfer_request'
44
49
  Coinbase::Client.autoload :CreateWalletRequest, 'coinbase/client/models/create_wallet_request'
45
50
  Coinbase::Client.autoload :CreateWalletRequestWallet, 'coinbase/client/models/create_wallet_request_wallet'
51
+ Coinbase::Client.autoload :CreateWalletWebhookRequest, 'coinbase/client/models/create_wallet_webhook_request'
46
52
  Coinbase::Client.autoload :CreateWebhookRequest, 'coinbase/client/models/create_webhook_request'
53
+ Coinbase::Client.autoload :CryptoAmount, 'coinbase/client/models/crypto_amount'
47
54
  Coinbase::Client.autoload :DeploySmartContractRequest, 'coinbase/client/models/deploy_smart_contract_request'
48
55
  Coinbase::Client.autoload :ERC20TransferEvent, 'coinbase/client/models/erc20_transfer_event'
49
56
  Coinbase::Client.autoload :ERC721TransferEvent, 'coinbase/client/models/erc721_transfer_event'
50
57
  Coinbase::Client.autoload :Error, 'coinbase/client/models/error'
58
+ Coinbase::Client.autoload :EthereumTokenTransfer, 'coinbase/client/models/ethereum_token_transfer'
51
59
  Coinbase::Client.autoload :EthereumTransaction, 'coinbase/client/models/ethereum_transaction'
52
60
  Coinbase::Client.autoload :EthereumTransactionAccess, 'coinbase/client/models/ethereum_transaction_access'
53
61
  Coinbase::Client.autoload :EthereumTransactionAccessList, 'coinbase/client/models/ethereum_transaction_access_list'
@@ -58,14 +66,22 @@ Coinbase::Client.autoload :FeatureSet, 'coinbase/client/models/feature_set'
58
66
  Coinbase::Client.autoload :FetchHistoricalStakingBalances200Response, 'coinbase/client/models/fetch_historical_staking_balances200_response'
59
67
  Coinbase::Client.autoload :FetchStakingRewards200Response, 'coinbase/client/models/fetch_staking_rewards200_response'
60
68
  Coinbase::Client.autoload :FetchStakingRewardsRequest, 'coinbase/client/models/fetch_staking_rewards_request'
69
+ Coinbase::Client.autoload :FiatAmount, 'coinbase/client/models/fiat_amount'
70
+ Coinbase::Client.autoload :FundOperation, 'coinbase/client/models/fund_operation'
71
+ Coinbase::Client.autoload :FundOperationFees, 'coinbase/client/models/fund_operation_fees'
72
+ Coinbase::Client.autoload :FundOperationList, 'coinbase/client/models/fund_operation_list'
73
+ Coinbase::Client.autoload :FundQuote, 'coinbase/client/models/fund_quote'
61
74
  Coinbase::Client.autoload :GetStakingContextRequest, 'coinbase/client/models/get_staking_context_request'
62
75
  Coinbase::Client.autoload :HistoricalBalance, 'coinbase/client/models/historical_balance'
63
76
  Coinbase::Client.autoload :MultiTokenContractOptions, 'coinbase/client/models/multi_token_contract_options'
64
77
  Coinbase::Client.autoload :NFTContractOptions, 'coinbase/client/models/nft_contract_options'
65
78
  Coinbase::Client.autoload :Network, 'coinbase/client/models/network'
66
79
  Coinbase::Client.autoload :NetworkIdentifier, 'coinbase/client/models/network_identifier'
80
+ Coinbase::Client.autoload :OnchainName, 'coinbase/client/models/onchain_name'
81
+ Coinbase::Client.autoload :OnchainNameList, 'coinbase/client/models/onchain_name_list'
67
82
  Coinbase::Client.autoload :PayloadSignature, 'coinbase/client/models/payload_signature'
68
83
  Coinbase::Client.autoload :PayloadSignatureList, 'coinbase/client/models/payload_signature_list'
84
+ Coinbase::Client.autoload :ReadContractRequest, 'coinbase/client/models/read_contract_request'
69
85
  Coinbase::Client.autoload :SeedCreationEvent, 'coinbase/client/models/seed_creation_event'
70
86
  Coinbase::Client.autoload :SeedCreationEventResult, 'coinbase/client/models/seed_creation_event_result'
71
87
  Coinbase::Client.autoload :ServerSigner, 'coinbase/client/models/server_signer'
@@ -80,6 +96,7 @@ Coinbase::Client.autoload :SmartContract, 'coinbase/client/models/smart_contract
80
96
  Coinbase::Client.autoload :SmartContractList, 'coinbase/client/models/smart_contract_list'
81
97
  Coinbase::Client.autoload :SmartContractOptions, 'coinbase/client/models/smart_contract_options'
82
98
  Coinbase::Client.autoload :SmartContractType, 'coinbase/client/models/smart_contract_type'
99
+ Coinbase::Client.autoload :SolidityValue, 'coinbase/client/models/solidity_value'
83
100
  Coinbase::Client.autoload :SponsoredSend, 'coinbase/client/models/sponsored_send'
84
101
  Coinbase::Client.autoload :StakingBalance, 'coinbase/client/models/staking_balance'
85
102
  Coinbase::Client.autoload :StakingContext, 'coinbase/client/models/staking_context'
@@ -90,6 +107,7 @@ Coinbase::Client.autoload :StakingReward, 'coinbase/client/models/staking_reward
90
107
  Coinbase::Client.autoload :StakingRewardFormat, 'coinbase/client/models/staking_reward_format'
91
108
  Coinbase::Client.autoload :StakingRewardUSDValue, 'coinbase/client/models/staking_reward_usd_value'
92
109
  Coinbase::Client.autoload :TokenContractOptions, 'coinbase/client/models/token_contract_options'
110
+ Coinbase::Client.autoload :TokenTransferType, 'coinbase/client/models/token_transfer_type'
93
111
  Coinbase::Client.autoload :Trade, 'coinbase/client/models/trade'
94
112
  Coinbase::Client.autoload :TradeList, 'coinbase/client/models/trade_list'
95
113
  Coinbase::Client.autoload :Transaction, 'coinbase/client/models/transaction'
@@ -119,7 +137,11 @@ Coinbase::Client.autoload :BalanceHistoryApi, 'coinbase/client/api/balance_histo
119
137
  Coinbase::Client.autoload :ContractEventsApi, 'coinbase/client/api/contract_events_api'
120
138
  Coinbase::Client.autoload :ContractInvocationsApi, 'coinbase/client/api/contract_invocations_api'
121
139
  Coinbase::Client.autoload :ExternalAddressesApi, 'coinbase/client/api/external_addresses_api'
140
+ Coinbase::Client.autoload :FundApi, 'coinbase/client/api/fund_api'
141
+ Coinbase::Client.autoload :MPCWalletStakeApi, 'coinbase/client/api/mpc_wallet_stake_api'
122
142
  Coinbase::Client.autoload :NetworksApi, 'coinbase/client/api/networks_api'
143
+ Coinbase::Client.autoload :OnchainIdentityApi, 'coinbase/client/api/onchain_identity_api'
144
+ Coinbase::Client.autoload :ReputationApi, 'coinbase/client/api/reputation_api'
123
145
  Coinbase::Client.autoload :ServerSignersApi, 'coinbase/client/api/server_signers_api'
124
146
  Coinbase::Client.autoload :SmartContractsApi, 'coinbase/client/api/smart_contracts_api'
125
147
  Coinbase::Client.autoload :StakeApi, 'coinbase/client/api/stake_api'
@@ -127,8 +149,6 @@ Coinbase::Client.autoload :TradesApi, 'coinbase/client/api/trades_api'
127
149
  Coinbase::Client.autoload :TransactionHistoryApi, 'coinbase/client/api/transaction_history_api'
128
150
  Coinbase::Client.autoload :TransfersApi, 'coinbase/client/api/transfers_api'
129
151
  Coinbase::Client.autoload :UsersApi, 'coinbase/client/api/users_api'
130
- Coinbase::Client.autoload :ValidatorsApi, 'coinbase/client/api/validators_api'
131
- Coinbase::Client.autoload :WalletStakeApi, 'coinbase/client/api/wallet_stake_api'
132
152
  Coinbase::Client.autoload :WalletsApi, 'coinbase/client/api/wallets_api'
133
153
  Coinbase::Client.autoload :WebhooksApi, 'coinbase/client/api/webhooks_api'
134
154
 
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Coinbase
4
+ # A representation of a CryptoAmount that includes the amount and asset.
5
+ class CryptoAmount
6
+ # Converts a Coinbase::Client::CryptoAmount model to a Coinbase::CryptoAmount
7
+ # @param amount_model [Coinbase::Client::CryptoAmount] The crypto amount from the API.
8
+ # @return [CryptoAmount] The converted CryptoAmount object.
9
+ def self.from_model(amount_model)
10
+ asset = Coinbase::Asset.from_model(amount_model.asset)
11
+
12
+ new(amount: asset.from_atomic_amount(amount_model.amount), asset: asset)
13
+ end
14
+
15
+ # Converts a Coinbase::Client::CryptoAmount model and asset ID to a Coinbase::CryptoAmount
16
+ # This can be used to specify a non-primary denomination that we want the amount
17
+ # to be converted to.
18
+ # @param amount_model [Coinbase::Client::CryptoAmount] The crypto amount from the API.
19
+ # @param asset_id [Symbol] The Asset ID of the denomination we want returned.
20
+ # @return [CryptoAmount] The converted CryptoAmount object.
21
+ def self.from_model_and_asset_id(amount_model, asset_id)
22
+ asset = Coinbase::Asset.from_model(amount_model.asset, asset_id: asset_id)
23
+
24
+ new(
25
+ amount: asset.from_atomic_amount(amount_model.amount),
26
+ asset: asset,
27
+ asset_id: asset_id
28
+ )
29
+ end
30
+
31
+ # Returns a new CryptoAmount object. Do not use this method.
32
+ # Instead, use CryptoAmount.from_model or CryptoAmount.from_model_and_asset_id.
33
+ # @param amount [BigDecimal] The amount of the Asset
34
+ # @param asset [Coinbase::Asset] The Asset
35
+ # @param asset_id [Symbol] The Asset ID
36
+ def initialize(amount:, asset:, asset_id: nil)
37
+ @amount = amount
38
+ @asset = asset
39
+ @asset_id = asset_id || asset.asset_id
40
+ end
41
+
42
+ attr_reader :amount, :asset, :asset_id
43
+
44
+ # Returns the amount in atomic units.
45
+ # @return [BigDecimal] the amount in atomic units
46
+ def to_atomic_amount
47
+ asset.to_atomic_amount(amount)
48
+ end
49
+
50
+ # Returns a string representation of the CryptoAmount.
51
+ # @return [String] a string representation of the CryptoAmount
52
+ def to_s
53
+ Coinbase.pretty_print_object(self.class, amount: amount.to_s('F'), asset_id: asset_id)
54
+ end
55
+
56
+ # Same as to_s.
57
+ # @return [String] a string representation of the CryptoAmount
58
+ def inspect
59
+ to_s
60
+ end
61
+ end
62
+ end
@@ -12,22 +12,80 @@ module Coinbase
12
12
  @model = model
13
13
  end
14
14
 
15
+ # Returns the Faucet transaction.
16
+ # @return [Coinbase::Transaction] The Faucet transaction
17
+ def transaction
18
+ @transaction ||= Coinbase::Transaction.new(@model.transaction)
19
+ end
20
+
21
+ # Returns the status of the Faucet transaction.
22
+ # @return [Symbol] The status
23
+ def status
24
+ transaction.status
25
+ end
26
+
15
27
  # Returns the transaction hash.
16
28
  # @return [String] The onchain transaction hash
17
29
  def transaction_hash
18
- model.transaction_hash
30
+ transaction.transaction_hash
19
31
  end
20
32
 
21
33
  # Returns the link to the transaction on the blockchain explorer.
22
34
  # @return [String] The link to the transaction on the blockchain explorer
23
35
  def transaction_link
24
- model.transaction_link
36
+ transaction.transaction_link
37
+ end
38
+
39
+ # Returns the Network of the Transaction.
40
+ # @return [Coinbase::Network] The Network
41
+ def network
42
+ transaction.network
43
+ end
44
+
45
+ # Waits until the FaucetTransaction is completed or failed by polling on the given interval.
46
+ # @param interval_seconds [Integer] The interval at which to poll the Network, in seconds
47
+ # @param timeout_seconds [Integer] The maximum amount of time to wait for the Transfer to complete, in seconds
48
+ # @raise [Timeout::Error] if the FaucetTransaction takes longer than the given timeout
49
+ # @return [Transfer] The completed Transfer object
50
+ def wait!(interval_seconds = 0.2, timeout_seconds = 20)
51
+ start_time = Time.now
52
+
53
+ loop do
54
+ reload
55
+
56
+ return self if transaction.terminal_state?
57
+
58
+ raise Timeout::Error, 'Faucet transaction timed out' if Time.now - start_time > timeout_seconds
59
+
60
+ self.sleep interval_seconds
61
+ end
62
+
63
+ self
64
+ end
65
+
66
+ def reload
67
+ @model = Coinbase.call_api do
68
+ addresses_api.get_faucet_transaction(
69
+ network.normalized_id,
70
+ transaction.to_address_id,
71
+ transaction_hash
72
+ )
73
+ end
74
+
75
+ @transaction = Coinbase::Transaction.new(@model.transaction)
76
+
77
+ self
25
78
  end
26
79
 
27
80
  # Returns a String representation of the FaucetTransaction.
28
81
  # @return [String] a String representation of the FaucetTransaction
29
82
  def to_s
30
- "Coinbase::FaucetTransaction{transaction_hash: '#{transaction_hash}', transaction_link: '#{transaction_link}'}"
83
+ Coinbase.pretty_print_object(
84
+ self.class,
85
+ status: transaction.status,
86
+ transaction_hash: transaction_hash,
87
+ transaction_link: transaction_link
88
+ )
31
89
  end
32
90
 
33
91
  # Same as to_s.
@@ -38,6 +96,8 @@ module Coinbase
38
96
 
39
97
  private
40
98
 
41
- attr_reader :model
99
+ def addresses_api
100
+ @addresses_api ||= Coinbase::Client::ExternalAddressesApi.new(Coinbase.configuration.api_client)
101
+ end
42
102
  end
43
103
  end