diff --git a/CHANGELOG.md b/CHANGELOG.md index c00013e7..861dbcfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [0.11.0] - 2024-11-27 + +### Added +- Add support for funding wallets (Alpha feature release) + - Must reach out to CDP SDK Discord channel to be considered for this feature. + +### Fixed +- Fix Smart Contract reads with no ABI specified. ## [0.10.0] - 2024-10-31 - Include ERC20 and ERC721 token transfer information into transaction content. diff --git a/lib/coinbase.rb b/lib/coinbase.rb index fc0d89f7..559695a0 100644 --- a/lib/coinbase.rb +++ b/lib/coinbase.rb @@ -13,11 +13,15 @@ require_relative 'coinbase/constants' require_relative 'coinbase/contract_event' require_relative 'coinbase/contract_invocation' +require_relative 'coinbase/crypto_amount' require_relative 'coinbase/destination' require_relative 'coinbase/errors' require_relative 'coinbase/faucet_transaction' +require_relative 'coinbase/fiat_amount' require_relative 'coinbase/middleware' require_relative 'coinbase/network' +require_relative 'coinbase/fund_operation' +require_relative 'coinbase/fund_quote' require_relative 'coinbase/pagination' require_relative 'coinbase/payload_signature' require_relative 'coinbase/trade' diff --git a/lib/coinbase/address/wallet_address.rb b/lib/coinbase/address/wallet_address.rb index 4969bd5e..6fa19ecd 100644 --- a/lib/coinbase/address/wallet_address.rb +++ b/lib/coinbase/address/wallet_address.rb @@ -217,6 +217,34 @@ def sign_payload(unsigned_payload:) ) end + # Funds the address from your account on the Coinbase Platform for the given amount of the given Asset. + # @param amount [Integer, Float, BigDecimal] The amount of the Asset to fund the wallet with. + # @param asset_id [Symbol] The ID of the Asset to trade from. For Ether, :eth, :gwei, and :wei are supported. + # @return [Coinbase::FundOperation] The FundOperation object. + def fund(amount, asset_id) + FundOperation.create( + address_id: id, + amount: amount, + asset_id: asset_id, + network: network, + wallet_id: wallet_id + ) + end + + # Gets a quote for a fund operation to fund the address from your Coinbase platform, + # account for the amount of the specified Asset. + # @param asset_id [Symbol] The ID of the Asset to trade from. For Ether, :eth, :gwei, and :wei are supported. + # @return [Coinbase::FundQuote] The FundQuote object. + def quote_fund(amount, asset_id) + FundQuote.create( + address_id: id, + amount: amount, + asset_id: asset_id, + network: network, + wallet_id: wallet_id + ) + end + # Stakes the given amount of the given Asset. The stake operation # may take a few minutes to complete in the case when infrastructure is spun up. # @param amount [Integer, Float, BigDecimal] The amount of the Asset to stake. diff --git a/lib/coinbase/balance.rb b/lib/coinbase/balance.rb index 0827a374..690d7325 100644 --- a/lib/coinbase/balance.rb +++ b/lib/coinbase/balance.rb @@ -43,7 +43,7 @@ def initialize(amount:, asset:, asset_id: nil) # Returns a string representation of the Balance. # @return [String] a string representation of the Balance def to_s - "Coinbase::Balance{amount: '#{amount.to_i}', asset_id: '#{asset_id}'}" + Coinbase.pretty_print_object(self.class, amount: amount.to_s('F'), asset_id: asset_id) end # Same as to_s. diff --git a/lib/coinbase/client.rb b/lib/coinbase/client.rb index b40ebda5..d0a11450 100644 --- a/lib/coinbase/client.rb +++ b/lib/coinbase/client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end @@ -21,6 +21,9 @@ Coinbase::Client.autoload :AddressBalanceList, 'coinbase/client/models/address_balance_list' Coinbase::Client.autoload :AddressHistoricalBalanceList, 'coinbase/client/models/address_historical_balance_list' Coinbase::Client.autoload :AddressList, 'coinbase/client/models/address_list' +Coinbase::Client.autoload :AddressReputation, 'coinbase/client/models/address_reputation' +Coinbase::Client.autoload :AddressReputationMetadata, 'coinbase/client/models/address_reputation_metadata' +Coinbase::Client.autoload :AddressRisk, 'coinbase/client/models/address_risk' Coinbase::Client.autoload :AddressTransactionList, 'coinbase/client/models/address_transaction_list' Coinbase::Client.autoload :Asset, 'coinbase/client/models/asset' Coinbase::Client.autoload :Balance, 'coinbase/client/models/balance' @@ -135,8 +138,10 @@ Coinbase::Client.autoload :ContractInvocationsApi, 'coinbase/client/api/contract_invocations_api' Coinbase::Client.autoload :ExternalAddressesApi, 'coinbase/client/api/external_addresses_api' Coinbase::Client.autoload :FundApi, 'coinbase/client/api/fund_api' +Coinbase::Client.autoload :MPCWalletStakeApi, 'coinbase/client/api/mpc_wallet_stake_api' Coinbase::Client.autoload :NetworksApi, 'coinbase/client/api/networks_api' Coinbase::Client.autoload :OnchainIdentityApi, 'coinbase/client/api/onchain_identity_api' +Coinbase::Client.autoload :ReputationApi, 'coinbase/client/api/reputation_api' Coinbase::Client.autoload :ServerSignersApi, 'coinbase/client/api/server_signers_api' Coinbase::Client.autoload :SmartContractsApi, 'coinbase/client/api/smart_contracts_api' Coinbase::Client.autoload :StakeApi, 'coinbase/client/api/stake_api' @@ -144,8 +149,6 @@ Coinbase::Client.autoload :TransactionHistoryApi, 'coinbase/client/api/transaction_history_api' Coinbase::Client.autoload :TransfersApi, 'coinbase/client/api/transfers_api' Coinbase::Client.autoload :UsersApi, 'coinbase/client/api/users_api' -Coinbase::Client.autoload :ValidatorsApi, 'coinbase/client/api/validators_api' -Coinbase::Client.autoload :WalletStakeApi, 'coinbase/client/api/wallet_stake_api' Coinbase::Client.autoload :WalletsApi, 'coinbase/client/api/wallets_api' Coinbase::Client.autoload :WebhooksApi, 'coinbase/client/api/webhooks_api' diff --git a/lib/coinbase/client/api/addresses_api.rb b/lib/coinbase/client/api/addresses_api.rb index 96e3e8e5..70f55c91 100644 --- a/lib/coinbase/client/api/addresses_api.rb +++ b/lib/coinbase/client/api/addresses_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/assets_api.rb b/lib/coinbase/client/api/assets_api.rb index 30854616..ad9e9593 100644 --- a/lib/coinbase/client/api/assets_api.rb +++ b/lib/coinbase/client/api/assets_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/balance_history_api.rb b/lib/coinbase/client/api/balance_history_api.rb index ba0be892..d66ab8fd 100644 --- a/lib/coinbase/client/api/balance_history_api.rb +++ b/lib/coinbase/client/api/balance_history_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/contract_events_api.rb b/lib/coinbase/client/api/contract_events_api.rb index b38bfed7..b155304b 100644 --- a/lib/coinbase/client/api/contract_events_api.rb +++ b/lib/coinbase/client/api/contract_events_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/contract_invocations_api.rb b/lib/coinbase/client/api/contract_invocations_api.rb index b97d63f4..224bb217 100644 --- a/lib/coinbase/client/api/contract_invocations_api.rb +++ b/lib/coinbase/client/api/contract_invocations_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/external_addresses_api.rb b/lib/coinbase/client/api/external_addresses_api.rb index 5e26ec39..d6c0f7ec 100644 --- a/lib/coinbase/client/api/external_addresses_api.rb +++ b/lib/coinbase/client/api/external_addresses_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/fund_api.rb b/lib/coinbase/client/api/fund_api.rb index 6c97f4bb..5bbe6a72 100644 --- a/lib/coinbase/client/api/fund_api.rb +++ b/lib/coinbase/client/api/fund_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/wallet_stake_api.rb b/lib/coinbase/client/api/mpc_wallet_stake_api.rb similarity index 87% rename from lib/coinbase/client/api/wallet_stake_api.rb rename to lib/coinbase/client/api/mpc_wallet_stake_api.rb index 8503ff99..40cedeb4 100644 --- a/lib/coinbase/client/api/wallet_stake_api.rb +++ b/lib/coinbase/client/api/mpc_wallet_stake_api.rb @@ -6,14 +6,14 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end require 'cgi' module Coinbase::Client - class WalletStakeApi + class MPCWalletStakeApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @@ -42,23 +42,23 @@ def broadcast_staking_operation(wallet_id, address_id, staking_operation_id, bro # @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers def broadcast_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, broadcast_staking_operation_request, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: WalletStakeApi.broadcast_staking_operation ...' + @api_client.config.logger.debug 'Calling API: MPCWalletStakeApi.broadcast_staking_operation ...' end # verify the required parameter 'wallet_id' is set if @api_client.config.client_side_validation && wallet_id.nil? - fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletStakeApi.broadcast_staking_operation" + fail ArgumentError, "Missing the required parameter 'wallet_id' when calling MPCWalletStakeApi.broadcast_staking_operation" end # verify the required parameter 'address_id' is set if @api_client.config.client_side_validation && address_id.nil? - fail ArgumentError, "Missing the required parameter 'address_id' when calling WalletStakeApi.broadcast_staking_operation" + fail ArgumentError, "Missing the required parameter 'address_id' when calling MPCWalletStakeApi.broadcast_staking_operation" end # verify the required parameter 'staking_operation_id' is set if @api_client.config.client_side_validation && staking_operation_id.nil? - fail ArgumentError, "Missing the required parameter 'staking_operation_id' when calling WalletStakeApi.broadcast_staking_operation" + fail ArgumentError, "Missing the required parameter 'staking_operation_id' when calling MPCWalletStakeApi.broadcast_staking_operation" end # verify the required parameter 'broadcast_staking_operation_request' is set if @api_client.config.client_side_validation && broadcast_staking_operation_request.nil? - fail ArgumentError, "Missing the required parameter 'broadcast_staking_operation_request' when calling WalletStakeApi.broadcast_staking_operation" + fail ArgumentError, "Missing the required parameter 'broadcast_staking_operation_request' when calling MPCWalletStakeApi.broadcast_staking_operation" end # resource path local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id}/broadcast'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'staking_operation_id' + '}', CGI.escape(staking_operation_id.to_s)) @@ -89,7 +89,7 @@ def broadcast_staking_operation_with_http_info(wallet_id, address_id, staking_op auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( - :operation => :"WalletStakeApi.broadcast_staking_operation", + :operation => :"MPCWalletStakeApi.broadcast_staking_operation", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -100,7 +100,7 @@ def broadcast_staking_operation_with_http_info(wallet_id, address_id, staking_op data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: WalletStakeApi#broadcast_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: MPCWalletStakeApi#broadcast_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end @@ -126,19 +126,19 @@ def create_staking_operation(wallet_id, address_id, create_staking_operation_req # @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers def create_staking_operation_with_http_info(wallet_id, address_id, create_staking_operation_request, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: WalletStakeApi.create_staking_operation ...' + @api_client.config.logger.debug 'Calling API: MPCWalletStakeApi.create_staking_operation ...' end # verify the required parameter 'wallet_id' is set if @api_client.config.client_side_validation && wallet_id.nil? - fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletStakeApi.create_staking_operation" + fail ArgumentError, "Missing the required parameter 'wallet_id' when calling MPCWalletStakeApi.create_staking_operation" end # verify the required parameter 'address_id' is set if @api_client.config.client_side_validation && address_id.nil? - fail ArgumentError, "Missing the required parameter 'address_id' when calling WalletStakeApi.create_staking_operation" + fail ArgumentError, "Missing the required parameter 'address_id' when calling MPCWalletStakeApi.create_staking_operation" end # verify the required parameter 'create_staking_operation_request' is set if @api_client.config.client_side_validation && create_staking_operation_request.nil? - fail ArgumentError, "Missing the required parameter 'create_staking_operation_request' when calling WalletStakeApi.create_staking_operation" + fail ArgumentError, "Missing the required parameter 'create_staking_operation_request' when calling MPCWalletStakeApi.create_staking_operation" end # resource path local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)) @@ -169,7 +169,7 @@ def create_staking_operation_with_http_info(wallet_id, address_id, create_stakin auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( - :operation => :"WalletStakeApi.create_staking_operation", + :operation => :"MPCWalletStakeApi.create_staking_operation", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -180,7 +180,7 @@ def create_staking_operation_with_http_info(wallet_id, address_id, create_stakin data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: WalletStakeApi#create_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: MPCWalletStakeApi#create_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end @@ -206,19 +206,19 @@ def get_staking_operation(wallet_id, address_id, staking_operation_id, opts = {} # @return [Array<(StakingOperation, Integer, Hash)>] StakingOperation data, response status code and response headers def get_staking_operation_with_http_info(wallet_id, address_id, staking_operation_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: WalletStakeApi.get_staking_operation ...' + @api_client.config.logger.debug 'Calling API: MPCWalletStakeApi.get_staking_operation ...' end # verify the required parameter 'wallet_id' is set if @api_client.config.client_side_validation && wallet_id.nil? - fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletStakeApi.get_staking_operation" + fail ArgumentError, "Missing the required parameter 'wallet_id' when calling MPCWalletStakeApi.get_staking_operation" end # verify the required parameter 'address_id' is set if @api_client.config.client_side_validation && address_id.nil? - fail ArgumentError, "Missing the required parameter 'address_id' when calling WalletStakeApi.get_staking_operation" + fail ArgumentError, "Missing the required parameter 'address_id' when calling MPCWalletStakeApi.get_staking_operation" end # verify the required parameter 'staking_operation_id' is set if @api_client.config.client_side_validation && staking_operation_id.nil? - fail ArgumentError, "Missing the required parameter 'staking_operation_id' when calling WalletStakeApi.get_staking_operation" + fail ArgumentError, "Missing the required parameter 'staking_operation_id' when calling MPCWalletStakeApi.get_staking_operation" end # resource path local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'staking_operation_id' + '}', CGI.escape(staking_operation_id.to_s)) @@ -244,7 +244,7 @@ def get_staking_operation_with_http_info(wallet_id, address_id, staking_operatio auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( - :operation => :"WalletStakeApi.get_staking_operation", + :operation => :"MPCWalletStakeApi.get_staking_operation", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -255,7 +255,7 @@ def get_staking_operation_with_http_info(wallet_id, address_id, staking_operatio data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: WalletStakeApi#get_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: MPCWalletStakeApi#get_staking_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end diff --git a/lib/coinbase/client/api/networks_api.rb b/lib/coinbase/client/api/networks_api.rb index dc8f47c1..c9726aa5 100644 --- a/lib/coinbase/client/api/networks_api.rb +++ b/lib/coinbase/client/api/networks_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/onchain_identity_api.rb b/lib/coinbase/client/api/onchain_identity_api.rb index 294cb3c8..9852713b 100644 --- a/lib/coinbase/client/api/onchain_identity_api.rb +++ b/lib/coinbase/client/api/onchain_identity_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/reputation_api.rb b/lib/coinbase/client/api/reputation_api.rb new file mode 100644 index 00000000..748f13a2 --- /dev/null +++ b/lib/coinbase/client/api/reputation_api.rb @@ -0,0 +1,160 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha + +Generated by: https://openapi-generator.tech +Generator version: 7.9.0 + +=end + +require 'cgi' + +module Coinbase::Client + class ReputationApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get the onchain reputation of an external address + # Get the onchain reputation of an external address + # @param network_id [String] The ID of the blockchain network. + # @param address_id [String] The ID of the address to fetch the reputation for. + # @param [Hash] opts the optional parameters + # @return [AddressReputation] + def get_address_reputation(network_id, address_id, opts = {}) + data, _status_code, _headers = get_address_reputation_with_http_info(network_id, address_id, opts) + data + end + + # Get the onchain reputation of an external address + # Get the onchain reputation of an external address + # @param network_id [String] The ID of the blockchain network. + # @param address_id [String] The ID of the address to fetch the reputation for. + # @param [Hash] opts the optional parameters + # @return [Array<(AddressReputation, Integer, Hash)>] AddressReputation data, response status code and response headers + def get_address_reputation_with_http_info(network_id, address_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReputationApi.get_address_reputation ...' + end + # verify the required parameter 'network_id' is set + if @api_client.config.client_side_validation && network_id.nil? + fail ArgumentError, "Missing the required parameter 'network_id' when calling ReputationApi.get_address_reputation" + end + # verify the required parameter 'address_id' is set + if @api_client.config.client_side_validation && address_id.nil? + fail ArgumentError, "Missing the required parameter 'address_id' when calling ReputationApi.get_address_reputation" + end + # resource path + local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/reputation'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AddressReputation' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"ReputationApi.get_address_reputation", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReputationApi#get_address_reputation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get the risk of an address + # Get the risk of an address + # @param network_id [String] The ID of the blockchain network. + # @param address_id [String] The ID of the address to fetch the risk for. + # @param [Hash] opts the optional parameters + # @return [AddressRisk] + def get_address_risk(network_id, address_id, opts = {}) + data, _status_code, _headers = get_address_risk_with_http_info(network_id, address_id, opts) + data + end + + # Get the risk of an address + # Get the risk of an address + # @param network_id [String] The ID of the blockchain network. + # @param address_id [String] The ID of the address to fetch the risk for. + # @param [Hash] opts the optional parameters + # @return [Array<(AddressRisk, Integer, Hash)>] AddressRisk data, response status code and response headers + def get_address_risk_with_http_info(network_id, address_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReputationApi.get_address_risk ...' + end + # verify the required parameter 'network_id' is set + if @api_client.config.client_side_validation && network_id.nil? + fail ArgumentError, "Missing the required parameter 'network_id' when calling ReputationApi.get_address_risk" + end + # verify the required parameter 'address_id' is set + if @api_client.config.client_side_validation && address_id.nil? + fail ArgumentError, "Missing the required parameter 'address_id' when calling ReputationApi.get_address_risk" + end + # resource path + local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/risk'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AddressRisk' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"ReputationApi.get_address_risk", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReputationApi#get_address_risk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/coinbase/client/api/server_signers_api.rb b/lib/coinbase/client/api/server_signers_api.rb index ca1375e3..d2aa3e3a 100644 --- a/lib/coinbase/client/api/server_signers_api.rb +++ b/lib/coinbase/client/api/server_signers_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/smart_contracts_api.rb b/lib/coinbase/client/api/smart_contracts_api.rb index cce423a2..b5bbba7d 100644 --- a/lib/coinbase/client/api/smart_contracts_api.rb +++ b/lib/coinbase/client/api/smart_contracts_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/stake_api.rb b/lib/coinbase/client/api/stake_api.rb index 591f8af5..aee9c8a4 100644 --- a/lib/coinbase/client/api/stake_api.rb +++ b/lib/coinbase/client/api/stake_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end @@ -419,5 +419,162 @@ def get_staking_context_with_http_info(get_staking_context_request, opts = {}) end return data, status_code, headers end + + # Get a validator belonging to the CDP project + # Get a validator belonging to the user for a given network, asset and id. + # @param network_id [String] The ID of the blockchain network. + # @param asset_id [String] The symbol of the asset to get the validator for. + # @param validator_id [String] The unique id of the validator to fetch details for. + # @param [Hash] opts the optional parameters + # @return [Validator] + def get_validator(network_id, asset_id, validator_id, opts = {}) + data, _status_code, _headers = get_validator_with_http_info(network_id, asset_id, validator_id, opts) + data + end + + # Get a validator belonging to the CDP project + # Get a validator belonging to the user for a given network, asset and id. + # @param network_id [String] The ID of the blockchain network. + # @param asset_id [String] The symbol of the asset to get the validator for. + # @param validator_id [String] The unique id of the validator to fetch details for. + # @param [Hash] opts the optional parameters + # @return [Array<(Validator, Integer, Hash)>] Validator data, response status code and response headers + def get_validator_with_http_info(network_id, asset_id, validator_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: StakeApi.get_validator ...' + end + # verify the required parameter 'network_id' is set + if @api_client.config.client_side_validation && network_id.nil? + fail ArgumentError, "Missing the required parameter 'network_id' when calling StakeApi.get_validator" + end + # verify the required parameter 'asset_id' is set + if @api_client.config.client_side_validation && asset_id.nil? + fail ArgumentError, "Missing the required parameter 'asset_id' when calling StakeApi.get_validator" + end + # verify the required parameter 'validator_id' is set + if @api_client.config.client_side_validation && validator_id.nil? + fail ArgumentError, "Missing the required parameter 'validator_id' when calling StakeApi.get_validator" + end + # resource path + local_var_path = '/v1/networks/{network_id}/assets/{asset_id}/validators/{validator_id}'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_id.to_s)).sub('{' + 'validator_id' + '}', CGI.escape(validator_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Validator' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"StakeApi.get_validator", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: StakeApi#get_validator\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List validators belonging to the CDP project + # List validators belonging to the user for a given network and asset. + # @param network_id [String] The ID of the blockchain network. + # @param asset_id [String] The symbol of the asset to get the validators for. + # @param [Hash] opts the optional parameters + # @option opts [ValidatorStatus] :status A filter to list validators based on a status. + # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. + # @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. + # @return [ValidatorList] + def list_validators(network_id, asset_id, opts = {}) + data, _status_code, _headers = list_validators_with_http_info(network_id, asset_id, opts) + data + end + + # List validators belonging to the CDP project + # List validators belonging to the user for a given network and asset. + # @param network_id [String] The ID of the blockchain network. + # @param asset_id [String] The symbol of the asset to get the validators for. + # @param [Hash] opts the optional parameters + # @option opts [ValidatorStatus] :status A filter to list validators based on a status. + # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. + # @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. + # @return [Array<(ValidatorList, Integer, Hash)>] ValidatorList data, response status code and response headers + def list_validators_with_http_info(network_id, asset_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: StakeApi.list_validators ...' + end + # verify the required parameter 'network_id' is set + if @api_client.config.client_side_validation && network_id.nil? + fail ArgumentError, "Missing the required parameter 'network_id' when calling StakeApi.list_validators" + end + # verify the required parameter 'asset_id' is set + if @api_client.config.client_side_validation && asset_id.nil? + fail ArgumentError, "Missing the required parameter 'asset_id' when calling StakeApi.list_validators" + end + if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000 + fail ArgumentError, 'invalid value for "opts[:"page"]" when calling StakeApi.list_validators, the character length must be smaller than or equal to 5000.' + end + + # resource path + local_var_path = '/v1/networks/{network_id}/assets/{asset_id}/validators'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ValidatorList' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"StakeApi.list_validators", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: StakeApi#list_validators\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/coinbase/client/api/trades_api.rb b/lib/coinbase/client/api/trades_api.rb index 7431cd30..e4e13d8b 100644 --- a/lib/coinbase/client/api/trades_api.rb +++ b/lib/coinbase/client/api/trades_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/transaction_history_api.rb b/lib/coinbase/client/api/transaction_history_api.rb index 296ed051..64af84e3 100644 --- a/lib/coinbase/client/api/transaction_history_api.rb +++ b/lib/coinbase/client/api/transaction_history_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/transfers_api.rb b/lib/coinbase/client/api/transfers_api.rb index 2305439a..0d18b905 100644 --- a/lib/coinbase/client/api/transfers_api.rb +++ b/lib/coinbase/client/api/transfers_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/users_api.rb b/lib/coinbase/client/api/users_api.rb index 16989b87..b2fbe00e 100644 --- a/lib/coinbase/client/api/users_api.rb +++ b/lib/coinbase/client/api/users_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/validators_api.rb b/lib/coinbase/client/api/validators_api.rb deleted file mode 100644 index a9dd21fc..00000000 --- a/lib/coinbase/client/api/validators_api.rb +++ /dev/null @@ -1,179 +0,0 @@ -=begin -#Coinbase Platform API - -#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. - -The version of the OpenAPI document: 0.0.1-alpha - -Generated by: https://openapi-generator.tech -Generator version: 7.8.0 - -=end - -require 'cgi' - -module Coinbase::Client - class ValidatorsApi - attr_accessor :api_client - - def initialize(api_client = ApiClient.default) - @api_client = api_client - end - # Get a validator belonging to the CDP project - # Get a validator belonging to the user for a given network, asset and id. - # @param network_id [String] The ID of the blockchain network. - # @param asset_id [String] The symbol of the asset to get the validator for. - # @param validator_id [String] The unique id of the validator to fetch details for. - # @param [Hash] opts the optional parameters - # @return [Validator] - def get_validator(network_id, asset_id, validator_id, opts = {}) - data, _status_code, _headers = get_validator_with_http_info(network_id, asset_id, validator_id, opts) - data - end - - # Get a validator belonging to the CDP project - # Get a validator belonging to the user for a given network, asset and id. - # @param network_id [String] The ID of the blockchain network. - # @param asset_id [String] The symbol of the asset to get the validator for. - # @param validator_id [String] The unique id of the validator to fetch details for. - # @param [Hash] opts the optional parameters - # @return [Array<(Validator, Integer, Hash)>] Validator data, response status code and response headers - def get_validator_with_http_info(network_id, asset_id, validator_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ValidatorsApi.get_validator ...' - end - # verify the required parameter 'network_id' is set - if @api_client.config.client_side_validation && network_id.nil? - fail ArgumentError, "Missing the required parameter 'network_id' when calling ValidatorsApi.get_validator" - end - # verify the required parameter 'asset_id' is set - if @api_client.config.client_side_validation && asset_id.nil? - fail ArgumentError, "Missing the required parameter 'asset_id' when calling ValidatorsApi.get_validator" - end - # verify the required parameter 'validator_id' is set - if @api_client.config.client_side_validation && validator_id.nil? - fail ArgumentError, "Missing the required parameter 'validator_id' when calling ValidatorsApi.get_validator" - end - # resource path - local_var_path = '/v1/networks/{network_id}/assets/{asset_id}/validators/{validator_id}'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_id.to_s)).sub('{' + 'validator_id' + '}', CGI.escape(validator_id.to_s)) - - # query parameters - query_params = opts[:query_params] || {} - - # header parameters - header_params = opts[:header_params] || {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] - - # form parameters - form_params = opts[:form_params] || {} - - # http body (model) - post_body = opts[:debug_body] - - # return_type - return_type = opts[:debug_return_type] || 'Validator' - - # auth_names - auth_names = opts[:debug_auth_names] || [] - - new_options = opts.merge( - :operation => :"ValidatorsApi.get_validator", - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => return_type - ) - - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ValidatorsApi#get_validator\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - - # List validators belonging to the CDP project - # List validators belonging to the user for a given network and asset. - # @param network_id [String] The ID of the blockchain network. - # @param asset_id [String] The symbol of the asset to get the validators for. - # @param [Hash] opts the optional parameters - # @option opts [ValidatorStatus] :status A filter to list validators based on a status. - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. - # @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. - # @return [ValidatorList] - def list_validators(network_id, asset_id, opts = {}) - data, _status_code, _headers = list_validators_with_http_info(network_id, asset_id, opts) - data - end - - # List validators belonging to the CDP project - # List validators belonging to the user for a given network and asset. - # @param network_id [String] The ID of the blockchain network. - # @param asset_id [String] The symbol of the asset to get the validators for. - # @param [Hash] opts the optional parameters - # @option opts [ValidatorStatus] :status A filter to list validators based on a status. - # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. - # @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. - # @return [Array<(ValidatorList, Integer, Hash)>] ValidatorList data, response status code and response headers - def list_validators_with_http_info(network_id, asset_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ValidatorsApi.list_validators ...' - end - # verify the required parameter 'network_id' is set - if @api_client.config.client_side_validation && network_id.nil? - fail ArgumentError, "Missing the required parameter 'network_id' when calling ValidatorsApi.list_validators" - end - # verify the required parameter 'asset_id' is set - if @api_client.config.client_side_validation && asset_id.nil? - fail ArgumentError, "Missing the required parameter 'asset_id' when calling ValidatorsApi.list_validators" - end - if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000 - fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ValidatorsApi.list_validators, the character length must be smaller than or equal to 5000.' - end - - # resource path - local_var_path = '/v1/networks/{network_id}/assets/{asset_id}/validators'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_id.to_s)) - - # query parameters - query_params = opts[:query_params] || {} - query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? - query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? - query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? - - # header parameters - header_params = opts[:header_params] || {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] - - # form parameters - form_params = opts[:form_params] || {} - - # http body (model) - post_body = opts[:debug_body] - - # return_type - return_type = opts[:debug_return_type] || 'ValidatorList' - - # auth_names - auth_names = opts[:debug_auth_names] || [] - - new_options = opts.merge( - :operation => :"ValidatorsApi.list_validators", - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => return_type - ) - - data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ValidatorsApi#list_validators\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - end -end diff --git a/lib/coinbase/client/api/wallets_api.rb b/lib/coinbase/client/api/wallets_api.rb index a9f05343..485495cb 100644 --- a/lib/coinbase/client/api/wallets_api.rb +++ b/lib/coinbase/client/api/wallets_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api/webhooks_api.rb b/lib/coinbase/client/api/webhooks_api.rb index 7e225605..eba94e66 100644 --- a/lib/coinbase/client/api/webhooks_api.rb +++ b/lib/coinbase/client/api/webhooks_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api_client.rb b/lib/coinbase/client/api_client.rb index d9e2d924..5351423f 100644 --- a/lib/coinbase/client/api_client.rb +++ b/lib/coinbase/client/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/api_error.rb b/lib/coinbase/client/api_error.rb index 9dc0c8ac..71136cbe 100644 --- a/lib/coinbase/client/api_error.rb +++ b/lib/coinbase/client/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/configuration.rb b/lib/coinbase/client/configuration.rb index 99b43b9f..252fdc88 100644 --- a/lib/coinbase/client/configuration.rb +++ b/lib/coinbase/client/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/address.rb b/lib/coinbase/client/models/address.rb index 318294bb..7e2d230a 100644 --- a/lib/coinbase/client/models/address.rb +++ b/lib/coinbase/client/models/address.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/address_balance_list.rb b/lib/coinbase/client/models/address_balance_list.rb index 1eea0f0b..5f31e5d7 100644 --- a/lib/coinbase/client/models/address_balance_list.rb +++ b/lib/coinbase/client/models/address_balance_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/address_historical_balance_list.rb b/lib/coinbase/client/models/address_historical_balance_list.rb index ba326139..df3e91e8 100644 --- a/lib/coinbase/client/models/address_historical_balance_list.rb +++ b/lib/coinbase/client/models/address_historical_balance_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/address_list.rb b/lib/coinbase/client/models/address_list.rb index 8ba46521..641df5e7 100644 --- a/lib/coinbase/client/models/address_list.rb +++ b/lib/coinbase/client/models/address_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/address_reputation.rb b/lib/coinbase/client/models/address_reputation.rb new file mode 100644 index 00000000..a8a6b7de --- /dev/null +++ b/lib/coinbase/client/models/address_reputation.rb @@ -0,0 +1,232 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha + +Generated by: https://openapi-generator.tech +Generator version: 7.9.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # The reputation score with metadata of a blockchain address. + class AddressReputation + # The reputation score of a wallet address which lie between 0 to 100. + attr_accessor :reputation_score + + attr_accessor :metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reputation_score' => :'reputation_score', + :'metadata' => :'metadata' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reputation_score' => :'Integer', + :'metadata' => :'AddressReputationMetadata' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::AddressReputation` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::AddressReputation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reputation_score') + self.reputation_score = attributes[:'reputation_score'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + else + self.metadata = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @metadata.nil? + invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @metadata.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reputation_score == o.reputation_score && + metadata == o.metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reputation_score, metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/address_reputation_metadata.rb b/lib/coinbase/client/models/address_reputation_metadata.rb new file mode 100644 index 00000000..36c7bf44 --- /dev/null +++ b/lib/coinbase/client/models/address_reputation_metadata.rb @@ -0,0 +1,376 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha + +Generated by: https://openapi-generator.tech +Generator version: 7.9.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # The metadata for the reputation score of onchain address. + class AddressReputationMetadata + # The total number of transactions performed by the address. + attr_accessor :total_transactions + + # The number of unique days the address was active. + attr_accessor :unique_days_active + + # The longest streak of consecutive active days. + attr_accessor :longest_active_streak + + # The current streak of consecutive active days. + attr_accessor :current_active_streak + + # The total number of days the address has been active. + attr_accessor :activity_period_days + + # The number of token swaps performed by the address. + attr_accessor :token_swaps_performed + + # The number of bridge transactions performed by the address. + attr_accessor :bridge_transactions_performed + + # The number of lend, borrow, or stake transactions performed by the address. + attr_accessor :lend_borrow_stake_transactions + + # The number of interactions with ENS contracts. + attr_accessor :ens_contract_interactions + + # The number of smart contracts deployed by the address. + attr_accessor :smart_contract_deployments + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_transactions' => :'total_transactions', + :'unique_days_active' => :'unique_days_active', + :'longest_active_streak' => :'longest_active_streak', + :'current_active_streak' => :'current_active_streak', + :'activity_period_days' => :'activity_period_days', + :'token_swaps_performed' => :'token_swaps_performed', + :'bridge_transactions_performed' => :'bridge_transactions_performed', + :'lend_borrow_stake_transactions' => :'lend_borrow_stake_transactions', + :'ens_contract_interactions' => :'ens_contract_interactions', + :'smart_contract_deployments' => :'smart_contract_deployments' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_transactions' => :'Integer', + :'unique_days_active' => :'Integer', + :'longest_active_streak' => :'Integer', + :'current_active_streak' => :'Integer', + :'activity_period_days' => :'Integer', + :'token_swaps_performed' => :'Integer', + :'bridge_transactions_performed' => :'Integer', + :'lend_borrow_stake_transactions' => :'Integer', + :'ens_contract_interactions' => :'Integer', + :'smart_contract_deployments' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::AddressReputationMetadata` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::AddressReputationMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total_transactions') + self.total_transactions = attributes[:'total_transactions'] + else + self.total_transactions = nil + end + + if attributes.key?(:'unique_days_active') + self.unique_days_active = attributes[:'unique_days_active'] + else + self.unique_days_active = nil + end + + if attributes.key?(:'longest_active_streak') + self.longest_active_streak = attributes[:'longest_active_streak'] + else + self.longest_active_streak = nil + end + + if attributes.key?(:'current_active_streak') + self.current_active_streak = attributes[:'current_active_streak'] + else + self.current_active_streak = nil + end + + if attributes.key?(:'activity_period_days') + self.activity_period_days = attributes[:'activity_period_days'] + else + self.activity_period_days = nil + end + + if attributes.key?(:'token_swaps_performed') + self.token_swaps_performed = attributes[:'token_swaps_performed'] + else + self.token_swaps_performed = nil + end + + if attributes.key?(:'bridge_transactions_performed') + self.bridge_transactions_performed = attributes[:'bridge_transactions_performed'] + else + self.bridge_transactions_performed = nil + end + + if attributes.key?(:'lend_borrow_stake_transactions') + self.lend_borrow_stake_transactions = attributes[:'lend_borrow_stake_transactions'] + else + self.lend_borrow_stake_transactions = nil + end + + if attributes.key?(:'ens_contract_interactions') + self.ens_contract_interactions = attributes[:'ens_contract_interactions'] + else + self.ens_contract_interactions = nil + end + + if attributes.key?(:'smart_contract_deployments') + self.smart_contract_deployments = attributes[:'smart_contract_deployments'] + else + self.smart_contract_deployments = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @total_transactions.nil? + invalid_properties.push('invalid value for "total_transactions", total_transactions cannot be nil.') + end + + if @unique_days_active.nil? + invalid_properties.push('invalid value for "unique_days_active", unique_days_active cannot be nil.') + end + + if @longest_active_streak.nil? + invalid_properties.push('invalid value for "longest_active_streak", longest_active_streak cannot be nil.') + end + + if @current_active_streak.nil? + invalid_properties.push('invalid value for "current_active_streak", current_active_streak cannot be nil.') + end + + if @activity_period_days.nil? + invalid_properties.push('invalid value for "activity_period_days", activity_period_days cannot be nil.') + end + + if @token_swaps_performed.nil? + invalid_properties.push('invalid value for "token_swaps_performed", token_swaps_performed cannot be nil.') + end + + if @bridge_transactions_performed.nil? + invalid_properties.push('invalid value for "bridge_transactions_performed", bridge_transactions_performed cannot be nil.') + end + + if @lend_borrow_stake_transactions.nil? + invalid_properties.push('invalid value for "lend_borrow_stake_transactions", lend_borrow_stake_transactions cannot be nil.') + end + + if @ens_contract_interactions.nil? + invalid_properties.push('invalid value for "ens_contract_interactions", ens_contract_interactions cannot be nil.') + end + + if @smart_contract_deployments.nil? + invalid_properties.push('invalid value for "smart_contract_deployments", smart_contract_deployments cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @total_transactions.nil? + return false if @unique_days_active.nil? + return false if @longest_active_streak.nil? + return false if @current_active_streak.nil? + return false if @activity_period_days.nil? + return false if @token_swaps_performed.nil? + return false if @bridge_transactions_performed.nil? + return false if @lend_borrow_stake_transactions.nil? + return false if @ens_contract_interactions.nil? + return false if @smart_contract_deployments.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_transactions == o.total_transactions && + unique_days_active == o.unique_days_active && + longest_active_streak == o.longest_active_streak && + current_active_streak == o.current_active_streak && + activity_period_days == o.activity_period_days && + token_swaps_performed == o.token_swaps_performed && + bridge_transactions_performed == o.bridge_transactions_performed && + lend_borrow_stake_transactions == o.lend_borrow_stake_transactions && + ens_contract_interactions == o.ens_contract_interactions && + smart_contract_deployments == o.smart_contract_deployments + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_transactions, unique_days_active, longest_active_streak, current_active_streak, activity_period_days, token_swaps_performed, bridge_transactions_performed, lend_borrow_stake_transactions, ens_contract_interactions, smart_contract_deployments].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/address_risk.rb b/lib/coinbase/client/models/address_risk.rb new file mode 100644 index 00000000..570f4385 --- /dev/null +++ b/lib/coinbase/client/models/address_risk.rb @@ -0,0 +1,223 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha + +Generated by: https://openapi-generator.tech +Generator version: 7.9.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # The risk score of a blockchain address. + class AddressRisk + # The lower the score is, the higher the risk is. The score lies between -100 to 0. + attr_accessor :risk_score + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'risk_score' => :'risk_score' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'risk_score' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::AddressRisk` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::AddressRisk`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'risk_score') + self.risk_score = attributes[:'risk_score'] + else + self.risk_score = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @risk_score.nil? + invalid_properties.push('invalid value for "risk_score", risk_score cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @risk_score.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + risk_score == o.risk_score + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [risk_score].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/address_transaction_list.rb b/lib/coinbase/client/models/address_transaction_list.rb index 3c3a4c47..267c87d2 100644 --- a/lib/coinbase/client/models/address_transaction_list.rb +++ b/lib/coinbase/client/models/address_transaction_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/asset.rb b/lib/coinbase/client/models/asset.rb index 175f0f76..b6e16993 100644 --- a/lib/coinbase/client/models/asset.rb +++ b/lib/coinbase/client/models/asset.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/balance.rb b/lib/coinbase/client/models/balance.rb index 08effe27..61badbcc 100644 --- a/lib/coinbase/client/models/balance.rb +++ b/lib/coinbase/client/models/balance.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/broadcast_contract_invocation_request.rb b/lib/coinbase/client/models/broadcast_contract_invocation_request.rb index 8732082a..b69c43cc 100644 --- a/lib/coinbase/client/models/broadcast_contract_invocation_request.rb +++ b/lib/coinbase/client/models/broadcast_contract_invocation_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/broadcast_staking_operation_request.rb b/lib/coinbase/client/models/broadcast_staking_operation_request.rb index b1cb50ca..eb82c471 100644 --- a/lib/coinbase/client/models/broadcast_staking_operation_request.rb +++ b/lib/coinbase/client/models/broadcast_staking_operation_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/broadcast_trade_request.rb b/lib/coinbase/client/models/broadcast_trade_request.rb index 4308a4ff..eb966c65 100644 --- a/lib/coinbase/client/models/broadcast_trade_request.rb +++ b/lib/coinbase/client/models/broadcast_trade_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/broadcast_transfer_request.rb b/lib/coinbase/client/models/broadcast_transfer_request.rb index 390bd005..b68f4be1 100644 --- a/lib/coinbase/client/models/broadcast_transfer_request.rb +++ b/lib/coinbase/client/models/broadcast_transfer_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/build_staking_operation_request.rb b/lib/coinbase/client/models/build_staking_operation_request.rb index 47674491..15ff48c2 100644 --- a/lib/coinbase/client/models/build_staking_operation_request.rb +++ b/lib/coinbase/client/models/build_staking_operation_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end @@ -27,6 +27,7 @@ class BuildStakingOperationRequest # The type of staking operation attr_accessor :action + # Additional options for the staking operation. attr_accessor :options # Attribute mapping from ruby-style variable name to JSON key. diff --git a/lib/coinbase/client/models/contract_event.rb b/lib/coinbase/client/models/contract_event.rb index 221a6b39..1c937363 100644 --- a/lib/coinbase/client/models/contract_event.rb +++ b/lib/coinbase/client/models/contract_event.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/contract_event_list.rb b/lib/coinbase/client/models/contract_event_list.rb index acab7f72..a525dcaf 100644 --- a/lib/coinbase/client/models/contract_event_list.rb +++ b/lib/coinbase/client/models/contract_event_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/contract_invocation.rb b/lib/coinbase/client/models/contract_invocation.rb index 7b33d6af..a785e747 100644 --- a/lib/coinbase/client/models/contract_invocation.rb +++ b/lib/coinbase/client/models/contract_invocation.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/contract_invocation_list.rb b/lib/coinbase/client/models/contract_invocation_list.rb index 3f7056ce..6dc2a133 100644 --- a/lib/coinbase/client/models/contract_invocation_list.rb +++ b/lib/coinbase/client/models/contract_invocation_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_address_request.rb b/lib/coinbase/client/models/create_address_request.rb index 5e7e8f3a..9ee4372b 100644 --- a/lib/coinbase/client/models/create_address_request.rb +++ b/lib/coinbase/client/models/create_address_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_contract_invocation_request.rb b/lib/coinbase/client/models/create_contract_invocation_request.rb index 90f19f32..c4f798ec 100644 --- a/lib/coinbase/client/models/create_contract_invocation_request.rb +++ b/lib/coinbase/client/models/create_contract_invocation_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_fund_operation_request.rb b/lib/coinbase/client/models/create_fund_operation_request.rb index d8fee1ed..aaa57b47 100644 --- a/lib/coinbase/client/models/create_fund_operation_request.rb +++ b/lib/coinbase/client/models/create_fund_operation_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_fund_quote_request.rb b/lib/coinbase/client/models/create_fund_quote_request.rb index 23952537..cf171e84 100644 --- a/lib/coinbase/client/models/create_fund_quote_request.rb +++ b/lib/coinbase/client/models/create_fund_quote_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_payload_signature_request.rb b/lib/coinbase/client/models/create_payload_signature_request.rb index 6d16a516..ec433358 100644 --- a/lib/coinbase/client/models/create_payload_signature_request.rb +++ b/lib/coinbase/client/models/create_payload_signature_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_server_signer_request.rb b/lib/coinbase/client/models/create_server_signer_request.rb index c212b759..e7bf0377 100644 --- a/lib/coinbase/client/models/create_server_signer_request.rb +++ b/lib/coinbase/client/models/create_server_signer_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_smart_contract_request.rb b/lib/coinbase/client/models/create_smart_contract_request.rb index b13eec30..98706287 100644 --- a/lib/coinbase/client/models/create_smart_contract_request.rb +++ b/lib/coinbase/client/models/create_smart_contract_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_staking_operation_request.rb b/lib/coinbase/client/models/create_staking_operation_request.rb index 9a57dc78..2598b4fa 100644 --- a/lib/coinbase/client/models/create_staking_operation_request.rb +++ b/lib/coinbase/client/models/create_staking_operation_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end @@ -24,6 +24,7 @@ class CreateStakingOperationRequest # The type of staking operation. attr_accessor :action + # Additional options for the staking operation. attr_accessor :options # Attribute mapping from ruby-style variable name to JSON key. diff --git a/lib/coinbase/client/models/create_trade_request.rb b/lib/coinbase/client/models/create_trade_request.rb index 9e2a48b8..9dd16d76 100644 --- a/lib/coinbase/client/models/create_trade_request.rb +++ b/lib/coinbase/client/models/create_trade_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_transfer_request.rb b/lib/coinbase/client/models/create_transfer_request.rb index d64c0893..f1798341 100644 --- a/lib/coinbase/client/models/create_transfer_request.rb +++ b/lib/coinbase/client/models/create_transfer_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_wallet_request.rb b/lib/coinbase/client/models/create_wallet_request.rb index 45c26d86..b7dc32ab 100644 --- a/lib/coinbase/client/models/create_wallet_request.rb +++ b/lib/coinbase/client/models/create_wallet_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_wallet_request_wallet.rb b/lib/coinbase/client/models/create_wallet_request_wallet.rb index 0fa7474a..f0d451bc 100644 --- a/lib/coinbase/client/models/create_wallet_request_wallet.rb +++ b/lib/coinbase/client/models/create_wallet_request_wallet.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_wallet_webhook_request.rb b/lib/coinbase/client/models/create_wallet_webhook_request.rb index e094dca2..11febcb8 100644 --- a/lib/coinbase/client/models/create_wallet_webhook_request.rb +++ b/lib/coinbase/client/models/create_wallet_webhook_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/create_webhook_request.rb b/lib/coinbase/client/models/create_webhook_request.rb index 1d0cd454..6db3a98a 100644 --- a/lib/coinbase/client/models/create_webhook_request.rb +++ b/lib/coinbase/client/models/create_webhook_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/crypto_amount.rb b/lib/coinbase/client/models/crypto_amount.rb index 41702fb7..64ab664c 100644 --- a/lib/coinbase/client/models/crypto_amount.rb +++ b/lib/coinbase/client/models/crypto_amount.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/deploy_smart_contract_request.rb b/lib/coinbase/client/models/deploy_smart_contract_request.rb index 9093f371..33e30cdd 100644 --- a/lib/coinbase/client/models/deploy_smart_contract_request.rb +++ b/lib/coinbase/client/models/deploy_smart_contract_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/erc20_transfer_event.rb b/lib/coinbase/client/models/erc20_transfer_event.rb index 47836dc9..e91d7efa 100644 --- a/lib/coinbase/client/models/erc20_transfer_event.rb +++ b/lib/coinbase/client/models/erc20_transfer_event.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/erc721_transfer_event.rb b/lib/coinbase/client/models/erc721_transfer_event.rb index 6864298c..30089b4a 100644 --- a/lib/coinbase/client/models/erc721_transfer_event.rb +++ b/lib/coinbase/client/models/erc721_transfer_event.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/error.rb b/lib/coinbase/client/models/error.rb index ecd035e8..f47f1801 100644 --- a/lib/coinbase/client/models/error.rb +++ b/lib/coinbase/client/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/ethereum_token_transfer.rb b/lib/coinbase/client/models/ethereum_token_transfer.rb index f3f904cc..87de3bcf 100644 --- a/lib/coinbase/client/models/ethereum_token_transfer.rb +++ b/lib/coinbase/client/models/ethereum_token_transfer.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/ethereum_transaction.rb b/lib/coinbase/client/models/ethereum_transaction.rb index 12820663..d426fa76 100644 --- a/lib/coinbase/client/models/ethereum_transaction.rb +++ b/lib/coinbase/client/models/ethereum_transaction.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/ethereum_transaction_access.rb b/lib/coinbase/client/models/ethereum_transaction_access.rb index 5b452abf..3e0680db 100644 --- a/lib/coinbase/client/models/ethereum_transaction_access.rb +++ b/lib/coinbase/client/models/ethereum_transaction_access.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/ethereum_transaction_access_list.rb b/lib/coinbase/client/models/ethereum_transaction_access_list.rb index 1b43540a..f40537f2 100644 --- a/lib/coinbase/client/models/ethereum_transaction_access_list.rb +++ b/lib/coinbase/client/models/ethereum_transaction_access_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb b/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb index e8355a4d..630164ed 100644 --- a/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb +++ b/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/ethereum_validator_metadata.rb b/lib/coinbase/client/models/ethereum_validator_metadata.rb index 54aee44b..9de82e96 100644 --- a/lib/coinbase/client/models/ethereum_validator_metadata.rb +++ b/lib/coinbase/client/models/ethereum_validator_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/faucet_transaction.rb b/lib/coinbase/client/models/faucet_transaction.rb index d607f53c..87a7a266 100644 --- a/lib/coinbase/client/models/faucet_transaction.rb +++ b/lib/coinbase/client/models/faucet_transaction.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/feature_set.rb b/lib/coinbase/client/models/feature_set.rb index f85ed0d8..87eb5778 100644 --- a/lib/coinbase/client/models/feature_set.rb +++ b/lib/coinbase/client/models/feature_set.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb b/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb index 7d47744d..a84af518 100644 --- a/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +++ b/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/fetch_staking_rewards200_response.rb b/lib/coinbase/client/models/fetch_staking_rewards200_response.rb index 3bc39dec..04684e23 100644 --- a/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +++ b/lib/coinbase/client/models/fetch_staking_rewards200_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/fetch_staking_rewards_request.rb b/lib/coinbase/client/models/fetch_staking_rewards_request.rb index c8290f91..b17046f8 100644 --- a/lib/coinbase/client/models/fetch_staking_rewards_request.rb +++ b/lib/coinbase/client/models/fetch_staking_rewards_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/fiat_amount.rb b/lib/coinbase/client/models/fiat_amount.rb index 6fcbfc40..d2782bd7 100644 --- a/lib/coinbase/client/models/fiat_amount.rb +++ b/lib/coinbase/client/models/fiat_amount.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/fund_operation.rb b/lib/coinbase/client/models/fund_operation.rb index 9c6ea439..2c797907 100644 --- a/lib/coinbase/client/models/fund_operation.rb +++ b/lib/coinbase/client/models/fund_operation.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/fund_operation_fees.rb b/lib/coinbase/client/models/fund_operation_fees.rb index f27416e9..99bcd0d1 100644 --- a/lib/coinbase/client/models/fund_operation_fees.rb +++ b/lib/coinbase/client/models/fund_operation_fees.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/fund_operation_list.rb b/lib/coinbase/client/models/fund_operation_list.rb index 2e25b453..c7789dad 100644 --- a/lib/coinbase/client/models/fund_operation_list.rb +++ b/lib/coinbase/client/models/fund_operation_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/fund_quote.rb b/lib/coinbase/client/models/fund_quote.rb index 7e867d0f..07eaf115 100644 --- a/lib/coinbase/client/models/fund_quote.rb +++ b/lib/coinbase/client/models/fund_quote.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/get_staking_context_request.rb b/lib/coinbase/client/models/get_staking_context_request.rb index 71718d40..5edda018 100644 --- a/lib/coinbase/client/models/get_staking_context_request.rb +++ b/lib/coinbase/client/models/get_staking_context_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end @@ -24,6 +24,7 @@ class GetStakingContextRequest # The onchain address for which the staking context is being fetched attr_accessor :address_id + # Additional options for getting the staking context. This typically includes network specific fields. attr_accessor :options # Attribute mapping from ruby-style variable name to JSON key. diff --git a/lib/coinbase/client/models/historical_balance.rb b/lib/coinbase/client/models/historical_balance.rb index 55f66a2d..fc88f20f 100644 --- a/lib/coinbase/client/models/historical_balance.rb +++ b/lib/coinbase/client/models/historical_balance.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/multi_token_contract_options.rb b/lib/coinbase/client/models/multi_token_contract_options.rb index 8f955667..abab258f 100644 --- a/lib/coinbase/client/models/multi_token_contract_options.rb +++ b/lib/coinbase/client/models/multi_token_contract_options.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/network.rb b/lib/coinbase/client/models/network.rb index 73c4eccb..d66729ab 100644 --- a/lib/coinbase/client/models/network.rb +++ b/lib/coinbase/client/models/network.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/network_identifier.rb b/lib/coinbase/client/models/network_identifier.rb index 3dc097b5..bdd04ba7 100644 --- a/lib/coinbase/client/models/network_identifier.rb +++ b/lib/coinbase/client/models/network_identifier.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/nft_contract_options.rb b/lib/coinbase/client/models/nft_contract_options.rb index 2f05c3ee..142d245c 100644 --- a/lib/coinbase/client/models/nft_contract_options.rb +++ b/lib/coinbase/client/models/nft_contract_options.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/onchain_name.rb b/lib/coinbase/client/models/onchain_name.rb index b4c04f45..1dd86d45 100644 --- a/lib/coinbase/client/models/onchain_name.rb +++ b/lib/coinbase/client/models/onchain_name.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/onchain_name_list.rb b/lib/coinbase/client/models/onchain_name_list.rb index 974c452b..57b72eb0 100644 --- a/lib/coinbase/client/models/onchain_name_list.rb +++ b/lib/coinbase/client/models/onchain_name_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/payload_signature.rb b/lib/coinbase/client/models/payload_signature.rb index 548f2631..fe9df04f 100644 --- a/lib/coinbase/client/models/payload_signature.rb +++ b/lib/coinbase/client/models/payload_signature.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/payload_signature_list.rb b/lib/coinbase/client/models/payload_signature_list.rb index 199f2d0d..ea692d0f 100644 --- a/lib/coinbase/client/models/payload_signature_list.rb +++ b/lib/coinbase/client/models/payload_signature_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/read_contract_request.rb b/lib/coinbase/client/models/read_contract_request.rb index 9e4ec52e..723093c3 100644 --- a/lib/coinbase/client/models/read_contract_request.rb +++ b/lib/coinbase/client/models/read_contract_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/seed_creation_event.rb b/lib/coinbase/client/models/seed_creation_event.rb index 7f90729a..a2f474f2 100644 --- a/lib/coinbase/client/models/seed_creation_event.rb +++ b/lib/coinbase/client/models/seed_creation_event.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/seed_creation_event_result.rb b/lib/coinbase/client/models/seed_creation_event_result.rb index 1f3d8f53..a6c79557 100644 --- a/lib/coinbase/client/models/seed_creation_event_result.rb +++ b/lib/coinbase/client/models/seed_creation_event_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/server_signer.rb b/lib/coinbase/client/models/server_signer.rb index 0d8765cd..9f405018 100644 --- a/lib/coinbase/client/models/server_signer.rb +++ b/lib/coinbase/client/models/server_signer.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/server_signer_event.rb b/lib/coinbase/client/models/server_signer_event.rb index 7927c499..24e02c85 100644 --- a/lib/coinbase/client/models/server_signer_event.rb +++ b/lib/coinbase/client/models/server_signer_event.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/server_signer_event_event.rb b/lib/coinbase/client/models/server_signer_event_event.rb index 1c9bd8e8..7fbe5236 100644 --- a/lib/coinbase/client/models/server_signer_event_event.rb +++ b/lib/coinbase/client/models/server_signer_event_event.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/server_signer_event_list.rb b/lib/coinbase/client/models/server_signer_event_list.rb index 184f7929..91fb04da 100644 --- a/lib/coinbase/client/models/server_signer_event_list.rb +++ b/lib/coinbase/client/models/server_signer_event_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/server_signer_list.rb b/lib/coinbase/client/models/server_signer_list.rb index 36d86cae..bf15e068 100644 --- a/lib/coinbase/client/models/server_signer_list.rb +++ b/lib/coinbase/client/models/server_signer_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/signature_creation_event.rb b/lib/coinbase/client/models/signature_creation_event.rb index 3b734dfc..65749713 100644 --- a/lib/coinbase/client/models/signature_creation_event.rb +++ b/lib/coinbase/client/models/signature_creation_event.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/signature_creation_event_result.rb b/lib/coinbase/client/models/signature_creation_event_result.rb index 61c7a7a5..fed1aeb5 100644 --- a/lib/coinbase/client/models/signature_creation_event_result.rb +++ b/lib/coinbase/client/models/signature_creation_event_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb b/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb index 2fe22ccb..ee090ba8 100644 --- a/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +++ b/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/smart_contract.rb b/lib/coinbase/client/models/smart_contract.rb index b0d34525..9c8a3621 100644 --- a/lib/coinbase/client/models/smart_contract.rb +++ b/lib/coinbase/client/models/smart_contract.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/smart_contract_list.rb b/lib/coinbase/client/models/smart_contract_list.rb index af2e0608..a0e95b5d 100644 --- a/lib/coinbase/client/models/smart_contract_list.rb +++ b/lib/coinbase/client/models/smart_contract_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/smart_contract_options.rb b/lib/coinbase/client/models/smart_contract_options.rb index 185deeab..4ca54860 100644 --- a/lib/coinbase/client/models/smart_contract_options.rb +++ b/lib/coinbase/client/models/smart_contract_options.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/smart_contract_type.rb b/lib/coinbase/client/models/smart_contract_type.rb index 5b37d235..3d0f0bfd 100644 --- a/lib/coinbase/client/models/smart_contract_type.rb +++ b/lib/coinbase/client/models/smart_contract_type.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/solidity_value.rb b/lib/coinbase/client/models/solidity_value.rb index 39533e27..ee688923 100644 --- a/lib/coinbase/client/models/solidity_value.rb +++ b/lib/coinbase/client/models/solidity_value.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end @@ -132,7 +132,7 @@ def list_invalid_properties def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @type.nil? - type_validator = EnumAttributeValidator.new('String', ["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int8", "int16", "int32", "int64", "int128", "int256", "address", "bool", "string", "bytes", "bytes1", "bytes2", "bytes3", "bytes4", "bytes5", "bytes6", "bytes7", "bytes8", "bytes9", "bytes10", "bytes11", "bytes12", "bytes13", "bytes14", "bytes15", "bytes16", "bytes17", "bytes18", "bytes19", "bytes20", "bytes21", "bytes22", "bytes23", "bytes24", "bytes25", "bytes26", "bytes27", "bytes28", "bytes29", "bytes30", "bytes31", "bytes32", "array", "tuple", "unknown_default_open_api"]) + type_validator = EnumAttributeValidator.new('String', ["uint8", "uint16", "uint32", "uint64", "uint128", "uint160", "uint256", "int8", "int16", "int24", "int32", "int56", "int64", "int128", "int256", "address", "bool", "string", "bytes", "bytes1", "bytes2", "bytes3", "bytes4", "bytes5", "bytes6", "bytes7", "bytes8", "bytes9", "bytes10", "bytes11", "bytes12", "bytes13", "bytes14", "bytes15", "bytes16", "bytes17", "bytes18", "bytes19", "bytes20", "bytes21", "bytes22", "bytes23", "bytes24", "bytes25", "bytes26", "bytes27", "bytes28", "bytes29", "bytes30", "bytes31", "bytes32", "array", "tuple", "unknown_default_open_api"]) return false unless type_validator.valid?(@type) true end @@ -140,7 +140,7 @@ def valid? # Custom attribute writer method checking allowed values (enum). # @param [Object] type Object to be assigned def type=(type) - validator = EnumAttributeValidator.new('String', ["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int8", "int16", "int32", "int64", "int128", "int256", "address", "bool", "string", "bytes", "bytes1", "bytes2", "bytes3", "bytes4", "bytes5", "bytes6", "bytes7", "bytes8", "bytes9", "bytes10", "bytes11", "bytes12", "bytes13", "bytes14", "bytes15", "bytes16", "bytes17", "bytes18", "bytes19", "bytes20", "bytes21", "bytes22", "bytes23", "bytes24", "bytes25", "bytes26", "bytes27", "bytes28", "bytes29", "bytes30", "bytes31", "bytes32", "array", "tuple", "unknown_default_open_api"]) + validator = EnumAttributeValidator.new('String', ["uint8", "uint16", "uint32", "uint64", "uint128", "uint160", "uint256", "int8", "int16", "int24", "int32", "int56", "int64", "int128", "int256", "address", "bool", "string", "bytes", "bytes1", "bytes2", "bytes3", "bytes4", "bytes5", "bytes6", "bytes7", "bytes8", "bytes9", "bytes10", "bytes11", "bytes12", "bytes13", "bytes14", "bytes15", "bytes16", "bytes17", "bytes18", "bytes19", "bytes20", "bytes21", "bytes22", "bytes23", "bytes24", "bytes25", "bytes26", "bytes27", "bytes28", "bytes29", "bytes30", "bytes31", "bytes32", "array", "tuple", "unknown_default_open_api"]) unless validator.valid?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." end diff --git a/lib/coinbase/client/models/sponsored_send.rb b/lib/coinbase/client/models/sponsored_send.rb index f181dcb1..3621c9a1 100644 --- a/lib/coinbase/client/models/sponsored_send.rb +++ b/lib/coinbase/client/models/sponsored_send.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/staking_balance.rb b/lib/coinbase/client/models/staking_balance.rb index 13a30e05..8138b63b 100644 --- a/lib/coinbase/client/models/staking_balance.rb +++ b/lib/coinbase/client/models/staking_balance.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/staking_context.rb b/lib/coinbase/client/models/staking_context.rb index 33fd9489..886b9168 100644 --- a/lib/coinbase/client/models/staking_context.rb +++ b/lib/coinbase/client/models/staking_context.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/staking_context_context.rb b/lib/coinbase/client/models/staking_context_context.rb index 3b33225d..e30e967b 100644 --- a/lib/coinbase/client/models/staking_context_context.rb +++ b/lib/coinbase/client/models/staking_context_context.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/staking_operation.rb b/lib/coinbase/client/models/staking_operation.rb index bc9c6b03..957ee980 100644 --- a/lib/coinbase/client/models/staking_operation.rb +++ b/lib/coinbase/client/models/staking_operation.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/staking_operation_metadata.rb b/lib/coinbase/client/models/staking_operation_metadata.rb index 0331074c..fe363328 100644 --- a/lib/coinbase/client/models/staking_operation_metadata.rb +++ b/lib/coinbase/client/models/staking_operation_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/staking_reward.rb b/lib/coinbase/client/models/staking_reward.rb index 22a9e3bd..a0294853 100644 --- a/lib/coinbase/client/models/staking_reward.rb +++ b/lib/coinbase/client/models/staking_reward.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/staking_reward_format.rb b/lib/coinbase/client/models/staking_reward_format.rb index b39b1f1a..0192ebf1 100644 --- a/lib/coinbase/client/models/staking_reward_format.rb +++ b/lib/coinbase/client/models/staking_reward_format.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/staking_reward_usd_value.rb b/lib/coinbase/client/models/staking_reward_usd_value.rb index f17be285..fe302155 100644 --- a/lib/coinbase/client/models/staking_reward_usd_value.rb +++ b/lib/coinbase/client/models/staking_reward_usd_value.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/token_contract_options.rb b/lib/coinbase/client/models/token_contract_options.rb index 8042abec..23f4f283 100644 --- a/lib/coinbase/client/models/token_contract_options.rb +++ b/lib/coinbase/client/models/token_contract_options.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/token_transfer_type.rb b/lib/coinbase/client/models/token_transfer_type.rb index 15e57153..f11a7e5a 100644 --- a/lib/coinbase/client/models/token_transfer_type.rb +++ b/lib/coinbase/client/models/token_transfer_type.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/trade.rb b/lib/coinbase/client/models/trade.rb index b55b9f6f..4623a974 100644 --- a/lib/coinbase/client/models/trade.rb +++ b/lib/coinbase/client/models/trade.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/trade_list.rb b/lib/coinbase/client/models/trade_list.rb index 71d1c47e..b2753265 100644 --- a/lib/coinbase/client/models/trade_list.rb +++ b/lib/coinbase/client/models/trade_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/transaction.rb b/lib/coinbase/client/models/transaction.rb index d276560c..c28c5b8f 100644 --- a/lib/coinbase/client/models/transaction.rb +++ b/lib/coinbase/client/models/transaction.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/transaction_content.rb b/lib/coinbase/client/models/transaction_content.rb index 9e95d51f..470b9689 100644 --- a/lib/coinbase/client/models/transaction_content.rb +++ b/lib/coinbase/client/models/transaction_content.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/transaction_type.rb b/lib/coinbase/client/models/transaction_type.rb index 40ae87fd..076605ec 100644 --- a/lib/coinbase/client/models/transaction_type.rb +++ b/lib/coinbase/client/models/transaction_type.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/transfer.rb b/lib/coinbase/client/models/transfer.rb index c27da9d7..7a0123e8 100644 --- a/lib/coinbase/client/models/transfer.rb +++ b/lib/coinbase/client/models/transfer.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/transfer_list.rb b/lib/coinbase/client/models/transfer_list.rb index 3570d698..4ff23e36 100644 --- a/lib/coinbase/client/models/transfer_list.rb +++ b/lib/coinbase/client/models/transfer_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/update_webhook_request.rb b/lib/coinbase/client/models/update_webhook_request.rb index 0c57a282..25c850d5 100644 --- a/lib/coinbase/client/models/update_webhook_request.rb +++ b/lib/coinbase/client/models/update_webhook_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/user.rb b/lib/coinbase/client/models/user.rb index 8def38f5..1457faa5 100644 --- a/lib/coinbase/client/models/user.rb +++ b/lib/coinbase/client/models/user.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/validator.rb b/lib/coinbase/client/models/validator.rb index c798bcfc..4984b6a1 100644 --- a/lib/coinbase/client/models/validator.rb +++ b/lib/coinbase/client/models/validator.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/validator_details.rb b/lib/coinbase/client/models/validator_details.rb index 992c6f39..9ab1bde6 100644 --- a/lib/coinbase/client/models/validator_details.rb +++ b/lib/coinbase/client/models/validator_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/validator_list.rb b/lib/coinbase/client/models/validator_list.rb index 5152eb64..8a99dcaf 100644 --- a/lib/coinbase/client/models/validator_list.rb +++ b/lib/coinbase/client/models/validator_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/validator_status.rb b/lib/coinbase/client/models/validator_status.rb index 51a12293..86c17282 100644 --- a/lib/coinbase/client/models/validator_status.rb +++ b/lib/coinbase/client/models/validator_status.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/wallet.rb b/lib/coinbase/client/models/wallet.rb index 84124f48..85f0a6f2 100644 --- a/lib/coinbase/client/models/wallet.rb +++ b/lib/coinbase/client/models/wallet.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/wallet_list.rb b/lib/coinbase/client/models/wallet_list.rb index 7b2e7976..11e2565e 100644 --- a/lib/coinbase/client/models/wallet_list.rb +++ b/lib/coinbase/client/models/wallet_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/webhook.rb b/lib/coinbase/client/models/webhook.rb index d7e47de9..ca3d666b 100644 --- a/lib/coinbase/client/models/webhook.rb +++ b/lib/coinbase/client/models/webhook.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/webhook_event_filter.rb b/lib/coinbase/client/models/webhook_event_filter.rb index a22eeff6..204b1496 100644 --- a/lib/coinbase/client/models/webhook_event_filter.rb +++ b/lib/coinbase/client/models/webhook_event_filter.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/webhook_event_type.rb b/lib/coinbase/client/models/webhook_event_type.rb index f3a6e1e2..df57b98c 100644 --- a/lib/coinbase/client/models/webhook_event_type.rb +++ b/lib/coinbase/client/models/webhook_event_type.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/webhook_event_type_filter.rb b/lib/coinbase/client/models/webhook_event_type_filter.rb index b4990f60..7e6dcbd2 100644 --- a/lib/coinbase/client/models/webhook_event_type_filter.rb +++ b/lib/coinbase/client/models/webhook_event_type_filter.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/webhook_list.rb b/lib/coinbase/client/models/webhook_list.rb index 53020130..6b575061 100644 --- a/lib/coinbase/client/models/webhook_list.rb +++ b/lib/coinbase/client/models/webhook_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/models/webhook_wallet_activity_filter.rb b/lib/coinbase/client/models/webhook_wallet_activity_filter.rb index 9448e09b..1f70afa4 100644 --- a/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +++ b/lib/coinbase/client/models/webhook_wallet_activity_filter.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/client/version.rb b/lib/coinbase/client/version.rb index 8637593f..0eff73f9 100644 --- a/lib/coinbase/client/version.rb +++ b/lib/coinbase/client/version.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.0.1-alpha Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.9.0 =end diff --git a/lib/coinbase/crypto_amount.rb b/lib/coinbase/crypto_amount.rb new file mode 100644 index 00000000..be6037d2 --- /dev/null +++ b/lib/coinbase/crypto_amount.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +module Coinbase + # A representation of a CryptoAmount that includes the amount and asset. + class CryptoAmount + # Converts a Coinbase::Client::CryptoAmount model to a Coinbase::CryptoAmount + # @param amount_model [Coinbase::Client::CryptoAmount] The crypto amount from the API. + # @return [CryptoAmount] The converted CryptoAmount object. + def self.from_model(amount_model) + asset = Coinbase::Asset.from_model(amount_model.asset) + + new(amount: asset.from_atomic_amount(amount_model.amount), asset: asset) + end + + # Converts a Coinbase::Client::CryptoAmount model and asset ID to a Coinbase::CryptoAmount + # This can be used to specify a non-primary denomination that we want the amount + # to be converted to. + # @param amount_model [Coinbase::Client::CryptoAmount] The crypto amount from the API. + # @param asset_id [Symbol] The Asset ID of the denomination we want returned. + # @return [CryptoAmount] The converted CryptoAmount object. + def self.from_model_and_asset_id(amount_model, asset_id) + asset = Coinbase::Asset.from_model(amount_model.asset, asset_id: asset_id) + + new( + amount: asset.from_atomic_amount(amount_model.amount), + asset: asset, + asset_id: asset_id + ) + end + + # Returns a new CryptoAmount object. Do not use this method. + # Instead, use CryptoAmount.from_model or CryptoAmount.from_model_and_asset_id. + # @param amount [BigDecimal] The amount of the Asset + # @param asset [Coinbase::Asset] The Asset + # @param asset_id [Symbol] The Asset ID + def initialize(amount:, asset:, asset_id: nil) + @amount = amount + @asset = asset + @asset_id = asset_id || asset.asset_id + end + + attr_reader :amount, :asset, :asset_id + + # Returns the amount in atomic units. + # @return [BigDecimal] the amount in atomic units + def to_atomic_amount + asset.to_atomic_amount(amount) + end + + # Returns a string representation of the CryptoAmount. + # @return [String] a string representation of the CryptoAmount + def to_s + Coinbase.pretty_print_object(self.class, amount: amount.to_s('F'), asset_id: asset_id) + end + + # Same as to_s. + # @return [String] a string representation of the CryptoAmount + def inspect + to_s + end + end +end diff --git a/lib/coinbase/fiat_amount.rb b/lib/coinbase/fiat_amount.rb new file mode 100644 index 00000000..6ebb2790 --- /dev/null +++ b/lib/coinbase/fiat_amount.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module Coinbase + # A representation of a FiatAmount that includes the amount and fiat. + class FiatAmount + # Converts a Coinbase::Client::FiatAmount model to a Coinbase::FiatAmount + # @param model [Coinbase::Client::FiatAmount] The crypto amount from the API. + # @return [FiatAmount] The converted FiatAmount object. + def self.from_model(model) + unless model.is_a?(Coinbase::Client::FiatAmount) + raise ArgumentError, + 'model must be a Coinbase::Client::FiatAmount' + end + + new(amount: model.amount, currency: model.currency) + end + + # Returns a new FiatAmount object. + # @param amount [BigDecimal, String] The amount of the Fiat Currency + # @param currency [Symbol, String] The currency of the Fiat Amount + def initialize(amount:, currency:) + @amount = BigDecimal(amount) + @currency = Coinbase.to_sym(currency) + end + + attr_reader :amount, :currency + + # Returns a string representation of the FiatAmount. + # @return [String] a string representation of the FiatAmount + def to_s + Coinbase.pretty_print_object(self.class, amount: amount.to_s('F'), currency: currency) + end + + # Same as to_s. + # @return [String] a string representation of the FiatAmount + def inspect + to_s + end + end +end diff --git a/lib/coinbase/fund_operation.rb b/lib/coinbase/fund_operation.rb new file mode 100644 index 00000000..92a4c5d0 --- /dev/null +++ b/lib/coinbase/fund_operation.rb @@ -0,0 +1,228 @@ +# frozen_string_literal: true + +require_relative 'constants' +require 'bigdecimal' +require 'eth' + +module Coinbase + # A representation of a Fund Operation, which buys funds from the Coinbase platform, + # and sends then to the developer's address. + class FundOperation + # A representation of a Fund Operation status. + module Status + # The Fund Operation is being processed. + PENDING = 'pending' + + # The Fund Operation is complete. + COMPLETE = 'complete' + + # The Fund Operation has failed for some reason. + FAILED = 'failed' + + # The states that are considered terminal on-chain. + TERMINAL_STATES = [COMPLETE, FAILED].freeze + end + + class << self + # Creates a new Fund Operation object. + # This takes an optional FundQuote object that can be used to lock in the rate and fees. + # Without an explicit quote, we will use the current rate and fees. + # @param address_id [String] The Address ID of the sending Address + # @param wallet_id [String] The Wallet ID of the sending Wallet + # @param amount [BigDecimal] The amount of the Asset to send + # @param network [Coinbase::Network, Symbol] The Network or Network ID of the Asset + # @param asset_id [Symbol] The Asset ID of the Asset to send + # @param quote [Coinbase::FundQuote, String] The optional FundQuote to use for the Fund Operation + # @return [FundOperation] The new pending Fund Operation object + # @raise [Coinbase::ApiError] If the Fund Operation fails + def create(wallet_id:, address_id:, amount:, asset_id:, network:, quote: nil) + network = Coinbase::Network.from_id(network) + asset = network.get_asset(asset_id) + + model = Coinbase.call_api do + fund_api.create_fund_operation( + wallet_id, + address_id, + { + amount: asset.to_atomic_amount(amount).to_i.to_s, + asset_id: asset.primary_denomination.to_s, + fund_quote_id: quote_id(quote) + }.compact + ) + end + + new(model) + end + + # Enumerates the fund operation for a given address belonging to a wallet. + # The result is an enumerator that lazily fetches from the server, and can be iterated over, + # converted to an array, etc... + # @return [Enumerable] Enumerator that returns fund operations + def list(wallet_id:, address_id:) + Coinbase::Pagination.enumerate( + ->(page) { fetch_page(wallet_id, address_id, page) } + ) do |fund_operation| + new(fund_operation) + end + end + + private + + def fund_api + Coinbase::Client::FundApi.new(Coinbase.configuration.api_client) + end + + def fetch_page(wallet_id, address_id, page) + fund_api.list_fund_operations( + wallet_id, + address_id, + limit: DEFAULT_PAGE_LIMIT, + page: page + ) + end + + def quote_id(quote) + return nil if quote.nil? + return quote.id if quote.is_a?(FundQuote) + return quote if quote.is_a?(String) + + raise ArgumentError, 'quote must be a FundQuote object or ID' + end + end + + # Returns a new Fund Operation object. Do not use this method directly. Instead, use + # Wallet#fund or Address#fund. + # @param model [Coinbase::Client::FundOperation] The underlying Fund Operation object + def initialize(model) + raise ArgumentError, 'must be a FundOperation' unless model.is_a?(Coinbase::Client::FundOperation) + + @model = model + end + + # Returns the Fund Operation ID. + # @return [String] The Fund Operation ID + def id + @model.fund_operation_id + end + + # Returns the Network of the Fund Operation. + # @return [Coinbase::Network] The Network + def network + @network ||= Coinbase::Network.from_id(@model.network_id) + end + + # Returns the Wallet ID that the fund quote was created for. + # @return [String] The Wallet ID + def wallet_id + @model.wallet_id + end + + # Returns the Address ID that the fund quote was created for. + # @return [String] The Address ID + def address_id + @model.address_id + end + + # Returns the Asset of the Fund Operation. + # @return [Coinbase::Asset] The Asset + def asset + amount.asset + end + + # Returns the amount that the wallet will receive in crypto. + # @return [Coinbase::CryptoAmount] The crypto amount + def amount + @amount ||= CryptoAmount.from_model(@model.crypto_amount) + end + + # Returns the amount that the wallet's owner will pay in fiat. + # @return [Coinbase::FiatAmount] The fiat amount + def fiat_amount + @fiat_amount ||= FiatAmount.from_model(@model.fiat_amount) + end + + # Returns the fee that the wallet's owner will pay in fiat. + # @return [Coinbase::FiatAmount] The fiat buy fee + def buy_fee + @buy_fee ||= FiatAmount.from_model(@model.fees.buy_fee) + end + + # Returns the fee that the wallet's owner will pay in crypto. + # @return [Coinbase::CryptoAmount] The crypto transfer fee + def transfer_fee + @transfer_fee ||= CryptoAmount.from_model(@model.fees.transfer_fee) + end + + # Returns the status of the Fund Operation. + # @return [Symbol] The status + def status + @model.status + end + + # Reload reloads the Transfer model with the latest version from the server side. + # @return [Transfer] The most recent version of Transfer from the server. + def reload + @model = Coinbase.call_api do + fund_api.get_fund_operation(wallet_id, address_id, id) + end + + self + end + + # Waits until the Fund Operation is completed or failed by polling the at the given interval. + # @param interval_seconds [Integer] The interval at which to poll the Network, in seconds + # @param timeout_seconds [Integer] The maximum amount of time to wait for the Fund Operation to complete, in seconds + # @return [Coinbase::FundOperation] The completed or failed Fund Operation object + # @raise [Timeout::Error] If the Fund Operation takes longer than the given timeout + def wait!(interval_seconds = 1, timeout_seconds = 60) + start_time = Time.now + + loop do + reload + + return self if terminal_state? + + raise Timeout::Error, 'Fund Operation timed out' if Time.now - start_time > timeout_seconds + + self.sleep interval_seconds + end + + self + end + + # Returns a String representation of the Fund Operation. + # @return [String] a String representation of the Fund Operation + def to_s + Coinbase.pretty_print_object( + self.class, + id: id, + network_id: network.id, + wallet_id: wallet_id, + address_id: address_id, + status: status, + crypto_amount: amount, + fiat_amount: fiat_amount, + buy_fee: buy_fee, + transfer_fee: transfer_fee + ) + end + + # Same as to_s. + # @return [String] a String representation of the Fund Operation. + def inspect + to_s + end + + private + + # Returns whether the Fund Operation is in a terminal state. + # @return [Boolean] Whether the Fund Operation is in a terminal state + def terminal_state? + Status::TERMINAL_STATES.include?(status) + end + + def fund_api + @fund_api ||= Coinbase::Client::FundApi.new(Coinbase.configuration.api_client) + end + end +end diff --git a/lib/coinbase/fund_quote.rb b/lib/coinbase/fund_quote.rb new file mode 100644 index 00000000..05fa6f6f --- /dev/null +++ b/lib/coinbase/fund_quote.rb @@ -0,0 +1,149 @@ +# frozen_string_literal: true + +require_relative 'constants' +require 'bigdecimal' +require 'eth' + +module Coinbase + # A representation of a Fund Operation Quote, which is a quote for a fund operation + # that buys funds from the Coinbase platform and sends then to the developer's address. + class FundQuote + class << self + # Creates a new Fund Operation Quote object. + # @param address_id [String] The Address ID of the sending Address + # @param wallet_id [String] The Wallet ID of the sending Wallet + # @param amount [BigDecimal] The amount of the Asset to send + # @param network [Coinbase::Network, Symbol] The Network or Network ID of the Asset + # @param asset_id [Symbol] The Asset ID of the Asset to send + # @return [FundQuote] The new Fund Quote object + # @raise [Coinbase::ApiError] If the Fund Quote fails + def create(wallet_id:, address_id:, amount:, asset_id:, network:) + network = Coinbase::Network.from_id(network) + asset = network.get_asset(asset_id) + + model = Coinbase.call_api do + fund_api.create_fund_quote( + wallet_id, + address_id, + { + asset_id: asset.primary_denomination.to_s, + amount: asset.to_atomic_amount(amount).to_i.to_s + } + ) + end + + new(model) + end + + private + + def fund_api + Coinbase::Client::FundApi.new(Coinbase.configuration.api_client) + end + end + + # Returns a new Fund Quote object. Do not use this method directly. + # Instead, use Wallet#quote_fund or Address#quote_fund. + # @param model [Coinbase::Client::FundQuote] The underlying Fund Quote object + def initialize(model) + raise ArgumentError, 'must be a FundQuote' unless model.is_a?(Coinbase::Client::FundQuote) + + @model = model + end + + # Returns the ID of the Fund Quote. + # @return [String] The Fund Quote ID + def id + @model.fund_quote_id + end + + # Executes a fund operation using the quote. + # @return [Coinbase::FundOperation] The FundOperation object + # @raise [Coinbase::ApiError] If the FundOperation fails + def execute! + FundOperation.create( + wallet_id: wallet_id, + address_id: address_id, + amount: amount.amount, + asset_id: asset.asset_id, + network: network.id, + quote: self + ) + end + + # Returns the Network the fund quote was created on. + # @return [Coinbase::Network] The Network + def network + @network ||= Coinbase::Network.from_id(@model.network_id) + end + + # Returns the Wallet ID that the fund quote was created for. + # @return [String] The Wallet ID + def wallet_id + @model.wallet_id + end + + # Returns the Address ID that the fund quote was created for. + # @return [String] The Address ID + def address_id + @model.address_id + end + + # Returns the Asset of the FundOperation. + # @return [Coinbase::Asset] The Asset + def asset + amount.asset + end + + # Returns the amount that the wallet will receive in crypto. + # @return [Coinbase::CryptoAmount] The crypto amount + def amount + @amount ||= CryptoAmount.from_model(@model.crypto_amount) + end + + # Returns the amount that the wallet's owner will pay in fiat. + # @return [Coinbase::FiatAmount] The fiat amount + def fiat_amount + @fiat_amount ||= FiatAmount.from_model(@model.fiat_amount) + end + + # Returns the fee that the wallet's owner will pay in fiat. + # @return [Coinbase::FiatAmount] The fiat buy fee + def buy_fee + @buy_fee ||= FiatAmount.from_model(@model.fees.buy_fee) + end + + # Returns the fee that the wallet's owner will pay in crypto. + # @return [Coinbase::CryptoAmount] The crypto transfer fee + def transfer_fee + @transfer_fee ||= CryptoAmount.from_model(@model.fees.transfer_fee) + end + + # Returns a String representation of the Fund Operation. + # @return [String] a String representation of the Fund Operation + def to_s + Coinbase.pretty_print_object( + self.class, + network_id: network.id, + wallet_id: wallet_id, + address_id: address_id, + crypto_amount: amount, + fiat_amount: fiat_amount, + buy_fee: buy_fee, + transfer_fee: transfer_fee + ) + end + + # Same as to_s. + # @return [String] a String representation of the Transfer + def inspect + to_s + end + + private + + def fund_api + @fund_api ||= Coinbase::Client::FundApi.new(Coinbase.configuration.api_client) + end + end +end diff --git a/lib/coinbase/smart_contract.rb b/lib/coinbase/smart_contract.rb index ad9ca00f..bd7ae5c7 100644 --- a/lib/coinbase/smart_contract.rb +++ b/lib/coinbase/smart_contract.rb @@ -143,9 +143,9 @@ def self.create_multi_token_contract( # @return [Object] The result of the contract call, converted to an appropriate Ruby type # @raise [Coinbase::ApiError] If there's an error in the API call def self.read( - network:, contract_address:, method:, + network: Coinbase.default_network, abi: nil, args: {} ) @@ -159,7 +159,7 @@ def self.read( method: method, args: (args || {}).to_json, abi: abi&.to_json - } + }.compact ) end diff --git a/lib/coinbase/staking_operation.rb b/lib/coinbase/staking_operation.rb index 0601b074..02b6cb8a 100644 --- a/lib/coinbase/staking_operation.rb +++ b/lib/coinbase/staking_operation.rb @@ -107,7 +107,7 @@ def self.stake_api private_class_method :stake_api def self.wallet_stake_api - Coinbase::Client::WalletStakeApi.new(Coinbase.configuration.api_client) + Coinbase::Client::MPCWalletStakeApi.new(Coinbase.configuration.api_client) end private_class_method :wallet_stake_api @@ -324,7 +324,7 @@ def stake_api end def wallet_stake_api - @wallet_stake_api ||= Coinbase::Client::WalletStakeApi.new(Coinbase.configuration.api_client) + @wallet_stake_api ||= Coinbase::Client::MPCWalletStakeApi.new(Coinbase.configuration.api_client) end def update_transactions(transactions) diff --git a/lib/coinbase/validator.rb b/lib/coinbase/validator.rb index 5b735fd0..3a12d47f 100644 --- a/lib/coinbase/validator.rb +++ b/lib/coinbase/validator.rb @@ -33,12 +33,9 @@ def self.fetch(network, asset_id, validator_id) network = Coinbase::Network.from_id(network) validator = Coinbase.call_api do - validators_api.get_validator( - network.normalized_id, - asset_id, - validator_id - ) + stake_api.get_validator(network.normalized_id, asset_id, validator_id) end + new(validator) end @@ -57,7 +54,7 @@ def status # Returns a string representation of the Validator. # @return [String] a string representation of the Validator def to_s - "Coinbase::Validator{id: '#{validator_id}' status: '#{status}'}" + Coinbase.pretty_print_object(self, validator_id: validator_id, status: status) end # Same as to_s. @@ -68,7 +65,7 @@ def inspect def self.list_page(network, asset_id, status, page) Coinbase.call_api do - validators_api.list_validators( + stake_api.list_validators( network.normalized_id, asset_id, { @@ -81,10 +78,10 @@ def self.list_page(network, asset_id, status, page) private_class_method :list_page - def self.validators_api - Coinbase::Client::ValidatorsApi.new(Coinbase.configuration.api_client) + def self.stake_api + Coinbase::Client::StakeApi.new(Coinbase.configuration.api_client) end - private_class_method :validators_api + private_class_method :stake_api end end diff --git a/lib/coinbase/version.rb b/lib/coinbase/version.rb index a13b70a5..7c756c93 100644 --- a/lib/coinbase/version.rb +++ b/lib/coinbase/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Coinbase - VERSION = '0.10.0' + VERSION = '0.11.0' end diff --git a/lib/coinbase/wallet.rb b/lib/coinbase/wallet.rb index c4de9572..10b51a4a 100644 --- a/lib/coinbase/wallet.rb +++ b/lib/coinbase/wallet.rb @@ -258,9 +258,21 @@ def initialize(model, seed: nil) # @return [Coinbase::SmartContract] The deployed multi-token contract. # @raise [AddressCannotSignError] if the Address does not have a private key backing it. + # @!method quote_fund + # Gets a quote for a fund operation to fund the address from your Coinbase platform, + # account for the amount of the specified Asset. + # @param asset_id [Symbol] The ID of the Asset to trade from. For Ether, :eth, :gwei, and :wei are supported. + # @return [Coinbase::FundQuote] The FundQuote object. + + # @!method fund + # Funds the address from your account on the Coinbase Platform for the given amount of the given Asset. + # @param amount [Integer, Float, BigDecimal] The amount of the Asset to fund the wallet with. + # @param asset_id [Symbol] The ID of the Asset to trade from. For Ether, :eth, :gwei, and :wei are supported. + # @return [Coinbase::FundOperation] The FundOperation object. + def_delegators :default_address, :transfer, :trade, :faucet, :stake, :unstake, :claim_stake, :staking_balances, :stakeable_balance, :unstakeable_balance, :claimable_balance, :sign_payload, :invoke_contract, - :deploy_token, :deploy_nft, :deploy_multi_token + :deploy_token, :deploy_nft, :deploy_multi_token, :quote_fund, :fund # Returns the addresses belonging to the Wallet. # @return [Array] The addresses belonging to the Wallet diff --git a/spec/factories/crypto_amount.rb b/spec/factories/crypto_amount.rb new file mode 100644 index 00000000..f34af678 --- /dev/null +++ b/spec/factories/crypto_amount.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :crypto_amount_model, class: Coinbase::Client::CryptoAmount do + transient do + network_id { nil } + whole_amount { 1 } + end + + # Default traits + base_sepolia + eth + + amount { nil } + + NETWORK_TRAITS.each do |network| + trait network do + network_id { Coinbase.normalize_network(network) } + end + end + + ASSET_TRAITS.each do |asset| + trait asset do + asset { build(:asset_model, asset) } + end + end + + after(:build) do |crypto_amount, transients| + crypto_amount.asset.network_id = transients.network_id + + # Set the atomic amount based on the whole amount, + # if amount is not set and whole amount is set. + if crypto_amount.amount.nil? && !transients.whole_amount.nil? + crypto_amount.amount = Coinbase::Asset.from_model(crypto_amount.asset) + .to_atomic_amount(BigDecimal(transients.whole_amount)) + .to_s + end + end + end + + factory :crypto_amount, class: Coinbase::CryptoAmount do + initialize_with { Coinbase::CryptoAmount.from_model(model) } + + transient do + network_trait { nil } + asset_trait { nil } + whole_amount { 123 } + end + + # Default traits. + base_sepolia + eth + + model do + build( + :crypto_amount_model, + *[network_trait, asset_trait].compact, + whole_amount: whole_amount + ) + end + + NETWORK_TRAITS.each do |network| + trait network do + network_trait { network } + end + end + + ASSET_TRAITS.each do |asset| + trait asset do + asset_trait { asset } + end + end + end +end diff --git a/spec/factories/fiat_amount.rb b/spec/factories/fiat_amount.rb new file mode 100644 index 00000000..4b06af49 --- /dev/null +++ b/spec/factories/fiat_amount.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :fiat_amount_model, class: Coinbase::Client::FiatAmount do + amount { '1.23' } + currency { 'usd' } + end + + factory :fiat_amount, class: Coinbase::FiatAmount do + initialize_with { Coinbase::FiatAmount.from_model(model) } + + transient do + amount { '1.23' } + currency { 'usd' } + end + + model do + build(:fiat_amount_model, amount: amount, currency: currency) + end + end +end diff --git a/spec/factories/fund_operation.rb b/spec/factories/fund_operation.rb new file mode 100644 index 00000000..6243936f --- /dev/null +++ b/spec/factories/fund_operation.rb @@ -0,0 +1,103 @@ +# frozen_string_literal: true + +FUND_OPERATION_STATES = %i[pending complete failed].freeze + +FactoryBot.define do + factory :fund_operation_model, class: Coinbase::Client::FundOperation do + transient do + key { build(:key) } + whole_amount { 123 } + buy_fee { build(:fiat_amount_model) } + transfer_fee { build(:crypto_amount_model, Coinbase.to_sym(network_id)) } + end + + wallet_id { SecureRandom.uuid } + fund_operation_id { SecureRandom.uuid } + address_id { key.address.to_s } + crypto_amount { build(:crypto_amount_model, Coinbase.to_sym(network_id), whole_amount: whole_amount) } + + fiat_amount { build(:fiat_amount_model) } + + # Default traits + base_sepolia + eth + pending + + FUND_OPERATION_STATES.each do |status| + trait status do + status { status.to_s } + end + end + + NETWORK_TRAITS.each do |network| + trait network do + network_id { Coinbase.normalize_network(network) } + end + end + + ASSET_TRAITS.each do |asset| + trait asset do + crypto_amount do + build(:crypto_amount_model, Coinbase.to_sym(network_id), asset, whole_amount: whole_amount) + end + end + end + + after(:build) do |fund_operation, transients| + transients.transfer_fee.asset.network_id = transients.network_id + fund_operation.fees = Coinbase::Client::FundOperationFees.new( + buy_fee: transients.buy_fee, + transfer_fee: transients.transfer_fee + ) + end + end + + factory :fund_operation, class: Coinbase::FundOperation do + initialize_with { new(model) } + + transient do + network { nil } + asset { nil } + status { nil } + key { build(:key) } + amount { nil } + fiat_amount { build(:fiat_amount_model) } + end + + model { build(:fund_operation_model, key: key, crypto_amount: amount) } + + FUND_OPERATION_STATES.each do |status| + trait status do + status { status } + end + end + + NETWORK_TRAITS.each do |network| + trait network do + network { network } + end + end + + ASSET_TRAITS.each do |asset| + trait asset do + asset { asset } + end + end + + before(:build) do |transfer, transients| + transients.amount = build(:crypto_amount_model, network, whole_amount: 123) if transients.amount.nil? + + transfer.model do + build( + :fund_operation_model, + transients, + **{ + key: transients.key, + crypto_amount: transients.amount, + fiat_amount: transients.fiat_amount + }.compact + ) + end + end + end +end diff --git a/spec/factories/fund_quote.rb b/spec/factories/fund_quote.rb new file mode 100644 index 00000000..6e2790ee --- /dev/null +++ b/spec/factories/fund_quote.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :fund_quote_model, class: Coinbase::Client::FundQuote do + transient do + key { build(:key) } + whole_amount { 123 } + buy_fee { build(:fiat_amount_model) } + transfer_fee { build(:crypto_amount_model, Coinbase.to_sym(network_id)) } + end + + wallet_id { SecureRandom.uuid } + fund_quote_id { SecureRandom.uuid } + address_id { key.address.to_s } + crypto_amount { build(:crypto_amount_model, Coinbase.to_sym(network_id), whole_amount: whole_amount) } + + fiat_amount { build(:fiat_amount_model) } + + # Default traits + base_sepolia + eth + + NETWORK_TRAITS.each do |network| + trait network do + network_id { Coinbase.normalize_network(network) } + end + end + + ASSET_TRAITS.each do |asset| + trait asset do + crypto_amount do + build(:crypto_amount_model, Coinbase.to_sym(network_id), asset, whole_amount: whole_amount) + end + end + end + + after(:build) do |fund_quote, transients| + transients.transfer_fee.asset.network_id = transients.network_id + fund_quote.fees = Coinbase::Client::FundOperationFees.new( + buy_fee: transients.buy_fee, + transfer_fee: transients.transfer_fee + ) + end + end + + factory :fund_quote, class: Coinbase::FundQuote do + initialize_with { new(model) } + + transient do + network { base_sepolia } + asset { nil } + key { build(:key) } + amount { nil } + fiat_amount { build(:fiat_amount_model) } + end + + model { build(:fund_quote_model, key: key, crypto_amount: amount) } + + NETWORK_TRAITS.each do |network| + trait network do + network { network } + end + end + + ASSET_TRAITS.each do |asset| + trait asset do + asset { asset } + end + end + + before(:build) do |transfer, transients| + transfer.model do + transients.amount = build(:crypto_amount_model, network, whole_amount: 123) if transients.amount.nil? + + build( + :fund_quote_model, + transients, + **{ + key: transients.key, + crypto_amount: transients.amount, + fiat_amount: transients.fiat_amount + }.compact + ) + end + end + end +end diff --git a/spec/unit/coinbase/address/wallet_address_spec.rb b/spec/unit/coinbase/address/wallet_address_spec.rb index ac5b66d5..382591e8 100644 --- a/spec/unit/coinbase/address/wallet_address_spec.rb +++ b/spec/unit/coinbase/address/wallet_address_spec.rb @@ -555,6 +555,64 @@ end end + describe '#fund' do + subject(:fund_operation) { address.fund(amount, asset_id) } + + let(:amount) { '123.45' } + let(:asset_id) { :eth } + let(:crypto_amount) { build(:crypto_amount, network_id, asset_id, whole_amount: amount) } + let(:created_fund_operation) { build(:fund_operation, network_id, key: key, amount: crypto_amount) } + + before do + allow(Coinbase::FundOperation).to receive(:create).and_return(created_fund_operation) + + fund_operation + end + + it 'returns the created fund operation' do + expect(fund_operation).to eq(created_fund_operation) + end + + it 'creates the fund operation' do + expect(Coinbase::FundOperation).to have_received(:create).with( + address_id: address_id, + amount: amount, + asset_id: asset_id, + network: network, + wallet_id: wallet_id + ) + end + end + + describe '#quote_fund' do + subject(:fund_quote) { address.quote_fund(amount, asset_id) } + + let(:amount) { '123.45' } + let(:asset_id) { :eth } + let(:crypto_amount) { build(:crypto_amount, network_id, asset_id, whole_amount: amount) } + let(:created_fund_quote) { build(:fund_quote, network_id, key: key, amount: crypto_amount) } + + before do + allow(Coinbase::FundQuote).to receive(:create).and_return(created_fund_quote) + + fund_quote + end + + it 'returns the created fund quote' do + expect(fund_quote).to eq(created_fund_quote) + end + + it 'creates the fund quote' do + expect(Coinbase::FundQuote).to have_received(:create).with( + address_id: address_id, + amount: amount, + asset_id: asset_id, + network: network, + wallet_id: wallet_id + ) + end + end + shared_examples 'an address that can do a staking_action' do |operation| subject(:action) { address.send(operation.to_sym, amount, asset_id, mode: mode) } diff --git a/spec/unit/coinbase/balance_spec.rb b/spec/unit/coinbase/balance_spec.rb index a7edc348..b55f5d80 100644 --- a/spec/unit/coinbase/balance_spec.rb +++ b/spec/unit/coinbase/balance_spec.rb @@ -138,11 +138,11 @@ describe '#inspect' do subject(:balance) { described_class.new(amount: amount, asset: asset) } - let(:amount) { BigDecimal('123.0') } + let(:amount) { BigDecimal('123.456') } let(:asset) { Coinbase::Asset.from_model(eth_asset) } it 'includes balance details' do - expect(balance.inspect).to include('123', 'eth') + expect(balance.inspect).to include('123.456', 'eth') end it 'returns the same value as to_s' do diff --git a/spec/unit/coinbase/crypto_amount_spec.rb b/spec/unit/coinbase/crypto_amount_spec.rb new file mode 100644 index 00000000..33057b22 --- /dev/null +++ b/spec/unit/coinbase/crypto_amount_spec.rb @@ -0,0 +1,163 @@ +# frozen_string_literal: true + +describe Coinbase::CryptoAmount do + let(:amount) { BigDecimal('123.0') } + let(:crypto_amount_model) { instance_double(Coinbase::Client::CryptoAmount, asset: asset, amount: amount) } + let(:eth_asset) { build(:asset_model) } + + describe '.from_model' do + subject(:crypto_amount) { described_class.from_model(crypto_amount_model) } + + context 'when the asset is :eth' do + let(:asset) { eth_asset } + + it 'returns a CryptoAmount object' do + expect(crypto_amount).to be_a(described_class) + end + + it 'sets the correct amount' do + expect(crypto_amount.amount).to eq(amount / BigDecimal(10).power(eth_asset.decimals)) + end + + it 'sets the correct asset_id' do + expect(crypto_amount.asset_id).to eq(:eth) + end + end + + context 'when the asset is other' do + let(:decimals) { 9 } + let(:asset) { build(:asset_model, asset_id: 'other', decimals: decimals) } + + it 'returns a CryptoAmount object' do + expect(crypto_amount).to be_a(described_class) + end + + it 'sets the correct amount' do + expect(crypto_amount.amount).to eq(amount / BigDecimal(10).power(decimals)) + end + + it 'sets the correct asset_id' do + expect(crypto_amount.asset_id).to eq(:other) + end + end + end + + describe '.from_model_and_asset_id' do + subject(:crypto_amount) { described_class.from_model_and_asset_id(crypto_amount_model, asset_id) } + + context 'when the crypto_amount model asset is :eth' do + let(:asset) { eth_asset } + + context 'when the specified asset_id is :eth' do + let(:asset_id) { :eth } + + it 'returns a new CryptoAmount object with the correct amount' do + expect(crypto_amount.amount).to eq(amount / BigDecimal(10).power(eth_asset.decimals)) + end + + it 'returns a new CryptoAmount object with the correct asset_id' do + expect(crypto_amount.asset_id).to eq(asset_id) + end + end + + context 'when the specified asset_id is :gwei' do + let(:asset_id) { :gwei } + + it 'returns a new CryptoAmount object with the correct amount' do + expect(crypto_amount.amount).to eq(amount / BigDecimal(10).power(Coinbase::GWEI_DECIMALS)) + end + + it 'returns a new CryptoAmount object with the correct asset_id' do + expect(crypto_amount.asset_id).to eq(asset_id) + end + end + + context 'when the specified asset_id is :wei' do + let(:asset_id) { :wei } + + it 'returns a new CryptoAmount object with the correct amount' do + expect(crypto_amount.amount).to eq(amount) + end + + it 'returns a new CryptoAmount object with the correct asset_id' do + expect(crypto_amount.asset_id).to eq(asset_id) + end + end + + context 'when the specified asset_id is another asset type' do + let(:asset_id) { :other } + + it 'raise an error' do + expect { crypto_amount }.to raise_error(ArgumentError) + end + end + end + + context 'when the asset is not eth' do + let(:decimals) { 9 } + let(:asset_id) { :other } + let(:asset) { build(:asset_model, asset_id: 'other', decimals: decimals) } + + it 'returns a new CryptoAmount object with the correct amount' do + expect(crypto_amount.amount).to eq(amount / BigDecimal(10).power(decimals)) + end + + it 'returns a new CryptoAmount object with the correct asset_id' do + expect(crypto_amount.asset_id).to eq(asset_id) + end + + context 'when the asset ID does not match the asset' do + let(:asset_id) { :different } + + it 'raises an error' do + expect { crypto_amount }.to raise_error(ArgumentError) + end + end + end + end + + describe '#initialize' do + subject(:crypto_amount) { described_class.new(amount: amount, asset: asset) } + + let(:amount) { BigDecimal('123.0') } + let(:asset) { Coinbase::Asset.from_model(eth_asset) } + + it 'sets the amount' do + expect(crypto_amount.amount).to eq(amount) + end + + it 'sets the asset' do + expect(crypto_amount.asset).to eq(asset) + end + + it "sets the asset_id to the asset's ID" do + expect(crypto_amount.asset_id).to eq(:eth) + end + end + + describe '#to_atomic_amount' do + subject(:crypto_amount) { described_class.new(amount: amount, asset: asset) } + + let(:amount) { BigDecimal('123.0') } + let(:asset) { Coinbase::Asset.from_model(build(:asset_model, decimals: 3)) } + + it 'returns the amount in atomic units' do + expect(crypto_amount.to_atomic_amount).to eq(123_000) + end + end + + describe '#inspect' do + subject(:crypto_amount) { described_class.new(amount: amount, asset: asset) } + + let(:amount) { BigDecimal('123.456') } + let(:asset) { Coinbase::Asset.from_model(eth_asset) } + + it 'includes crypto_amount details' do + expect(crypto_amount.inspect).to include('123.456', 'eth') + end + + it 'returns the same value as to_s' do + expect(crypto_amount.inspect).to eq(crypto_amount.to_s) + end + end +end diff --git a/spec/unit/coinbase/fiat_amount_spec.rb b/spec/unit/coinbase/fiat_amount_spec.rb new file mode 100644 index 00000000..2d1df9a2 --- /dev/null +++ b/spec/unit/coinbase/fiat_amount_spec.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +describe Coinbase::FiatAmount do + let(:amount_string) { '123.0' } + let(:amount) { BigDecimal('123.0') } + let(:currency) { 'usd' } + let(:fiat_amount_model) do + build(:fiat_amount_model, amount: amount_string, currency: currency) + end + + describe '.from_model' do + subject(:fiat_amount) { described_class.from_model(fiat_amount_model) } + + it 'returns a FiatAmount object' do + expect(fiat_amount).to be_a(described_class) + end + + it 'sets the correct amount' do + expect(fiat_amount.amount).to eq(amount) + end + + it 'sets the correct currency' do + expect(fiat_amount.currency).to eq(:usd) + end + + context 'when the model is not a FiatAmount' do + let(:fiat_amount_model) { build(:balance_model, :base_sepolia) } + + it 'raises an ArgumentError' do + expect do + fiat_amount + end.to raise_error(ArgumentError, 'model must be a Coinbase::Client::FiatAmount') + end + end + end + + describe '#initialize' do + subject(:fiat_amount) { described_class.new(amount: amount_string, currency: currency) } + + it 'sets the BigDecimal amount' do + expect(fiat_amount.amount).to eq(amount) + end + + it 'sets the currency symbol' do + expect(fiat_amount.currency).to eq(:usd) + end + + context 'when the amount is a BigDecimal' do + subject(:fiat_amount) { described_class.new(amount: amount, currency: currency) } + + it 'sets the BigDecimal amount' do + expect(fiat_amount.amount).to eq(amount) + end + end + end + + describe '#inspect' do + subject(:fiat_amount) { described_class.new(amount: amount, currency: currency) } + + let(:amount) { BigDecimal('123.456') } + + it 'includes fiat_amount details' do + expect(fiat_amount.inspect).to include('123.456', 'usd') + end + + it 'returns the same value as to_s' do + expect(fiat_amount.inspect).to eq(fiat_amount.to_s) + end + end +end diff --git a/spec/unit/coinbase/fund_operation_spec.rb b/spec/unit/coinbase/fund_operation_spec.rb new file mode 100644 index 00000000..48b35680 --- /dev/null +++ b/spec/unit/coinbase/fund_operation_spec.rb @@ -0,0 +1,380 @@ +# frozen_string_literal: true + +describe Coinbase::FundOperation do + subject(:fund_operation) { described_class.new(model) } + + let(:network_id) { :base_sepolia } + let(:whole_amount) { '123.45' } + let(:crypto_amount_model) do + build(:crypto_amount_model, network_id, whole_amount: whole_amount) + end + let(:crypto_amount) { build(:crypto_amount, model: crypto_amount_model) } + let(:fiat_amount_model) { build(:fiat_amount_model) } + let(:buy_fee_model) { build(:fiat_amount_model, amount: '0.45') } + let(:transfer_fee_model) { build(:crypto_amount_model, network_id, :eth, whole_amount: '1.01') } + let(:transfer_fee) { build(:crypto_amount, model: transfer_fee_model) } + let(:key) { build(:key) } + let(:address_id) { key.address.to_s } + let(:model) do + build( + :fund_operation_model, + network_id, + key: key, + crypto_amount: crypto_amount_model, + fiat_amount: fiat_amount_model, + buy_fee: buy_fee_model, + transfer_fee: transfer_fee_model + ) + end + let(:eth_asset) { build(:asset, network_id, :eth) } + + let(:fund_api) { instance_double(Coinbase::Client::FundApi) } + + before do + allow(Coinbase::Client::FundApi).to receive(:new).and_return(fund_api) + + allow(Coinbase::Asset) + .to receive(:fetch) + .with(network_id, :eth) + .and_return(eth_asset) + allow(Coinbase::Asset) + .to receive(:fetch) + .with(network_id, :gwei) + .and_return(build(:asset, network_id, :gwei)) + allow(Coinbase::Asset) + .to receive(:from_model) + .with(satisfy { |model| model.asset_id == 'eth' }) + .and_return(eth_asset) + end + + describe '.create' do + subject(:created_operation) do + described_class.create( + wallet_id: wallet_id, + address_id: address_id, + amount: amount, + asset_id: asset_id, + network: network_id + ) + end + + let(:wallet_id) { SecureRandom.uuid } + let(:asset_id) { eth_asset.asset_id } + let(:amount) { 123.45 } + let(:expected_atomic_amount) { '123450000000000000000' } + + before do + allow(fund_api).to receive(:create_fund_operation).and_return(model) + end + + it 'creates a fund operation' do + expect(created_operation).to be_a(described_class) + end + + it 'creates the fund operation via the API' do + created_operation + + expect(fund_api).to have_received(:create_fund_operation).with( + wallet_id, + address_id, + { + asset_id: 'eth', + amount: expected_atomic_amount + } + ) + end + + context 'when a quote is provided' do + subject(:created_operation) do + described_class.create( + wallet_id: wallet_id, + address_id: address_id, + amount: amount, + asset_id: asset_id, + network: network_id, + quote: quote + ) + end + + let(:quote) { build(:fund_quote, network_id, :eth) } + + it 'creates a fund operation' do + expect(created_operation).to be_a(described_class) + end + + it 'creates the fund operation for the specified quote via the API' do + created_operation + + expect(fund_api).to have_received(:create_fund_operation).with( + wallet_id, + address_id, + { + asset_id: 'eth', + amount: expected_atomic_amount, + fund_quote_id: quote.id + } + ) + end + end + + context 'when a quote ID is provided' do + subject(:created_operation) do + described_class.create( + wallet_id: wallet_id, + address_id: address_id, + amount: amount, + asset_id: asset_id, + network: network_id, + quote: quote_id + ) + end + + let(:quote_id) { SecureRandom.uuid } + + it 'creates a fund operation' do + expect(created_operation).to be_a(described_class) + end + + it 'creates the fund operation for the specified quote ID via the API' do + created_operation + + expect(fund_api).to have_received(:create_fund_operation).with( + wallet_id, + address_id, + { + asset_id: 'eth', + amount: expected_atomic_amount, + fund_quote_id: quote_id + } + ) + end + end + + context 'when an invalid quote is provided' do + subject(:created_operation) do + described_class.create( + wallet_id: wallet_id, + address_id: address_id, + amount: amount, + asset_id: asset_id, + network: network_id, + quote: build(:balance_model, network_id) + ) + end + + it 'raises an error' do + expect do + created_operation + end.to raise_error(ArgumentError, 'quote must be a FundQuote object or ID') + end + end + + context 'when the asset is not a primary denomination' do + let(:asset_id) { :gwei } + let(:amount) { 4567.89 } + let(:expected_atomic_amount) { '4567890000000' } + + it 'creates a fund operation' do + expect(created_operation).to be_a(described_class) + end + + it 'creates the fund operation in the primary denomination' do + created_operation + + expect(fund_api).to have_received(:create_fund_operation).with( + wallet_id, + address_id, + { + asset_id: 'eth', + amount: expected_atomic_amount + } + ) + end + end + end + + describe '.list' do + subject(:enumerator) do + described_class.list(wallet_id: wallet_id, address_id: address_id) + end + + let(:api) { fund_api } + let(:wallet_id) { SecureRandom.uuid } + let(:fetch_params) { ->(page) { [wallet_id, address_id, { limit: 100, page: page }] } } + let(:resource_list_klass) { Coinbase::Client::FundOperationList } + let(:item_klass) { described_class } + let(:item_initialize_args) { nil } + let(:create_model) do + ->(id) { build(:fund_operation_model, network_id, fund_operation_id: id) } + end + + it_behaves_like 'it is a paginated enumerator', :fund_operations + end + + describe '#initialize' do + it 'initializes a Fund operation' do + expect(fund_operation).to be_a(described_class) + end + + context 'when the model is not a Fund operation model' do + let(:model) { build(:balance_model) } + + it 'raises an error' do + expect { fund_operation }.to raise_error(ArgumentError) + end + end + end + + describe '#id' do + it 'returns the ID of the Fund operation' do + expect(fund_operation.id).to eq(model.fund_operation_id) + end + end + + describe '#network' do + it 'returns the network' do + expect(fund_operation.network.id).to eq(network_id) + end + end + + describe '#wallet_id' do + it 'returns the wallet ID' do + expect(fund_operation.wallet_id).to eq(model.wallet_id) + end + end + + describe '#address_id' do + it 'returns the address ID' do + expect(fund_operation.address_id).to eq(address_id) + end + end + + describe '#asset' do + it 'returns the asset' do + expect(fund_operation.asset.asset_id).to eq(crypto_amount.asset.asset_id) + end + end + + describe '#amount' do + it 'returns the crypto amount' do + expect(fund_operation.amount).to be_a(Coinbase::CryptoAmount) + end + + it 'returns the correct amount' do + expect(fund_operation.amount.amount).to eq(crypto_amount.amount) + end + + it 'returns the correct asset' do + expect(fund_operation.amount.asset.asset_id).to eq(:eth) + end + end + + describe '#fiat_amount' do + it 'returns the fiat amount' do + expect(fund_operation.fiat_amount).to be_a(Coinbase::FiatAmount) + end + + it 'returns the correct amount' do + expect(fund_operation.fiat_amount.amount).to eq(BigDecimal(fiat_amount_model.amount)) + end + + it 'returns the correct currency' do + expect(fund_operation.fiat_amount.currency).to eq(fiat_amount_model.currency.to_sym) + end + end + + describe '#buy_fee' do + it 'returns a fiat amount' do + expect(fund_operation.buy_fee).to be_a(Coinbase::FiatAmount) + end + + it 'returns the correct amount' do + expect(fund_operation.buy_fee.amount).to eq(BigDecimal(buy_fee_model.amount)) + end + + it 'returns the correct currency' do + expect(fund_operation.buy_fee.currency).to eq(buy_fee_model.currency.to_sym) + end + end + + describe '#transfer_fee' do + it 'returns a crypto amount' do + expect(fund_operation.transfer_fee).to be_a(Coinbase::CryptoAmount) + end + + it 'returns the correct amount' do + expect(fund_operation.transfer_fee.amount).to eq(transfer_fee.amount) + end + + it 'returns the correct asset' do + expect(fund_operation.transfer_fee.asset.asset_id).to eq(:eth) + end + end + + describe '#reload' do + let(:updated_model) { build(:fund_operation_model, network_id, :complete) } + + before do + allow(fund_api) + .to receive(:get_fund_operation) + .with(fund_operation.wallet_id, fund_operation.address_id, fund_operation.id) + .and_return(updated_model) + end + + it 'updates the fund operation' do + expect(fund_operation.reload.status).to eq(Coinbase::FundOperation::Status::COMPLETE) + end + end + + describe '#wait!' do + before do + allow(fund_operation).to receive(:sleep) # rubocop:disable RSpec/SubjectStub + + allow(fund_api) + .to receive(:get_fund_operation) + .with(fund_operation.wallet_id, fund_operation.address_id, fund_operation.id) + .and_return(model, model, updated_model) + end + + context 'when the fund operation is complete' do + let(:updated_model) { build(:fund_operation_model, network_id, :complete) } + + it 'returns the completed FundOperation' do + expect(fund_operation.wait!.status).to eq(Coinbase::Transaction::Status::COMPLETE) + end + end + + context 'when the fund operation is failed' do + let(:updated_model) { build(:fund_operation_model, network_id, :failed) } + + it 'returns the failed FundOperation' do + expect(fund_operation.wait!.status).to eq(Coinbase::Transaction::Status::FAILED) + end + end + + context 'when the fund operation times out' do + let(:updated_model) { build(:fund_operation_model, network_id, :pending) } + + it 'raises a Timeout::Error' do + expect { fund_operation.wait!(0.2, 0.00001) }.to raise_error(Timeout::Error, 'Fund Operation timed out') + end + end + end + + describe '#inspect' do + it 'includes fund operation details' do # rubocop:disable RSpec/ExampleLength + expect(fund_operation.inspect).to include( + Coinbase.to_sym(network_id).to_s, + model.fund_operation_id, + model.wallet_id, + address_id, + crypto_amount.to_s, + BigDecimal(fiat_amount_model.amount).to_i.to_s, + fiat_amount_model.currency, + BigDecimal(buy_fee_model.amount).to_i.to_s, + buy_fee_model.currency, + transfer_fee.to_s + ) + end + end +end diff --git a/spec/unit/coinbase/fund_quote_spec.rb b/spec/unit/coinbase/fund_quote_spec.rb new file mode 100644 index 00000000..8bce668e --- /dev/null +++ b/spec/unit/coinbase/fund_quote_spec.rb @@ -0,0 +1,255 @@ +# frozen_string_literal: true + +describe Coinbase::FundQuote do + subject(:fund_quote) { described_class.new(model) } + + let(:network_id) { :base_sepolia } + let(:whole_amount) { '123.45' } + let(:crypto_amount_model) do + build(:crypto_amount_model, network_id, whole_amount: whole_amount) + end + let(:crypto_amount) { build(:crypto_amount, model: crypto_amount_model) } + let(:fiat_amount_model) { build(:fiat_amount_model) } + let(:buy_fee_model) { build(:fiat_amount_model, amount: '0.45') } + let(:transfer_fee_model) { build(:crypto_amount_model, network_id, :eth, whole_amount: '1.01') } + let(:transfer_fee) { build(:crypto_amount, model: transfer_fee_model) } + let(:key) { build(:key) } + let(:address_id) { key.address.to_s } + let(:model) do + build( + :fund_quote_model, + network_id, + key: key, + crypto_amount: crypto_amount_model, + fiat_amount: fiat_amount_model, + buy_fee: buy_fee_model, + transfer_fee: transfer_fee_model + ) + end + let(:eth_asset) { build(:asset, network_id, :eth) } + + let(:fund_api) { instance_double(Coinbase::Client::FundApi) } + + before do + allow(Coinbase::Client::FundApi).to receive(:new).and_return(fund_api) + + allow(Coinbase::Asset) + .to receive(:fetch) + .with(network_id, :eth) + .and_return(eth_asset) + allow(Coinbase::Asset) + .to receive(:fetch) + .with(network_id, :gwei) + .and_return(build(:asset, network_id, :gwei)) + allow(Coinbase::Asset) + .to receive(:from_model) + .with(satisfy { |model| model.asset_id == 'eth' }) + .and_return(eth_asset) + end + + describe '.create' do + subject(:created_quote) do + described_class.create( + wallet_id: wallet_id, + address_id: address_id, + amount: amount, + asset_id: asset_id, + network: network_id + ) + end + + let(:wallet_id) { SecureRandom.uuid } + let(:asset_id) { eth_asset.asset_id } + let(:amount) { 123.45 } + let(:expected_atomic_amount) { '123450000000000000000' } + + before do + allow(fund_api).to receive(:create_fund_quote).and_return(model) + + created_quote + end + + it 'creates a Fund Quote' do + expect(created_quote).to be_a(described_class) + end + + it 'creates the fund quote' do + expect(fund_api).to have_received(:create_fund_quote).with( + wallet_id, + address_id, + { + asset_id: 'eth', + amount: expected_atomic_amount + } + ) + end + + context 'when the asset is not a primary denomination' do + let(:asset_id) { :gwei } + let(:amount) { 4567.89 } + let(:expected_atomic_amount) { '4567890000000' } + + it 'creates a fund quote' do + expect(created_quote).to be_a(described_class) + end + + it 'creates the fund quote in the primary denomination' do + expect(fund_api).to have_received(:create_fund_quote).with( + wallet_id, + address_id, + { + asset_id: 'eth', + amount: expected_atomic_amount + } + ) + end + end + end + + describe '#initialize' do + it 'initializes a Fund Quote' do + expect(fund_quote).to be_a(described_class) + end + + context 'when the model is not a Fund Quote model' do + let(:model) { build(:balance_model) } + + it 'raises an error' do + expect { fund_quote }.to raise_error(ArgumentError) + end + end + end + + describe '#execute!' do + subject(:executed_operation) { fund_quote.execute! } + + let(:fund_operation) { build(:fund_operation, network_id) } + + before do + allow(Coinbase::FundOperation) + .to receive(:create) + .and_return(fund_operation) + + executed_operation + end + + it 'creates a Fund Operation' do + expect(executed_operation).to eq(fund_operation) + end + + it 'creates the fund operation with the correct details' do + expect(Coinbase::FundOperation) + .to have_received(:create) + .with( + wallet_id: model.wallet_id, + address_id: address_id, + amount: crypto_amount.amount, + asset_id: eth_asset.asset_id, + network: network_id, + quote: fund_quote + ) + end + end + + describe '#id' do + it 'returns the ID of the Fund Quote' do + expect(fund_quote.id).to eq(model.fund_quote_id) + end + end + + describe '#network' do + it 'returns the network' do + expect(fund_quote.network.id).to eq(network_id) + end + end + + describe '#wallet_id' do + it 'returns the wallet ID' do + expect(fund_quote.wallet_id).to eq(model.wallet_id) + end + end + + describe '#address_id' do + it 'returns the address ID' do + expect(fund_quote.address_id).to eq(address_id) + end + end + + describe '#asset' do + it 'returns the asset' do + expect(fund_quote.asset.asset_id).to eq(crypto_amount.asset.asset_id) + end + end + + describe '#amount' do + it 'returns the crypto amount' do + expect(fund_quote.amount).to be_a(Coinbase::CryptoAmount) + end + + it 'returns the correct amount' do + expect(fund_quote.amount.amount).to eq(crypto_amount.amount) + end + + it 'returns the correct asset' do + expect(fund_quote.amount.asset.asset_id).to eq(:eth) + end + end + + describe '#fiat_amount' do + it 'returns the fiat amount' do + expect(fund_quote.fiat_amount).to be_a(Coinbase::FiatAmount) + end + + it 'returns the correct amount' do + expect(fund_quote.fiat_amount.amount).to eq(BigDecimal(fiat_amount_model.amount)) + end + + it 'returns the correct currency' do + expect(fund_quote.fiat_amount.currency).to eq(fiat_amount_model.currency.to_sym) + end + end + + describe '#buy_fee' do + it 'returns a fiat amount' do + expect(fund_quote.buy_fee).to be_a(Coinbase::FiatAmount) + end + + it 'returns the correct amount' do + expect(fund_quote.buy_fee.amount).to eq(BigDecimal(buy_fee_model.amount)) + end + + it 'returns the correct currency' do + expect(fund_quote.buy_fee.currency).to eq(buy_fee_model.currency.to_sym) + end + end + + describe '#transfer_fee' do + it 'returns a crypto amount' do + expect(fund_quote.transfer_fee).to be_a(Coinbase::CryptoAmount) + end + + it 'returns the correct amount' do + expect(fund_quote.transfer_fee.amount).to eq(transfer_fee.amount) + end + + it 'returns the correct asset' do + expect(fund_quote.transfer_fee.asset.asset_id).to eq(:eth) + end + end + + describe '#inspect' do + it 'includes fund quote details' do # rubocop:disable RSpec/ExampleLength + expect(fund_quote.inspect).to include( + Coinbase.to_sym(network_id).to_s, + model.wallet_id, + address_id, + crypto_amount.to_s, + BigDecimal(fiat_amount_model.amount).to_i.to_s, + fiat_amount_model.currency, + BigDecimal(buy_fee_model.amount).to_i.to_s, + buy_fee_model.currency, + transfer_fee.to_s + ) + end + end +end diff --git a/spec/unit/coinbase/smart_contract_spec.rb b/spec/unit/coinbase/smart_contract_spec.rb index 40d447de..49174a89 100644 --- a/spec/unit/coinbase/smart_contract_spec.rb +++ b/spec/unit/coinbase/smart_contract_spec.rb @@ -7,12 +7,13 @@ let(:network_id) { :base_sepolia } let(:network) { build(:network, network_id) } - let(:smart_contracts_api) { instance_double(Coinbase::Client::SmartContractsApi) } - + let(:default_network) { build(:network, :base_mainnet) } let(:token_name) { 'Test token' } let(:token_symbol) { 'TST' } let(:total_supply) { 1_000_000 } - + let(:wallet_id) { model.wallet_id } + let(:address_id) { model.deployer_address } + let(:smart_contracts_api) { instance_double(Coinbase::Client::SmartContractsApi) } let(:model) do build( :smart_contract_model, @@ -22,16 +23,11 @@ total_supply: total_supply ) end - let(:wallet_id) { model.wallet_id } - let(:address_id) { model.deployer_address } before do allow(Coinbase::Client::SmartContractsApi).to receive(:new).and_return(smart_contracts_api) - allow(Coinbase::Network) - .to receive(:from_id) - .with(satisfy { |n| n == network || n == network_id || n == network.normalized_id }) - .and_return(network) + allow(Coinbase).to receive(:default_network).and_return(default_network) end describe '.create_token_contract' do @@ -222,7 +218,7 @@ it 'calls read_contract with correct parameters' do result expect(smart_contracts_api).to have_received(:read_contract) - .with('base-sepolia', contract_address, hash_including(expected_params)) + .with(network.normalized_id, contract_address, hash_including(expected_params)) end context 'when using a different network' do @@ -241,6 +237,23 @@ end end + context 'when using the default network' do + subject(:result) do + described_class.read( + contract_address: contract_address, + method: method_name, + abi: abi, + args: args + ) + end + + it 'calls read_contract with correct parameters' do + result + expect(smart_contracts_api).to have_received(:read_contract) + .with(default_network.normalized_id, contract_address, expected_params) + end + end + context 'when using a different contract address' do let(:contract_address) { '0x9876543210987654321098765432109876543210' } @@ -317,15 +330,15 @@ let(:expected_params) do { method: method_name, - abi: nil, args: args.to_json } end - it 'calls read_contract with nil ABI' do + it 'calls read_contract without an ABI' do result + expect(smart_contracts_api).to have_received(:read_contract) - .with('base-sepolia', contract_address, hash_including(expected_params)) + .with(network.normalized_id, contract_address, hash_including(expected_params)) end end @@ -342,15 +355,15 @@ let(:expected_params) do { method: method_name, - abi: nil, args: args.to_json } end - it 'calls read_contract with nil ABI' do + it 'calls read_contract without an ABI' do result + expect(smart_contracts_api).to have_received(:read_contract) - .with('base-sepolia', contract_address, hash_including(expected_params)) + .with(network.normalized_id, contract_address, expected_params) end end diff --git a/spec/unit/coinbase/staking_operation_spec.rb b/spec/unit/coinbase/staking_operation_spec.rb index 0b92918e..9f38212c 100644 --- a/spec/unit/coinbase/staking_operation_spec.rb +++ b/spec/unit/coinbase/staking_operation_spec.rb @@ -26,12 +26,12 @@ let(:hex_encoded_transaction) { '0xdeadbeef' } let(:stake_api) { instance_double(Coinbase::Client::StakeApi) } - let(:wallet_stake_api) { instance_double(Coinbase::Client::WalletStakeApi) } + let(:wallet_stake_api) { instance_double(Coinbase::Client::MPCWalletStakeApi) } let(:raw_tx) { instance_double(Eth::Tx::Eip1559) } before do allow(Coinbase::Client::StakeApi).to receive(:new).and_return(stake_api) - allow(Coinbase::Client::WalletStakeApi).to receive(:new).and_return(wallet_stake_api) + allow(Coinbase::Client::MPCWalletStakeApi).to receive(:new).and_return(wallet_stake_api) allow(staking_operation_model).to receive(:transactions).and_return([transaction_model]) allow(transaction_model).to receive(:unsigned_payload).and_return('some_unsigned_payload') diff --git a/spec/unit/coinbase/validator_spec.rb b/spec/unit/coinbase/validator_spec.rb index 937441b5..dd2c6705 100644 --- a/spec/unit/coinbase/validator_spec.rb +++ b/spec/unit/coinbase/validator_spec.rb @@ -6,7 +6,7 @@ let(:network) { build(:network, network_id) } let(:asset_id) { :asset_id } let(:validator_id) { 'validator_id' } - let(:stake_api) { instance_double(Coinbase::Client::ValidatorsApi) } + let(:stake_api) { instance_double(Coinbase::Client::StakeApi) } let(:validator_model) do instance_double( Coinbase::Client::Validator, @@ -16,7 +16,7 @@ end before do - allow(Coinbase::Client::ValidatorsApi).to receive(:new).and_return(stake_api) + allow(Coinbase::Client::StakeApi).to receive(:new).and_return(stake_api) allow(stake_api).to receive(:get_validator).and_return(validator_model) end diff --git a/spec/unit/coinbase/wallet_spec.rb b/spec/unit/coinbase/wallet_spec.rb index 32e02e7f..6a663bb4 100644 --- a/spec/unit/coinbase/wallet_spec.rb +++ b/spec/unit/coinbase/wallet_spec.rb @@ -1157,6 +1157,58 @@ def match_create_address_request(req, expected_public_key, expected_address_inde end end + describe '#fund' do + subject(:wallet) do + described_class.new(model_with_default_address, seed: '') + end + + let(:fund_operation) { build(:fund_operation, network_id) } + let(:amount) { '123.45' } + let(:asset_id) { :eth } + + before do + allow(addresses_api) + .to receive(:list_addresses) + .with(wallet_id, { limit: 20 }) + .and_return(Coinbase::Client::AddressList.new(data: [first_address_model], total_count: 1)) + + allow(wallet.default_address) + .to receive(:fund) + .with(amount, asset_id) + .and_return(fund_operation) + end + + it 'creates a fund operation using the default address' do + expect(wallet.fund(amount, asset_id)).to eq(fund_operation) + end + end + + describe '#quote_fund' do + subject(:wallet) do + described_class.new(model_with_default_address, seed: '') + end + + let(:fund_quote) { build(:fund_quote, network_id) } + let(:amount) { '123.45' } + let(:asset_id) { :eth } + + before do + allow(addresses_api) + .to receive(:list_addresses) + .with(wallet_id, { limit: 20 }) + .and_return(Coinbase::Client::AddressList.new(data: [first_address_model], total_count: 1)) + + allow(wallet.default_address) + .to receive(:quote_fund) + .with(amount, asset_id) + .and_return(fund_quote) + end + + it 'creates a fund quote from the default address' do + expect(wallet.quote_fund(amount, asset_id)).to eq(fund_quote) + end + end + describe '#export' do context 'when not using a server signer' do subject(:exported_data) { seed_wallet.export }