Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.4

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.4

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
ruby: ['3.0', '3.1', '3.2', '3.3', '3.4']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require:
AllCops:
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0
Exclude:
# Exclude autogenerated files.
- "lib/coinbase/client.rb"
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +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).

## [0.14.0] - 2025-01-14

### Added
- Add `skip_batching` option to `Wallet.transfer` to allow for lower latency gasless transfers.

### Breaking
- Removed support for EOL Ruby v2.7

## [0.13.0] - 2024-12-19

### Added
Expand Down Expand Up @@ -216,4 +224,4 @@ Initial release of the Coinbase Ruby SDK. Purely client-side implementation.
- Wallet creation and export
- Address creation
- Send and receive ETH
- Supported networks: Base Sepolia
- Supported networks: Base Sepolia
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ The SDK supports various verbs on Developer-custodied Wallets across multiple ne

Make sure that your developer environment satisfies all of the requirements before proceeding through the quickstart.

### Ruby 2.7+
### Ruby 3+

The Coinbase server-side SDK requires Ruby 2.7 or higher (we recommend 2.7.5). To view your currently installed version of Ruby, run
The Coinbase server-side SDK requires Ruby 3.0 or higher. To view your currently installed version of Ruby, run
the following from the command-line:

```bash
Expand All @@ -30,11 +30,11 @@ ruby -v
We recommend installing and managing Ruby versions with `rbenv`.
See [Using Package Managers](https://github.com/rbenv/rbenv?tab=readme-ov-file#homebrew) in the rbenv README for instructions on how to install `rbenv`.

Once `rbenv` has been installed, you can install and use Ruby 2.7.5 by running the following commands:
Once `rbenv` has been installed, you can install and use Ruby v3 by running the following commands:

```bash
rbenv install 2.7.5
rbenv global 2.7.5
rbenv install 3.3.0
rbenv global 3.3.0
```

### Rbsecp256k1 Gem
Expand Down Expand Up @@ -218,6 +218,12 @@ puts "Wallet successfully created: #{wallet3}"
transfer = wallet1.transfer(0.00001, :usdc, wallet3, gasless: true).wait!
```

By default, gasless transfers are batched with other transfers, and might take longer to submit. If you want to opt out of batching, you can set the `skip_batching` option to `True`, which will submit the transaction immediately.

```ruby
transfer = wallet1.transfer(0.00001, "usdc", wallet3, gasless: true, skip_batching: true).wait!
```

## Listing Transfers

