Skip to content

Commit

Permalink
Merge pull request #219 from coinbase/v0.11.0
Browse files Browse the repository at this point in the history
Release V0.11.0
  • Loading branch information
alex-stone authored Nov 27, 2024
2 parents d20e7ab + 45ee756 commit 6b92ca0
Show file tree
Hide file tree
Showing 165 changed files with 3,154 additions and 376 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions lib/coinbase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
28 changes: 28 additions & 0 deletions lib/coinbase/address/wallet_address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/balance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions lib/coinbase/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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'
Expand Down Expand Up @@ -135,17 +138,17 @@
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'
Coinbase::Client.autoload :TradesApi, 'coinbase/client/api/trades_api'
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'

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/addresses_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/assets_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/balance_history_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/contract_events_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/contract_invocations_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/external_addresses_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/fund_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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))
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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))
Expand All @@ -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,
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/networks_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/onchain_identity_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

0 comments on commit 6b92ca0

Please sign in to comment.