Skip to content

Commit

Permalink
chore: Bump OpenAPI clients
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-stone committed Dec 11, 2024
1 parent 6b92ca0 commit 4878fcc
Show file tree
Hide file tree
Showing 13 changed files with 811 additions and 150 deletions.
4 changes: 3 additions & 1 deletion lib/coinbase/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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 @@ -82,6 +81,7 @@
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 :RegisterSmartContractRequest, 'coinbase/client/models/register_smart_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 @@ -93,6 +93,7 @@
Coinbase::Client.autoload :SignatureCreationEventResult, 'coinbase/client/models/signature_creation_event_result'
Coinbase::Client.autoload :SignedVoluntaryExitMessageMetadata, 'coinbase/client/models/signed_voluntary_exit_message_metadata'
Coinbase::Client.autoload :SmartContract, 'coinbase/client/models/smart_contract'
Coinbase::Client.autoload :SmartContractActivityEvent, 'coinbase/client/models/smart_contract_activity_event'
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'
Expand Down Expand Up @@ -128,6 +129,7 @@
Coinbase::Client.autoload :WebhookEventType, 'coinbase/client/models/webhook_event_type'
Coinbase::Client.autoload :WebhookEventTypeFilter, 'coinbase/client/models/webhook_event_type_filter'
Coinbase::Client.autoload :WebhookList, 'coinbase/client/models/webhook_list'
Coinbase::Client.autoload :WebhookSmartContractEventFilter, 'coinbase/client/models/webhook_smart_contract_event_filter'
Coinbase::Client.autoload :WebhookWalletActivityFilter, 'coinbase/client/models/webhook_wallet_activity_filter'

# APIs
Expand Down
69 changes: 0 additions & 69 deletions lib/coinbase/client/api/reputation_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,74 +87,5 @@ def get_address_reputation_with_http_info(network_id, address_id, opts = {})
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
107 changes: 87 additions & 20 deletions lib/coinbase/client/api/smart_contracts_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,40 +260,31 @@ def get_smart_contract_with_http_info(wallet_id, address_id, smart_contract_id,
return data, status_code, headers
end

# List smart contracts deployed by address
# List all smart contracts deployed by address.
# @param wallet_id [String] The ID of the wallet the address belongs to.
# @param address_id [String] The ID of the address to fetch the smart contracts for.
# List smart contracts
# List smart contracts
# @param [Hash] opts the optional parameters
# @option opts [String] :page Pagination token for retrieving the next set of results
# @return [SmartContractList]
def list_smart_contracts(wallet_id, address_id, opts = {})
data, _status_code, _headers = list_smart_contracts_with_http_info(wallet_id, address_id, opts)
def list_smart_contracts(opts = {})
data, _status_code, _headers = list_smart_contracts_with_http_info(opts)
data
end

# List smart contracts deployed by address
# List all smart contracts deployed by address.
# @param wallet_id [String] The ID of the wallet the address belongs to.
# @param address_id [String] The ID of the address to fetch the smart contracts for.
# List smart contracts
# List smart contracts
# @param [Hash] opts the optional parameters
# @option opts [String] :page Pagination token for retrieving the next set of results
# @return [Array<(SmartContractList, Integer, Hash)>] SmartContractList data, response status code and response headers
def list_smart_contracts_with_http_info(wallet_id, address_id, opts = {})
def list_smart_contracts_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SmartContractsApi.list_smart_contracts ...'
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 SmartContractsApi.list_smart_contracts"
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 SmartContractsApi.list_smart_contracts"
end
# resource path
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
local_var_path = '/v1/smart_contracts'

# query parameters
query_params = opts[:query_params] || {}
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?

# header parameters
header_params = opts[:header_params] || {}
Expand Down Expand Up @@ -408,5 +399,81 @@ def read_contract_with_http_info(network_id, contract_address, read_contract_req
end
return data, status_code, headers
end

# Register a smart contract
# Register a smart contract
# @param network_id [String] The ID of the network to fetch.
# @param contract_address [String] EVM address of the smart contract (42 characters, including &#39;0x&#39;, in lowercase)
# @param [Hash] opts the optional parameters
# @option opts [RegisterSmartContractRequest] :register_smart_contract_request
# @return [SmartContract]
def register_smart_contract(network_id, contract_address, opts = {})
data, _status_code, _headers = register_smart_contract_with_http_info(network_id, contract_address, opts)
data
end

# Register a smart contract
# Register a smart contract
# @param network_id [String] The ID of the network to fetch.
# @param contract_address [String] EVM address of the smart contract (42 characters, including &#39;0x&#39;, in lowercase)
# @param [Hash] opts the optional parameters
# @option opts [RegisterSmartContractRequest] :register_smart_contract_request
# @return [Array<(SmartContract, Integer, Hash)>] SmartContract data, response status code and response headers
def register_smart_contract_with_http_info(network_id, contract_address, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SmartContractsApi.register_smart_contract ...'
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 SmartContractsApi.register_smart_contract"
end
# verify the required parameter 'contract_address' is set
if @api_client.config.client_side_validation && contract_address.nil?
fail ArgumentError, "Missing the required parameter 'contract_address' when calling SmartContractsApi.register_smart_contract"
end
# resource path
local_var_path = '/v1/networks/{network_id}/smart_contracts/{contract_address}/register'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'contract_address' + '}', CGI.escape(contract_address.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']
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'register_smart_contract_request'])

# return_type
return_type = opts[:debug_return_type] || 'SmartContract'

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

new_options = opts.merge(
:operation => :"SmartContractsApi.register_smart_contract",
: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(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: SmartContractsApi#register_smart_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end
23 changes: 15 additions & 8 deletions lib/coinbase/client/models/address_reputation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
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
# The score of a wallet address, ranging from -100 to 100. A negative score indicates a bad reputation, while a positive score indicates a good reputation.
attr_accessor :score

attr_accessor :metadata

# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'reputation_score' => :'reputation_score',
:'score' => :'score',
:'metadata' => :'metadata'
}
end
Expand All @@ -37,7 +37,7 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
:'reputation_score' => :'Integer',
:'score' => :'Integer',
:'metadata' => :'AddressReputationMetadata'
}
end
Expand All @@ -63,8 +63,10 @@ def initialize(attributes = {})
h[k.to_sym] = v
}

if attributes.key?(:'reputation_score')
self.reputation_score = attributes[:'reputation_score']
if attributes.key?(:'score')
self.score = attributes[:'score']
else
self.score = nil
end

if attributes.key?(:'metadata')
Expand All @@ -79,6 +81,10 @@ def initialize(attributes = {})
def list_invalid_properties
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
invalid_properties = Array.new
if @score.nil?
invalid_properties.push('invalid value for "score", score cannot be nil.')
end

if @metadata.nil?
invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
end
Expand All @@ -90,6 +96,7 @@ def list_invalid_properties
# @return true if the model is valid
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
return false if @score.nil?
return false if @metadata.nil?
true
end
Expand All @@ -99,7 +106,7 @@ def valid?
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
reputation_score == o.reputation_score &&
score == o.score &&
metadata == o.metadata
end

Expand All @@ -112,7 +119,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[reputation_score, metadata].hash
[score, metadata].hash
end

# Builds the object from hash
Expand Down
18 changes: 14 additions & 4 deletions lib/coinbase/client/models/ethereum_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class EthereumTransaction
# This is for handling optimism rollup specific EIP-2718 transaction type field.
attr_accessor :mint

# RLP encoded transaction as a hex string (prefixed with 0x) for native compatibility with popular eth clients such as etherjs, viem etc.
attr_accessor :rlp_encoded_tx

# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
Expand All @@ -86,7 +89,8 @@ def self.attribute_map
:'token_transfers' => :'token_transfers',
:'flattened_traces' => :'flattened_traces',
:'block_timestamp' => :'block_timestamp',
:'mint' => :'mint'
:'mint' => :'mint',
:'rlp_encoded_tx' => :'rlp_encoded_tx'
}
end