```
Expand Down Expand Up @@ -334,11 +340,11 @@ See [External Addresses docs](./docs/external-addresses.md) for more information

### Ruby Version

Developing in this repository requires Ruby >= 2.7.0. To install this on an M2 Mac,
Developing in this repository requires Ruby >= 3.0.0. To install this on an M2 Mac,
run the [following command](https://github.com/rbenv/ruby-build/discussions/2034):

```bash
RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC rbenv install 2.7.0
RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC rbenv install 3.3.0
```

### Set-up
Expand Down
2 changes: 1 addition & 1 deletion coinbase.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
spec.email = 'yuga.cohler@coinbase.com'
spec.homepage = 'https://github.com/coinbase/coinbase-sdk-ruby'
spec.license = 'Apache-2.0'
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')

spec.metadata['rubygems_mfa_required'] = 'true'

Expand Down
9 changes: 6 additions & 3 deletions lib/coinbase/address/wallet_address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ def key=(key)
# default address. If a String, interprets it as the address ID.
# @param gasless [Boolean] Whether gas fee for the transfer should be covered by Coinbase.
# Defaults to false. Check the API documentation for network and asset support.
# Whether the transfer should be gasless. Defaults to false.
# @param skip_batching [Boolean] When true, the Transfer will be submitted immediately.
# Otherwise, the Transfer will be batched.
# Defaults to false. Note: requires gasless option to be set to true.
# @return [Coinbase::Transfer] The Transfer object.
def transfer(amount, asset_id, destination, gasless: false)
def transfer(amount, asset_id, destination, gasless: false, skip_batching: false)
ensure_can_sign!
ensure_sufficient_balance!(amount, asset_id)

Expand All @@ -54,7 +56,8 @@ def transfer(amount, asset_id, destination, gasless: false)
destination: destination,
network: network,
wallet_id: wallet_id,
gasless: gasless
gasless: gasless,
skip_batching: skip_batching
)

# If a server signer is managing keys, it will sign and broadcast the underlying transfer transaction out of band.
Expand Down
3 changes: 2 additions & 1 deletion 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.10.0
Generator version: 7.9.0

=end

Expand All @@ -30,6 +30,7 @@
Coinbase::Client.autoload :BroadcastExternalTransferRequest, 'coinbase/client/models/broadcast_external_transfer_request'
Coinbase::Client.autoload :BroadcastStakingOperationRequest, 'coinbase/client/models/broadcast_staking_operation_request'
Coinbase::Client.autoload :BroadcastTradeRequest, 'coinbase/client/models/broadcast_trade_request'
Coinbase::Client.autoload :BroadcastTransferRequest, 'coinbase/client/models/broadcast_transfer_request'
Coinbase::Client.autoload :BuildStakingOperationRequest, 'coinbase/client/models/build_staking_operation_request'
Coinbase::Client.autoload :ContractEvent, 'coinbase/client/models/contract_event'
Coinbase::Client.autoload :ContractEventList, 'coinbase/client/models/contract_event_list'
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.10.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.10.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.10.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.10.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.10.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.10.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.10.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/mpc_wallet_stake_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.10.0
Generator version: 7.9.0

=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.10.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.10.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/reputation_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.10.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/server_signers_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.10.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/smart_contracts_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.10.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/stake_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.10.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/trades_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.10.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/transaction_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.10.0
Generator version: 7.9.0

=end

Expand Down
20 changes: 10 additions & 10 deletions lib/coinbase/client/api/transfers_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.10.0
Generator version: 7.9.0

=end

Expand All @@ -24,11 +24,11 @@ def initialize(api_client = ApiClient.default)
# @param wallet_id [String] The ID of the wallet the address belongs to
# @param address_id [String] The ID of the address the transfer belongs to
# @param transfer_id [String] The ID of the transfer to broadcast
# @param broadcast_external_transfer_request [BroadcastExternalTransferRequest]
# @param broadcast_transfer_request [BroadcastTransferRequest]
# @param [Hash] opts the optional parameters
# @return [Transfer]
def broadcast_transfer(wallet_id, address_id, transfer_id, broadcast_external_transfer_request, opts = {})
data, _status_code, _headers = broadcast_transfer_with_http_info(wallet_id, address_id, transfer_id, broadcast_external_transfer_request, opts)
def broadcast_transfer(wallet_id, address_id, transfer_id, broadcast_transfer_request, opts = {})
data, _status_code, _headers = broadcast_transfer_with_http_info(wallet_id, address_id, transfer_id, broadcast_transfer_request, opts)
data
end

Expand All @@ -37,10 +37,10 @@ def broadcast_transfer(wallet_id, address_id, transfer_id, broadcast_external_tr
# @param wallet_id [String] The ID of the wallet the address belongs to
# @param address_id [String] The ID of the address the transfer belongs to
# @param transfer_id [String] The ID of the transfer to broadcast
# @param broadcast_external_transfer_request [BroadcastExternalTransferRequest]
# @param broadcast_transfer_request [BroadcastTransferRequest]
# @param [Hash] opts the optional parameters
# @return [Array<(Transfer, Integer, Hash)>] Transfer data, response status code and response headers
def broadcast_transfer_with_http_info(wallet_id, address_id, transfer_id, broadcast_external_transfer_request, opts = {})
def broadcast_transfer_with_http_info(wallet_id, address_id, transfer_id, broadcast_transfer_request, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TransfersApi.broadcast_transfer ...'
end
Expand All @@ -56,9 +56,9 @@ def broadcast_transfer_with_http_info(wallet_id, address_id, transfer_id, broadc
if @api_client.config.client_side_validation && transfer_id.nil?
fail ArgumentError, "Missing the required parameter 'transfer_id' when calling TransfersApi.broadcast_transfer"
end
# verify the required parameter 'broadcast_external_transfer_request' is set
if @api_client.config.client_side_validation && broadcast_external_transfer_request.nil?
fail ArgumentError, "Missing the required parameter 'broadcast_external_transfer_request' when calling TransfersApi.broadcast_transfer"
# verify the required parameter 'broadcast_transfer_request' is set
if @api_client.config.client_side_validation && broadcast_transfer_request.nil?
fail ArgumentError, "Missing the required parameter 'broadcast_transfer_request' when calling TransfersApi.broadcast_transfer"
end
# resource path
local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/transfers/{transfer_id}/broadcast'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'transfer_id' + '}', CGI.escape(transfer_id.to_s))
Expand All @@ -80,7 +80,7 @@ def broadcast_transfer_with_http_info(wallet_id, address_id, transfer_id, broadc
form_params = opts[:form_params] || {}

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

# return_type
return_type = opts[:debug_return_type] || 'Transfer'
Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/users_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.10.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/wallets_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.10.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/coinbase/client/api/webhooks_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.10.0
Generator version: 7.9.0

=end

Expand Down
Loading
Loading