Skip to content

Commit

Permalink
Merge pull request #214 from coinbase/v0.10.0
Browse files Browse the repository at this point in the history
Release V0.10.0
  • Loading branch information
alex-stone authored Oct 31, 2024
2 parents 4352c77 + 605dfb2 commit d20e7ab
Show file tree
Hide file tree
Showing 39 changed files with 5,165 additions and 44 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.10.0] - 2024-10-31
- Include ERC20 and ERC721 token transfer information into transaction content.
- Add support for reading from smart contracts.

## [0.9.0] - Skipped

## [0.8.0] - Skipped

## [0.7.0] - 2024-09-26

### Added
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ testnet ETH. You are allowed one faucet claim per 24-hour window.
# Fund the wallet with a faucet transaction.
faucet_tx = wallet1.faucet

# Wait for the faucet transaction to complete.
faucet_tx.wait!

puts "Faucet transaction successfully completed: #{faucet_tx}"
```

Expand Down
11 changes: 8 additions & 3 deletions lib/coinbase/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,16 @@ def transactions
# @raise [Coinbase::FaucetLimitReachedError] If the faucet limit has been reached for the address or user.
# @raise [Coinbase::Client::ApiError] If an unexpected error occurs while requesting faucet funds.
def faucet(asset_id: nil)
opts = { asset_id: asset_id }.compact

Coinbase.call_api do
Coinbase::FaucetTransaction.new(
addresses_api.request_external_faucet_funds(network.normalized_id, id, opts)
addresses_api.request_external_faucet_funds(
network.normalized_id,
id,
{
asset_id: asset_id,
skip_wait: true
}.compact
)
)
end
end
Expand Down
17 changes: 17 additions & 0 deletions lib/coinbase/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
Coinbase::Client.autoload :ContractInvocationList, 'coinbase/client/models/contract_invocation_list'
Coinbase::Client.autoload :CreateAddressRequest, 'coinbase/client/models/create_address_request'
Coinbase::Client.autoload :CreateContractInvocationRequest, 'coinbase/client/models/create_contract_invocation_request'
Coinbase::Client.autoload :CreateFundOperationRequest, 'coinbase/client/models/create_fund_operation_request'
Coinbase::Client.autoload :CreateFundQuoteRequest, 'coinbase/client/models/create_fund_quote_request'
Coinbase::Client.autoload :CreatePayloadSignatureRequest, 'coinbase/client/models/create_payload_signature_request'
Coinbase::Client.autoload :CreateServerSignerRequest, 'coinbase/client/models/create_server_signer_request'
Coinbase::Client.autoload :CreateSmartContractRequest, 'coinbase/client/models/create_smart_contract_request'
Expand All @@ -43,11 +45,14 @@
Coinbase::Client.autoload :CreateTransferRequest, 'coinbase/client/models/create_transfer_request'
Coinbase::Client.autoload :CreateWalletRequest, 'coinbase/client/models/create_wallet_request'
Coinbase::Client.autoload :CreateWalletRequestWallet, 'coinbase/client/models/create_wallet_request_wallet'
Coinbase::Client.autoload :CreateWalletWebhookRequest, 'coinbase/client/models/create_wallet_webhook_request'
Coinbase::Client.autoload :CreateWebhookRequest, 'coinbase/client/models/create_webhook_request'
Coinbase::Client.autoload :CryptoAmount, 'coinbase/client/models/crypto_amount'
Coinbase::Client.autoload :DeploySmartContractRequest, 'coinbase/client/models/deploy_smart_contract_request'
Coinbase::Client.autoload :ERC20TransferEvent, 'coinbase/client/models/erc20_transfer_event'
Coinbase::Client.autoload :ERC721TransferEvent, 'coinbase/client/models/erc721_transfer_event'
Coinbase::Client.autoload :Error, 'coinbase/client/models/error'
Coinbase::Client.autoload :EthereumTokenTransfer, 'coinbase/client/models/ethereum_token_transfer'
Coinbase::Client.autoload :EthereumTransaction, 'coinbase/client/models/ethereum_transaction'
Coinbase::Client.autoload :EthereumTransactionAccess, 'coinbase/client/models/ethereum_transaction_access'
Coinbase::Client.autoload :EthereumTransactionAccessList, 'coinbase/client/models/ethereum_transaction_access_list'
Expand All @@ -58,14 +63,22 @@
Coinbase::Client.autoload :FetchHistoricalStakingBalances200Response, 'coinbase/client/models/fetch_historical_staking_balances200_response'
Coinbase::Client.autoload :FetchStakingRewards200Response, 'coinbase/client/models/fetch_staking_rewards200_response'
Coinbase::Client.autoload :FetchStakingRewardsRequest, 'coinbase/client/models/fetch_staking_rewards_request'
Coinbase::Client.autoload :FiatAmount, 'coinbase/client/models/fiat_amount'
Coinbase::Client.autoload :FundOperation, 'coinbase/client/models/fund_operation'
Coinbase::Client.autoload :FundOperationFees, 'coinbase/client/models/fund_operation_fees'
Coinbase::Client.autoload :FundOperationList, 'coinbase/client/models/fund_operation_list'
Coinbase::Client.autoload :FundQuote, 'coinbase/client/models/fund_quote'
Coinbase::Client.autoload :GetStakingContextRequest, 'coinbase/client/models/get_staking_context_request'
Coinbase::Client.autoload :HistoricalBalance, 'coinbase/client/models/historical_balance'
Coinbase::Client.autoload :MultiTokenContractOptions, 'coinbase/client/models/multi_token_contract_options'
Coinbase::Client.autoload :NFTContractOptions, 'coinbase/client/models/nft_contract_options'
Coinbase::Client.autoload :Network, 'coinbase/client/models/network'
Coinbase::Client.autoload :NetworkIdentifier, 'coinbase/client/models/network_identifier'
Coinbase::Client.autoload :OnchainName, 'coinbase/client/models/onchain_name'
Coinbase::Client.autoload :OnchainNameList, 'coinbase/client/models/onchain_name_list'
Coinbase::Client.autoload :PayloadSignature, 'coinbase/client/models/payload_signature'
Coinbase::Client.autoload :PayloadSignatureList, 'coinbase/client/models/payload_signature_list'
Coinbase::Client.autoload :ReadContractRequest, 'coinbase/client/models/read_contract_request'
Coinbase::Client.autoload :SeedCreationEvent, 'coinbase/client/models/seed_creation_event'
Coinbase::Client.autoload :SeedCreationEventResult, 'coinbase/client/models/seed_creation_event_result'
Coinbase::Client.autoload :ServerSigner, 'coinbase/client/models/server_signer'
Expand All @@ -80,6 +93,7 @@
Coinbase::Client.autoload :SmartContractList, 'coinbase/client/models/smart_contract_list'
Coinbase::Client.autoload :SmartContractOptions, 'coinbase/client/models/smart_contract_options'
Coinbase::Client.autoload :SmartContractType, 'coinbase/client/models/smart_contract_type'
Coinbase::Client.autoload :SolidityValue, 'coinbase/client/models/solidity_value'
Coinbase::Client.autoload :SponsoredSend, 'coinbase/client/models/sponsored_send'
Coinbase::Client.autoload :StakingBalance, 'coinbase/client/models/staking_balance'
Coinbase::Client.autoload :StakingContext, 'coinbase/client/models/staking_context'
Expand All @@ -90,6 +104,7 @@
Coinbase::Client.autoload :StakingRewardFormat, 'coinbase/client/models/staking_reward_format'
Coinbase::Client.autoload :StakingRewardUSDValue, 'coinbase/client/models/staking_reward_usd_value'
Coinbase::Client.autoload :TokenContractOptions, 'coinbase/client/models/token_contract_options'
Coinbase::Client.autoload :TokenTransferType, 'coinbase/client/models/token_transfer_type'
Coinbase::Client.autoload :Trade, 'coinbase/client/models/trade'
Coinbase::Client.autoload :TradeList, 'coinbase/client/models/trade_list'
Coinbase::Client.autoload :Transaction, 'coinbase/client/models/transaction'
Expand Down Expand Up @@ -119,7 +134,9 @@
Coinbase::Client.autoload :ContractEventsApi, 'coinbase/client/api/contract_events_api'
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 :NetworksApi, 'coinbase/client/api/networks_api'
Coinbase::Client.autoload :OnchainIdentityApi, 'coinbase/client/api/onchain_identity_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'
Expand Down
78 changes: 78 additions & 0 deletions lib/coinbase/client/api/external_addresses_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,81 @@ def get_external_address_balance_with_http_info(network_id, address_id, asset_id
return data, status_code, headers
end

# Get the status of a faucet transaction
# Get the status of a faucet transaction
# @param network_id [String] The ID of the blockchain network
# @param address_id [String] The ID of the address to fetch the faucet transaction for
# @param tx_hash [String] The hash of the faucet transaction
# @param [Hash] opts the optional parameters
# @return [FaucetTransaction]
def get_faucet_transaction(network_id, address_id, tx_hash, opts = {})
data, _status_code, _headers = get_faucet_transaction_with_http_info(network_id, address_id, tx_hash, opts)
data
end

# Get the status of a faucet transaction
# Get the status of a faucet transaction
# @param network_id [String] The ID of the blockchain network
# @param address_id [String] The ID of the address to fetch the faucet transaction for
# @param tx_hash [String] The hash of the faucet transaction
# @param [Hash] opts the optional parameters
# @return [Array<(FaucetTransaction, Integer, Hash)>] FaucetTransaction data, response status code and response headers
def get_faucet_transaction_with_http_info(network_id, address_id, tx_hash, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ExternalAddressesApi.get_faucet_transaction ...'
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 ExternalAddressesApi.get_faucet_transaction"
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 ExternalAddressesApi.get_faucet_transaction"
end
# verify the required parameter 'tx_hash' is set
if @api_client.config.client_side_validation && tx_hash.nil?
fail ArgumentError, "Missing the required parameter 'tx_hash' when calling ExternalAddressesApi.get_faucet_transaction"
end
# resource path
local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/faucet/{tx_hash}'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'tx_hash' + '}', CGI.escape(tx_hash.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] || 'FaucetTransaction'

# auth_names
auth_names = opts[:debug_auth_names] || []

new_options = opts.merge(
:operation => :"ExternalAddressesApi.get_faucet_transaction",
: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: ExternalAddressesApi#get_faucet_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Get the balances of an external address
# List all of the balances of an external address
# @param network_id [String] The ID of the blockchain network
Expand Down Expand Up @@ -176,6 +251,7 @@ def list_external_address_balances_with_http_info(network_id, address_id, opts =
# @param address_id [String] The onchain address of the address that is being fetched.
# @param [Hash] opts the optional parameters
# @option opts [String] :asset_id The ID of the asset to transfer from the faucet.
# @option opts [Boolean] :skip_wait Whether to skip waiting for the transaction to be mined. This will become the default behavior in the future.
# @return [FaucetTransaction]
def request_external_faucet_funds(network_id, address_id, opts = {})
data, _status_code, _headers = request_external_faucet_funds_with_http_info(network_id, address_id, opts)
Expand All @@ -188,6 +264,7 @@ def request_external_faucet_funds(network_id, address_id, opts = {})
# @param address_id [String] The onchain address of the address that is being fetched.
# @param [Hash] opts the optional parameters
# @option opts [String] :asset_id The ID of the asset to transfer from the faucet.
# @option opts [Boolean] :skip_wait Whether to skip waiting for the transaction to be mined. This will become the default behavior in the future.
# @return [Array<(FaucetTransaction, Integer, Hash)>] FaucetTransaction data, response status code and response headers
def request_external_faucet_funds_with_http_info(network_id, address_id, opts = {})
if @api_client.config.debugging
Expand All @@ -207,6 +284,7 @@ def request_external_faucet_funds_with_http_info(network_id, address_id, opts =
# query parameters
query_params = opts[:query_params] || {}
query_params[:'asset_id'] = opts[:'asset_id'] if !opts[:'asset_id'].nil?
query_params[:'skip_wait'] = opts[:'skip_wait'] if !opts[:'skip_wait'].nil?

# header parameters
header_params = opts[:header_params] || {}
Expand Down
Loading

0 comments on commit d20e7ab

Please sign in to comment.