coinbase-sdk 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coinbase/address/wallet_address.rb +28 -0
- data/lib/coinbase/balance.rb +1 -1
- data/lib/coinbase/client/api/addresses_api.rb +1 -1
- data/lib/coinbase/client/api/assets_api.rb +1 -1
- data/lib/coinbase/client/api/balance_history_api.rb +1 -1
- data/lib/coinbase/client/api/contract_events_api.rb +1 -1
- data/lib/coinbase/client/api/contract_invocations_api.rb +1 -1
- data/lib/coinbase/client/api/external_addresses_api.rb +1 -1
- data/lib/coinbase/client/api/fund_api.rb +1 -1
- data/lib/coinbase/client/api/{wallet_stake_api.rb → mpc_wallet_stake_api.rb} +21 -21
- data/lib/coinbase/client/api/networks_api.rb +1 -1
- data/lib/coinbase/client/api/onchain_identity_api.rb +1 -1
- data/lib/coinbase/client/api/reputation_api.rb +160 -0
- data/lib/coinbase/client/api/server_signers_api.rb +1 -1
- data/lib/coinbase/client/api/smart_contracts_api.rb +1 -1
- data/lib/coinbase/client/api/stake_api.rb +158 -1
- data/lib/coinbase/client/api/trades_api.rb +1 -1
- data/lib/coinbase/client/api/transaction_history_api.rb +1 -1
- data/lib/coinbase/client/api/transfers_api.rb +1 -1
- data/lib/coinbase/client/api/users_api.rb +1 -1
- data/lib/coinbase/client/api/wallets_api.rb +1 -1
- data/lib/coinbase/client/api/webhooks_api.rb +1 -1
- data/lib/coinbase/client/api_client.rb +1 -1
- data/lib/coinbase/client/api_error.rb +1 -1
- data/lib/coinbase/client/configuration.rb +1 -1
- data/lib/coinbase/client/models/address.rb +1 -1
- data/lib/coinbase/client/models/address_balance_list.rb +1 -1
- data/lib/coinbase/client/models/address_historical_balance_list.rb +1 -1
- data/lib/coinbase/client/models/address_list.rb +1 -1
- data/lib/coinbase/client/models/address_reputation.rb +232 -0
- data/lib/coinbase/client/models/address_reputation_metadata.rb +376 -0
- data/lib/coinbase/client/models/address_risk.rb +223 -0
- data/lib/coinbase/client/models/address_transaction_list.rb +1 -1
- data/lib/coinbase/client/models/asset.rb +1 -1
- data/lib/coinbase/client/models/balance.rb +1 -1
- data/lib/coinbase/client/models/broadcast_contract_invocation_request.rb +1 -1
- data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +1 -1
- data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
- data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
- data/lib/coinbase/client/models/build_staking_operation_request.rb +2 -1
- data/lib/coinbase/client/models/contract_event.rb +1 -1
- data/lib/coinbase/client/models/contract_event_list.rb +1 -1
- data/lib/coinbase/client/models/contract_invocation.rb +1 -1
- data/lib/coinbase/client/models/contract_invocation_list.rb +1 -1
- data/lib/coinbase/client/models/create_address_request.rb +1 -1
- data/lib/coinbase/client/models/create_contract_invocation_request.rb +1 -1
- data/lib/coinbase/client/models/create_fund_operation_request.rb +1 -1
- data/lib/coinbase/client/models/create_fund_quote_request.rb +1 -1
- data/lib/coinbase/client/models/create_payload_signature_request.rb +1 -1
- data/lib/coinbase/client/models/create_server_signer_request.rb +1 -1
- data/lib/coinbase/client/models/create_smart_contract_request.rb +1 -1
- data/lib/coinbase/client/models/create_staking_operation_request.rb +2 -1
- data/lib/coinbase/client/models/create_trade_request.rb +1 -1
- data/lib/coinbase/client/models/create_transfer_request.rb +1 -1
- data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
- data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
- data/lib/coinbase/client/models/create_wallet_webhook_request.rb +1 -1
- data/lib/coinbase/client/models/create_webhook_request.rb +1 -1
- data/lib/coinbase/client/models/crypto_amount.rb +1 -1
- data/lib/coinbase/client/models/deploy_smart_contract_request.rb +1 -1
- data/lib/coinbase/client/models/erc20_transfer_event.rb +1 -1
- data/lib/coinbase/client/models/erc721_transfer_event.rb +1 -1
- data/lib/coinbase/client/models/error.rb +1 -1
- data/lib/coinbase/client/models/ethereum_token_transfer.rb +1 -1
- data/lib/coinbase/client/models/ethereum_transaction.rb +1 -1
- data/lib/coinbase/client/models/ethereum_transaction_access.rb +1 -1
- data/lib/coinbase/client/models/ethereum_transaction_access_list.rb +1 -1
- data/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb +1 -1
- data/lib/coinbase/client/models/ethereum_validator_metadata.rb +1 -1
- data/lib/coinbase/client/models/faucet_transaction.rb +1 -1
- data/lib/coinbase/client/models/feature_set.rb +1 -1
- data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +1 -1
- data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +1 -1
- data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +1 -1
- data/lib/coinbase/client/models/fiat_amount.rb +1 -1
- data/lib/coinbase/client/models/fund_operation.rb +1 -1
- data/lib/coinbase/client/models/fund_operation_fees.rb +1 -1
- data/lib/coinbase/client/models/fund_operation_list.rb +1 -1
- data/lib/coinbase/client/models/fund_quote.rb +1 -1
- data/lib/coinbase/client/models/get_staking_context_request.rb +2 -1
- data/lib/coinbase/client/models/historical_balance.rb +1 -1
- data/lib/coinbase/client/models/multi_token_contract_options.rb +1 -1
- data/lib/coinbase/client/models/network.rb +1 -1
- data/lib/coinbase/client/models/network_identifier.rb +1 -1
- data/lib/coinbase/client/models/nft_contract_options.rb +1 -1
- data/lib/coinbase/client/models/onchain_name.rb +1 -1
- data/lib/coinbase/client/models/onchain_name_list.rb +1 -1
- data/lib/coinbase/client/models/payload_signature.rb +1 -1
- data/lib/coinbase/client/models/payload_signature_list.rb +1 -1
- data/lib/coinbase/client/models/read_contract_request.rb +1 -1
- data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
- data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
- data/lib/coinbase/client/models/server_signer.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
- data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
- data/lib/coinbase/client/models/server_signer_list.rb +1 -1
- data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
- data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
- data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +1 -1
- data/lib/coinbase/client/models/smart_contract.rb +1 -1
- data/lib/coinbase/client/models/smart_contract_list.rb +1 -1
- data/lib/coinbase/client/models/smart_contract_options.rb +1 -1
- data/lib/coinbase/client/models/smart_contract_type.rb +1 -1
- data/lib/coinbase/client/models/solidity_value.rb +3 -3
- data/lib/coinbase/client/models/sponsored_send.rb +1 -1
- data/lib/coinbase/client/models/staking_balance.rb +1 -1
- data/lib/coinbase/client/models/staking_context.rb +1 -1
- data/lib/coinbase/client/models/staking_context_context.rb +1 -1
- data/lib/coinbase/client/models/staking_operation.rb +1 -1
- data/lib/coinbase/client/models/staking_operation_metadata.rb +1 -1
- data/lib/coinbase/client/models/staking_reward.rb +1 -1
- data/lib/coinbase/client/models/staking_reward_format.rb +1 -1
- data/lib/coinbase/client/models/staking_reward_usd_value.rb +1 -1
- data/lib/coinbase/client/models/token_contract_options.rb +1 -1
- data/lib/coinbase/client/models/token_transfer_type.rb +1 -1
- data/lib/coinbase/client/models/trade.rb +1 -1
- data/lib/coinbase/client/models/trade_list.rb +1 -1
- data/lib/coinbase/client/models/transaction.rb +1 -1
- data/lib/coinbase/client/models/transaction_content.rb +1 -1
- data/lib/coinbase/client/models/transaction_type.rb +1 -1
- data/lib/coinbase/client/models/transfer.rb +1 -1
- data/lib/coinbase/client/models/transfer_list.rb +1 -1
- data/lib/coinbase/client/models/update_webhook_request.rb +1 -1
- data/lib/coinbase/client/models/user.rb +1 -1
- data/lib/coinbase/client/models/validator.rb +1 -1
- data/lib/coinbase/client/models/validator_details.rb +1 -1
- data/lib/coinbase/client/models/validator_list.rb +1 -1
- data/lib/coinbase/client/models/validator_status.rb +1 -1
- data/lib/coinbase/client/models/wallet.rb +1 -1
- data/lib/coinbase/client/models/wallet_list.rb +1 -1
- data/lib/coinbase/client/models/webhook.rb +1 -1
- data/lib/coinbase/client/models/webhook_event_filter.rb +1 -1
- data/lib/coinbase/client/models/webhook_event_type.rb +1 -1
- data/lib/coinbase/client/models/webhook_event_type_filter.rb +1 -1
- data/lib/coinbase/client/models/webhook_list.rb +1 -1
- data/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +1 -1
- data/lib/coinbase/client/version.rb +1 -1
- data/lib/coinbase/client.rb +6 -3
- data/lib/coinbase/crypto_amount.rb +62 -0
- data/lib/coinbase/fiat_amount.rb +40 -0
- data/lib/coinbase/fund_operation.rb +228 -0
- data/lib/coinbase/fund_quote.rb +149 -0
- data/lib/coinbase/smart_contract.rb +2 -2
- data/lib/coinbase/staking_operation.rb +2 -2
- data/lib/coinbase/validator.rb +7 -10
- data/lib/coinbase/version.rb +1 -1
- data/lib/coinbase/wallet.rb +13 -1
- data/lib/coinbase.rb +4 -0
- metadata +11 -4
- data/lib/coinbase/client/api/validators_api.rb +0 -179
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.
|
9
|
+
Generator version: 7.9.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -132,7 +132,7 @@ module Coinbase::Client
|
|
132
132
|
def valid?
|
133
133
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
134
134
|
return false if @type.nil?
|
135
|
-
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"])
|
135
|
+
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"])
|
136
136
|
return false unless type_validator.valid?(@type)
|
137
137
|
true
|
138
138
|
end
|
@@ -140,7 +140,7 @@ module Coinbase::Client
|
|
140
140
|
# Custom attribute writer method checking allowed values (enum).
|
141
141
|
# @param [Object] type Object to be assigned
|
142
142
|
def type=(type)
|
143
|
-
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"])
|
143
|
+
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"])
|
144
144
|
unless validator.valid?(type)
|
145
145
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
146
146
|
end
|
data/lib/coinbase/client.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.
|
9
|
+
Generator version: 7.9.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -21,6 +21,9 @@ Coinbase::Client.autoload :Address, 'coinbase/client/models/address'
|
|
21
21
|
Coinbase::Client.autoload :AddressBalanceList, 'coinbase/client/models/address_balance_list'
|
22
22
|
Coinbase::Client.autoload :AddressHistoricalBalanceList, 'coinbase/client/models/address_historical_balance_list'
|
23
23
|
Coinbase::Client.autoload :AddressList, 'coinbase/client/models/address_list'
|
24
|
+
Coinbase::Client.autoload :AddressReputation, 'coinbase/client/models/address_reputation'
|
25
|
+
Coinbase::Client.autoload :AddressReputationMetadata, 'coinbase/client/models/address_reputation_metadata'
|
26
|
+
Coinbase::Client.autoload :AddressRisk, 'coinbase/client/models/address_risk'
|
24
27
|
Coinbase::Client.autoload :AddressTransactionList, 'coinbase/client/models/address_transaction_list'
|
25
28
|
Coinbase::Client.autoload :Asset, 'coinbase/client/models/asset'
|
26
29
|
Coinbase::Client.autoload :Balance, 'coinbase/client/models/balance'
|
@@ -135,8 +138,10 @@ Coinbase::Client.autoload :ContractEventsApi, 'coinbase/client/api/contract_even
|
|
135
138
|
Coinbase::Client.autoload :ContractInvocationsApi, 'coinbase/client/api/contract_invocations_api'
|
136
139
|
Coinbase::Client.autoload :ExternalAddressesApi, 'coinbase/client/api/external_addresses_api'
|
137
140
|
Coinbase::Client.autoload :FundApi, 'coinbase/client/api/fund_api'
|
141
|
+
Coinbase::Client.autoload :MPCWalletStakeApi, 'coinbase/client/api/mpc_wallet_stake_api'
|
138
142
|
Coinbase::Client.autoload :NetworksApi, 'coinbase/client/api/networks_api'
|
139
143
|
Coinbase::Client.autoload :OnchainIdentityApi, 'coinbase/client/api/onchain_identity_api'
|
144
|
+
Coinbase::Client.autoload :ReputationApi, 'coinbase/client/api/reputation_api'
|
140
145
|
Coinbase::Client.autoload :ServerSignersApi, 'coinbase/client/api/server_signers_api'
|
141
146
|
Coinbase::Client.autoload :SmartContractsApi, 'coinbase/client/api/smart_contracts_api'
|
142
147
|
Coinbase::Client.autoload :StakeApi, 'coinbase/client/api/stake_api'
|
@@ -144,8 +149,6 @@ Coinbase::Client.autoload :TradesApi, 'coinbase/client/api/trades_api'
|
|
144
149
|
Coinbase::Client.autoload :TransactionHistoryApi, 'coinbase/client/api/transaction_history_api'
|
145
150
|
Coinbase::Client.autoload :TransfersApi, 'coinbase/client/api/transfers_api'
|
146
151
|
Coinbase::Client.autoload :UsersApi, 'coinbase/client/api/users_api'
|
147
|
-
Coinbase::Client.autoload :ValidatorsApi, 'coinbase/client/api/validators_api'
|
148
|
-
Coinbase::Client.autoload :WalletStakeApi, 'coinbase/client/api/wallet_stake_api'
|
149
152
|
Coinbase::Client.autoload :WalletsApi, 'coinbase/client/api/wallets_api'
|
150
153
|
Coinbase::Client.autoload :WebhooksApi, 'coinbase/client/api/webhooks_api'
|
151
154
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Coinbase
|
4
|
+
# A representation of a CryptoAmount that includes the amount and asset.
|
5
|
+
class CryptoAmount
|
6
|
+
# Converts a Coinbase::Client::CryptoAmount model to a Coinbase::CryptoAmount
|
7
|
+
# @param amount_model [Coinbase::Client::CryptoAmount] The crypto amount from the API.
|
8
|
+
# @return [CryptoAmount] The converted CryptoAmount object.
|
9
|
+
def self.from_model(amount_model)
|
10
|
+
asset = Coinbase::Asset.from_model(amount_model.asset)
|
11
|
+
|
12
|
+
new(amount: asset.from_atomic_amount(amount_model.amount), asset: asset)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Converts a Coinbase::Client::CryptoAmount model and asset ID to a Coinbase::CryptoAmount
|
16
|
+
# This can be used to specify a non-primary denomination that we want the amount
|
17
|
+
# to be converted to.
|
18
|
+
# @param amount_model [Coinbase::Client::CryptoAmount] The crypto amount from the API.
|
19
|
+
# @param asset_id [Symbol] The Asset ID of the denomination we want returned.
|
20
|
+
# @return [CryptoAmount] The converted CryptoAmount object.
|
21
|
+
def self.from_model_and_asset_id(amount_model, asset_id)
|
22
|
+
asset = Coinbase::Asset.from_model(amount_model.asset, asset_id: asset_id)
|
23
|
+
|
24
|
+
new(
|
25
|
+
amount: asset.from_atomic_amount(amount_model.amount),
|
26
|
+
asset: asset,
|
27
|
+
asset_id: asset_id
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns a new CryptoAmount object. Do not use this method.
|
32
|
+
# Instead, use CryptoAmount.from_model or CryptoAmount.from_model_and_asset_id.
|
33
|
+
# @param amount [BigDecimal] The amount of the Asset
|
34
|
+
# @param asset [Coinbase::Asset] The Asset
|
35
|
+
# @param asset_id [Symbol] The Asset ID
|
36
|
+
def initialize(amount:, asset:, asset_id: nil)
|
37
|
+
@amount = amount
|
38
|
+
@asset = asset
|
39
|
+
@asset_id = asset_id || asset.asset_id
|
40
|
+
end
|
41
|
+
|
42
|
+
attr_reader :amount, :asset, :asset_id
|
43
|
+
|
44
|
+
# Returns the amount in atomic units.
|
45
|
+
# @return [BigDecimal] the amount in atomic units
|
46
|
+
def to_atomic_amount
|
47
|
+
asset.to_atomic_amount(amount)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns a string representation of the CryptoAmount.
|
51
|
+
# @return [String] a string representation of the CryptoAmount
|
52
|
+
def to_s
|
53
|
+
Coinbase.pretty_print_object(self.class, amount: amount.to_s('F'), asset_id: asset_id)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Same as to_s.
|
57
|
+
# @return [String] a string representation of the CryptoAmount
|
58
|
+
def inspect
|
59
|
+
to_s
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Coinbase
|
4
|
+
# A representation of a FiatAmount that includes the amount and fiat.
|
5
|
+
class FiatAmount
|
6
|
+
# Converts a Coinbase::Client::FiatAmount model to a Coinbase::FiatAmount
|
7
|
+
# @param model [Coinbase::Client::FiatAmount] The crypto amount from the API.
|
8
|
+
# @return [FiatAmount] The converted FiatAmount object.
|
9
|
+
def self.from_model(model)
|
10
|
+
unless model.is_a?(Coinbase::Client::FiatAmount)
|
11
|
+
raise ArgumentError,
|
12
|
+
'model must be a Coinbase::Client::FiatAmount'
|
13
|
+
end
|
14
|
+
|
15
|
+
new(amount: model.amount, currency: model.currency)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns a new FiatAmount object.
|
19
|
+
# @param amount [BigDecimal, String] The amount of the Fiat Currency
|
20
|
+
# @param currency [Symbol, String] The currency of the Fiat Amount
|
21
|
+
def initialize(amount:, currency:)
|
22
|
+
@amount = BigDecimal(amount)
|
23
|
+
@currency = Coinbase.to_sym(currency)
|
24
|
+
end
|
25
|
+
|
26
|
+
attr_reader :amount, :currency
|
27
|
+
|
28
|
+
# Returns a string representation of the FiatAmount.
|
29
|
+
# @return [String] a string representation of the FiatAmount
|
30
|
+
def to_s
|
31
|
+
Coinbase.pretty_print_object(self.class, amount: amount.to_s('F'), currency: currency)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Same as to_s.
|
35
|
+
# @return [String] a string representation of the FiatAmount
|
36
|
+
def inspect
|
37
|
+
to_s
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|