Expand Down Expand Up @@ -115,7 +119,8 @@ def self.openapi_types
:'token_transfers' => :'Array<EthereumTokenTransfer>',
:'flattened_traces' => :'Array<EthereumTransactionFlattenedTrace>',
:'block_timestamp' => :'Time',
:'mint' => :'String'
:'mint' => :'String',
:'rlp_encoded_tx' => :'String'
}
end

Expand Down Expand Up @@ -219,6 +224,10 @@ def initialize(attributes = {})
if attributes.key?(:'mint')
self.mint = attributes[:'mint']
end

if attributes.key?(:'rlp_encoded_tx')
self.rlp_encoded_tx = attributes[:'rlp_encoded_tx']
end
end

# Show invalid properties with the reasons. Usually used together with valid?
Expand Down Expand Up @@ -268,7 +277,8 @@ def ==(o)
token_transfers == o.token_transfers &&
flattened_traces == o.flattened_traces &&
block_timestamp == o.block_timestamp &&
mint == o.mint
mint == o.mint &&
rlp_encoded_tx == o.rlp_encoded_tx
end

# @see the `==` method
Expand All @@ -280,7 +290,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[from, gas, gas_price, hash, input, nonce, to, index, value, type, max_fee_per_gas, max_priority_fee_per_gas, priority_fee_per_gas, transaction_access_list, token_transfers, flattened_traces, block_timestamp, mint].hash
[from, gas, gas_price, hash, input, nonce, to, index, value, type, max_fee_per_gas, max_priority_fee_per_gas, priority_fee_per_gas, transaction_access_list, token_transfers, flattened_traces, block_timestamp, mint, rlp_encoded_tx].hash
end

# Builds the object from hash
Expand Down
Loading

0 comments on commit 4878fcc

Please sign in to comment.