diff --git a/.gitignore b/.gitignore index a4095614..bae78fe5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ Gemfile.lock lib/**/.DS_Store .idea .DS_Store -seeds.json \ No newline at end of file +seeds.json +coverage diff --git a/CHANGELOG.md b/CHANGELOG.md index d3acc6ad..db2ef031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Trade +## [0.0.6] - 2024-06-03 + +### Added + +- Server-Signer feature: ability to create wallets backed by server signers and create transfers with them. + +### Changed + +- Changed save_wallet to save_seed +- Changed load_wallets to load_seed and moved at wallet level + ## [0.0.5] - 2024-05-20 ### Added - `wallets` method on the User class - Ability to hydrate wallets (i.e. set the seed on it) +- Ability to create wallets backed by server signers. + - Note: External developers cannot use this until we enable them to create and run them. ## [0.0.4] - 2024-05-13 diff --git a/Makefile b/Makefile index c44a976d..33cbd22c 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,10 @@ lint: test: bundle exec rake test +.PHONY: test-coverage +test-coverage: + open coverage/index.html + .PHONY: repl repl: bundle exec bin/repl diff --git a/README.md b/README.md index 16ea6c19..0fb0eaa1 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,11 @@ This will allow you to [authenticate](./authentication.md) with the Platform API u = Coinbase.default_user ``` +If you are using a CDP Server-Signer to manage your private keys, enable it with + +```ruby +Coinbase.configuration.use_server_signer=true +``` Now, create a wallet from the User. Wallets are created with a single default address. ```ruby @@ -227,14 +232,17 @@ store(data.to_hash) For more information on wallet persistence, see [the documentation on wallets](./wallets.md#persisting-a-wallet). -Alternatively, you can use the `save_wallet_locally!` function to persist wallets on your local file system. This is a +Alternatively, you can use the `save_seed!` function to persist a wallet's seed to a local file. This is a convenience function purely for testing purposes, and should not be considered a secure method of persisting wallets. ```ruby -# Set encrypt: true to encrypt the wallet export data with your CDP API key. -u.save_wallet_locally!(w1, encrypt: true) +# Pick a file to which to save your wallet seed. +file_path = 'my_seed.json' -puts "Wallet #{w1.id} successfully saved to local file storage." +# Set encrypt: true to encrypt the wallet seed with your CDP API key. +w1.save_seed!(file_path, encrypt: true) + +puts "Seed for wallet #{w1.id} successfully saved to #{file_path}." ``` ## Re-instantiating a Wallet @@ -250,17 +258,16 @@ fetched_data = fetch(w1.id) w3 = u.import_wallet(fetched_data) ``` -If you used the `save_wallet_locally!` function to persist wallets on your local file system, then you can use the -`load_wallets_from_local` function re-instantiate the wallets. +If you used the `save_seed!` function to persist a wallet's seed to a local file, then you can first fetch +the unhydrated wallet from the server, and then use the `load_seed` method to re-instantiate the wallet. ```ruby -# wallets will contain a Hash from wallet ID to wallet. -wallets = u.load_wallets_from_local - -puts "Wallets successfully loaded from local file storage." +# Get the unhydrated wallet from the server. +w4 = u.wallet(w1.id) -# w4 will be equivalent to w1 and w3. -w4 = wallets[w1.id] +# You can now load the seed into the wallet from the local file. +# w4 will be equivalent to w1. +w4.load_seed(file_path) ``` ## Development diff --git a/coinbase.gemspec b/coinbase.gemspec index dd5894e5..b809de75 100644 --- a/coinbase.gemspec +++ b/coinbase.gemspec @@ -30,6 +30,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rspec' # Pin to a specific version of RuboCop to ensure consistent linting. spec.add_development_dependency 'rubocop', '1.63.1' + spec.add_development_dependency 'simplecov' # Pin to a specific version of YARD to ensure consistent documentation generation. spec.add_development_dependency 'yard', '0.9.36' spec.add_development_dependency 'yard-markdown' diff --git a/docs/Coinbase.html b/docs/Coinbase.html index 36a527bc..ec1faf8d 100644 --- a/docs/Coinbase.html +++ b/docs/Coinbase.html @@ -323,7 +323,7 @@

  • - .configure {|configuration| ... } ⇒ Object + .configure {|configuration| ... } ⇒ String @@ -347,7 +347,7 @@

  • - .configure_from_json(file_path = 'coinbase_cloud_api_key.json') ⇒ Object + .configure_from_json(file_path = 'cdp_api_key.json') ⇒ String @@ -437,6 +437,30 @@

    Converts a string to a symbol, replacing hyphens with underscores.

    +

  • + + +
  • + + + .use_server_signer? ⇒ bool + + + + + + + + + + + + + +
    +

    Returns whether to use a server signer to manage private keys.

    +
    +
  • @@ -475,16 +499,16 @@

     
     
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    +119 +120 +121 +122 +123 +124 +125 -
    # File 'lib/coinbase.rb', line 113
    +      
    # File 'lib/coinbase.rb', line 119
     
     def self.call_api
       yield
    @@ -560,7 +584,7 @@ 

    - .configure {|configuration| ... } ⇒ Object + .configure {|configuration| ... } ⇒ String @@ -586,6 +610,24 @@

    +

  • + + +

    Returns:

    + @@ -609,21 +651,25 @@

     
     
    -30
     31
     32
     33
     34
    -35
    +35 +36 +37 +38 -
    # File 'lib/coinbase.rb', line 30
    +      
    # File 'lib/coinbase.rb', line 31
     
     def self.configure
       yield(configuration)
     
       raise InvalidConfiguration, 'API key private key is not set' unless configuration.api_key_private_key
       raise InvalidConfiguration, 'API key name is not set' unless configuration.api_key_name
    +
    +  'Successfully configured Coinbase SDK'
     end
    @@ -633,7 +679,7 @@

    - .configure_from_json(file_path = 'coinbase_cloud_api_key.json') ⇒ Object + .configure_from_json(file_path = 'cdp_api_key.json') ⇒ String @@ -659,7 +705,7 @@

    (String) - (defaults to: 'coinbase_cloud_api_key.json') + (defaults to: 'cdp_api_key.json') — @@ -671,6 +717,24 @@

    +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      A string indicating successful configuration

      +
      + +
    • + +

    Raises:

      @@ -691,21 +755,25 @@

       
       
      -40
      -41
      -42
      -43
       44
      -45
      +45 +46 +47 +48 +49 +50 +51

    -
    # File 'lib/coinbase.rb', line 40
    +      
    # File 'lib/coinbase.rb', line 44
     
    -def self.configure_from_json(file_path = 'coinbase_cloud_api_key.json')
    +def self.configure_from_json(file_path = 'cdp_api_key.json')
       configuration.from_json(file_path)
     
       raise InvalidConfiguration, 'API key private key is not set' unless configuration.api_key_private_key
       raise InvalidConfiguration, 'API key name is not set' unless configuration.api_key_name
    +
    +  'Successfully configured Coinbase SDK'
     end
    @@ -756,12 +824,12 @@

     
     
    -92
    -93
    -94
    +98 +99 +100

    -
    # File 'lib/coinbase.rb', line 92
    +      
    # File 'lib/coinbase.rb', line 98
     
     def self.default_user
       @default_user ||= load_default_user
    @@ -815,14 +883,14 @@ 

     
     
    -105
    -106
    -107
    -108
    -109
    +111 +112 +113 +114 +115

    -
    # File 'lib/coinbase.rb', line 105
    +      
    # File 'lib/coinbase.rb', line 111
     
     def self.load_default_user
       users_api = Coinbase::Client::UsersApi.new(configuration.api_client)
    @@ -898,12 +966,12 @@ 

     
     
    -99
    -100
    -101
    +105 +106 +107

    -
    # File 'lib/coinbase.rb', line 99
    +      
    # File 'lib/coinbase.rb', line 105
     
     def self.to_sym(value)
       value.to_s.gsub('-', '_').to_sym
    @@ -911,6 +979,65 @@ 

    + + +
    +

    + + .use_server_signer?bool + + + + + +

    +
    + +

    Returns whether to use a server signer to manage private keys.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (bool) + + + + — +
      +

      whether to use a server signer to manage private keys.

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +129
    +130
    +131
    +
    +
    # File 'lib/coinbase.rb', line 129
    +
    +def self.use_server_signer?
    +  Coinbase.configuration.use_server_signer
    +end
    +
    diff --git a/docs/Coinbase/Address.html b/docs/Coinbase/Address.html index 67acea10..216ea432 100644 --- a/docs/Coinbase/Address.html +++ b/docs/Coinbase/Address.html @@ -409,7 +409,7 @@

    -

    Transfers the given amount of the given Asset to the given address.

    +

    Transfers the given amount of the given Asset to the specified address or wallet.

    @@ -757,12 +757,12 @@

     
     
    -131
    -132
    -133
    +98 +99 +100

    -
    # File 'lib/coinbase/address.rb', line 131
    +      
    # File 'lib/coinbase/address.rb', line 98
     
     def can_sign?
       !@key.nil?
    @@ -816,14 +816,14 @@ 

     
     
    -160
    -161
    -162
    -163
    -164
    +127 +128 +129 +130 +131

    -
    # File 'lib/coinbase/address.rb', line 160
    +      
    # File 'lib/coinbase/address.rb', line 127
     
     def export
       raise 'Cannot export key without private key loaded' if @key.nil?
    @@ -911,14 +911,14 @@ 

     
     
    -152
    -153
    -154
    -155
    -156
    +119 +120 +121 +122 +123

    -
    # File 'lib/coinbase/address.rb', line 152
    +      
    # File 'lib/coinbase/address.rb', line 119
     
     def faucet
       Coinbase.call_api do
    @@ -1033,12 +1033,12 @@ 

     
     
    -143
    -144
    -145
    +110 +111 +112

    -
    # File 'lib/coinbase/address.rb', line 143
    +      
    # File 'lib/coinbase/address.rb', line 110
     
     def inspect
       to_s
    @@ -1216,12 +1216,12 @@ 

     
     
    -137
    -138
    -139
    +104 +105 +106

    -
    # File 'lib/coinbase/address.rb', line 137
    +      
    # File 'lib/coinbase/address.rb', line 104
     
     def to_s
       "Coinbase::Address{id: '#{id}', network_id: '#{network_id}', wallet_id: '#{wallet_id}'}"
    @@ -1243,7 +1243,7 @@ 

    -

    Transfers the given amount of the given Asset to the given address. Only same-Network Transfers are supported.

    +

    Transfers the given amount of the given Asset to the specified address or wallet. Only same-network Transfers are supported.

    @@ -1317,19 +1317,6 @@

    The hash of the Transfer transaction.

    - - - -

    Raises:

    -
      - -
    • - - - (ArgumentError) - - -
    @@ -1340,7 +1327,6 @@

     
     
    -80
     81
     82
     83
    @@ -1354,91 +1340,24 @@ 

    91 92 93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127

    +94

    -
    # File 'lib/coinbase/address.rb', line 80
    +      
    # File 'lib/coinbase/address.rb', line 81
     
     def transfer(amount, asset_id, destination)
    -  raise 'Cannot transfer from address without private key loaded' if @key.nil?
    -
    -  raise ArgumentError, "Unsupported asset: #{asset_id}" unless Coinbase::Asset.supported?(asset_id)
    -
    -  if destination.is_a?(Wallet)
    -    raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id
    -
    -    destination = destination.default_address.id
    -  elsif destination.is_a?(Address)
    -    raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id
    -
    -    destination = destination.id
    -  end
    +  destination_address, destination_network = destination_address_and_network(destination)
     
    -  current_balance = balance(asset_id)
    -  if current_balance < amount
    -    raise ArgumentError, "Insufficient funds: #{amount} requested, but only #{current_balance} available"
    -  end
    -
    -  create_transfer_request = {
    -    amount: Coinbase::Asset.to_atomic_amount(amount, asset_id).to_i.to_s,
    -    network_id: network_id,
    -    asset_id: Coinbase::Asset.primary_denomination(asset_id).to_s,
    -    destination: destination
    -  }
    -
    -  transfer_model = Coinbase.call_api do
    -    transfers_api.create_transfer(wallet_id, id, create_transfer_request)
    -  end
    +  validate_can_transfer!(amount, asset_id, destination_network)
     
    -  transfer = Coinbase::Transfer.new(transfer_model)
    +  transfer = create_transfer(amount, asset_id, destination_address)
     
    -  transaction = transfer.transaction
    -  transaction.sign(@key)
    +  # If a server signer is managing keys, it will sign and broadcast the underlying transfer transaction out of band.
    +  return transfer if Coinbase.use_server_signer?
     
    -  signed_payload = transaction.hex
    -
    -  broadcast_transfer_request = {
    -    signed_payload: signed_payload
    -  }
    -
    -  transfer_model = Coinbase.call_api do
    -    transfers_api.broadcast_transfer(wallet_id, id, transfer.id, broadcast_transfer_request)
    -  end
    +  signed_payload = sign_transfer(transfer)
     
    -  Coinbase::Transfer.new(transfer_model)
    +  broadcast_transfer(transfer, signed_payload)
     end
    @@ -1489,40 +1408,42 @@

     
     
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154

    -
    # File 'lib/coinbase/address.rb', line 168
    +      
    # File 'lib/coinbase/address.rb', line 135
     
     def transfers
       transfers = []
       page = nil
     
       loop do
    -    puts "fetch transfers page: #{page}"
         response = Coinbase.call_api do
           transfers_api.list_transfers(wallet_id, id, { limit: 100, page: page })
         end
     
    -    transfers.concat(response.data.map { |transfer| Coinbase::Transfer.new(transfer) }) if response.data
    +    break if response.data.empty?
    +
    +    transfers.concat(response.data.map { |transfer| Coinbase::Transfer.new(transfer) })
     
         break unless response.has_more
     
    diff --git a/docs/Coinbase/Authenticator.html b/docs/Coinbase/Authenticator.html
    index 0dc43f6b..47253039 100644
    --- a/docs/Coinbase/Authenticator.html
    +++ b/docs/Coinbase/Authenticator.html
    @@ -374,7 +374,7 @@ 

    claims = { sub: Coinbase.configuration.api_key_name, - iss: 'coinbase-cloud', + iss: 'cdp', aud: ['cdp_service'], nbf: Time.now.to_i, exp: Time.now.to_i + 60, # Expiration time: 1 minute from now. diff --git a/docs/Coinbase/Client.html b/docs/Coinbase/Client.html index c7ff504c..e3682f99 100644 --- a/docs/Coinbase/Client.html +++ b/docs/Coinbase/Client.html @@ -79,7 +79,7 @@
    Defined in:
    lib/coinbase/client/version.rb,
    - lib/coinbase/client.rb,
    lib/coinbase/client/api_error.rb,
    lib/coinbase/client/api_client.rb,
    lib/coinbase/client/models/user.rb,
    lib/coinbase/client/models/asset.rb,
    lib/coinbase/client/models/error.rb,
    lib/coinbase/client/api/users_api.rb,
    lib/coinbase/client/configuration.rb,
    lib/coinbase/client/models/wallet.rb,
    lib/coinbase/client/models/address.rb,
    lib/coinbase/client/models/balance.rb,
    lib/coinbase/client/api/wallets_api.rb,
    lib/coinbase/client/models/transfer.rb,
    lib/coinbase/client/api/addresses_api.rb,
    lib/coinbase/client/api/transfers_api.rb,
    lib/coinbase/client/models/wallet_list.rb,
    lib/coinbase/client/models/address_list.rb,
    lib/coinbase/client/models/transfer_list.rb,
    lib/coinbase/client/models/faucet_transaction.rb,
    lib/coinbase/client/models/address_balance_list.rb,
    lib/coinbase/client/models/create_wallet_request.rb,
    lib/coinbase/client/models/create_address_request.rb,
    lib/coinbase/client/models/create_transfer_request.rb,
    lib/coinbase/client/models/broadcast_transfer_request.rb
    + lib/coinbase/client.rb,
    lib/coinbase/client/api_error.rb,
    lib/coinbase/client/api_client.rb,
    lib/coinbase/client/models/user.rb,
    lib/coinbase/client/models/asset.rb,
    lib/coinbase/client/models/error.rb,
    lib/coinbase/client/models/trade.rb,
    lib/coinbase/client/api/users_api.rb,
    lib/coinbase/client/configuration.rb,
    lib/coinbase/client/models/wallet.rb,
    lib/coinbase/client/api/trades_api.rb,
    lib/coinbase/client/models/address.rb,
    lib/coinbase/client/models/balance.rb,
    lib/coinbase/client/api/wallets_api.rb,
    lib/coinbase/client/models/transfer.rb,
    lib/coinbase/client/api/addresses_api.rb,
    lib/coinbase/client/api/transfers_api.rb,
    lib/coinbase/client/models/trade_list.rb,
    lib/coinbase/client/models/transaction.rb,
    lib/coinbase/client/models/wallet_list.rb,
    lib/coinbase/client/models/address_list.rb,
    lib/coinbase/client/models/server_signer.rb,
    lib/coinbase/client/models/transfer_list.rb,
    lib/coinbase/client/api/server_signers_api.rb,
    lib/coinbase/client/models/transaction_type.rb,
    lib/coinbase/client/models/faucet_transaction.rb,
    lib/coinbase/client/models/seed_creation_event.rb,
    lib/coinbase/client/models/server_signer_event.rb,
    lib/coinbase/client/models/address_balance_list.rb,
    lib/coinbase/client/models/create_trade_request.rb,
    lib/coinbase/client/models/create_wallet_request.rb,
    lib/coinbase/client/models/create_address_request.rb,
    lib/coinbase/client/models/broadcast_trade_request.rb,
    lib/coinbase/client/models/create_transfer_request.rb,
    lib/coinbase/client/models/server_signer_event_list.rb,
    lib/coinbase/client/models/signature_creation_event.rb,
    lib/coinbase/client/models/server_signer_event_event.rb,
    lib/coinbase/client/models/broadcast_transfer_request.rb,
    lib/coinbase/client/models/seed_creation_event_result.rb,
    lib/coinbase/client/models/create_server_signer_request.rb,
    lib/coinbase/client/models/create_wallet_request_wallet.rb,
    lib/coinbase/client/models/signature_creation_event_result.rb
    @@ -104,9 +104,11 @@

    Overview

    -
    # File 'lib/coinbase/client.rb', line 51
    +      
    # File 'lib/coinbase/client.rb', line 69
     
     def configure
       if block_given?
    diff --git a/docs/Coinbase/Client/BroadcastTradeRequest.html b/docs/Coinbase/Client/BroadcastTradeRequest.html
    new file mode 100644
    index 00000000..23d2f779
    --- /dev/null
    +++ b/docs/Coinbase/Client/BroadcastTradeRequest.html
    @@ -0,0 +1,1797 @@
    +
    +
    +  
    +    
    +
    +
    +  Class: Coinbase::Client::BroadcastTradeRequest
    +  
    +    — Documentation by YARD 0.9.36
    +  
    +
    +
    +  
    +
    +  
    +
    +
    +
    +
    +  
    +
    +  
    +
    +
    +  
    +  
    +    
    +
    +    
    + + +

    Class: Coinbase::Client::BroadcastTradeRequest + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/broadcast_trade_request.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    + + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ BroadcastTradeRequest + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 48
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::BroadcastTradeRequest` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::BroadcastTradeRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'signed_payload')
    +    self.signed_payload = attributes[:'signed_payload']
    +  else
    +    self.signed_payload = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #signed_payloadObject + + + + + +

    +
    + +

    The hex-encoded signed payload of the trade

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +19
    +20
    +21
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 19
    +
    +def signed_payload
    +  @signed_payload
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 135
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +29
    +30
    +31
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 29
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +22
    +23
    +24
    +25
    +26
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 22
    +
    +def self.attribute_map
    +  {
    +    :'signed_payload' => :'signed_payload'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 111
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +41
    +42
    +43
    +44
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 41
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +34
    +35
    +36
    +37
    +38
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 34
    +
    +def self.openapi_types
    +  {
    +    :'signed_payload' => :'String'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +90
    +91
    +92
    +93
    +94
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 90
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      signed_payload == o.signed_payload
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 206
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +98
    +99
    +100
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 98
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +104
    +105
    +106
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 104
    +
    +def hash
    +  [signed_payload].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 70
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @signed_payload.nil?
    +    invalid_properties.push('invalid value for "signed_payload", signed_payload cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +182
    +183
    +184
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 182
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 188
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +176
    +177
    +178
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 176
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +82
    +83
    +84
    +85
    +86
    +
    +
    # File 'lib/coinbase/client/models/broadcast_trade_request.rb', line 82
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @signed_payload.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/CreateAddressRequest.html b/docs/Coinbase/Client/CreateAddressRequest.html index 2a3342ab..54a9cca2 100644 --- a/docs/Coinbase/Client/CreateAddressRequest.html +++ b/docs/Coinbase/Client/CreateAddressRequest.html @@ -640,11 +640,7 @@

    70 71 72 -73 -74 -75 -76 -77

    +73
    # File 'lib/coinbase/client/models/create_address_request.rb', line 53
    @@ -664,14 +660,10 @@ 

    if attributes.key?(:'public_key') self.public_key = attributes[:'public_key'] - else - self.public_key = nil end if attributes.key?(:'attestation') self.attestation = attributes[:'attestation'] - else - self.attestation = nil end end

    @@ -857,6 +849,20 @@

     
     
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
     152
     153
     154
    @@ -880,24 +886,10 @@ 

    172 173 174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189

    +175

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 152
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 138
     
     def self._deserialize(type, value)
       case type.to_sym
    @@ -1094,28 +1086,28 @@ 

     
     
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
     128
     129
     130
     131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    +132

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 128
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 114
     
     def self.build_from_hash(attributes)
       return nil unless attributes.is_a?(Hash)
    @@ -1283,15 +1275,15 @@ 

     
     
    -106
    -107
    -108
    -109
    -110
    -111
    +92 +93 +94 +95 +96 +97

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 106
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 92
     
     def ==(o)
       return true if self.equal?(o)
    @@ -1368,22 +1360,22 @@ 

     
     
    -223
    -224
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
    -235
    +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 223
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 209
     
     def _to_hash(value)
       if value.is_a?(Array)
    @@ -1467,12 +1459,12 @@ 

     
     
    -115
    -116
    -117
    +101 +102 +103

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 115
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 101
     
     def eql?(o)
       self == o
    @@ -1526,12 +1518,12 @@ 

     
     
    -121
    -122
    -123
    +107 +108 +109

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 121
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 107
     
     def hash
       [public_key, attestation].hash
    @@ -1585,34 +1577,18 @@ 

     
     
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    +77 +78 +79 +80 +81

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 81
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 77
     
     def list_invalid_properties
       warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
       invalid_properties = Array.new
    -  if @public_key.nil?
    -    invalid_properties.push('invalid value for "public_key", public_key cannot be nil.')
    -  end
    -
    -  if @attestation.nil?
    -    invalid_properties.push('invalid value for "attestation", attestation cannot be nil.')
    -  end
    -
       invalid_properties
     end
    @@ -1664,12 +1640,12 @@

     
     
    -199
    -200
    -201
    +185 +186 +187

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 199
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 185
     
     def to_body
       to_hash
    @@ -1723,22 +1699,22 @@ 

     
     
    -205
    -206
    -207
    -208
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 205
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 191
     
     def to_hash
       hash = {}
    @@ -1802,12 +1778,12 @@ 

     
     
    -193
    -194
    -195
    +179 +180 +181

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 193
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 179
     
     def to_s
       to_hash.to_s
    @@ -1861,20 +1837,16 @@ 

     
     
    -97
    -98
    -99
    -100
    -101
    -102
    +85 +86 +87 +88

    -
    # File 'lib/coinbase/client/models/create_address_request.rb', line 97
    +      
    # File 'lib/coinbase/client/models/create_address_request.rb', line 85
     
     def valid?
       warn '[DEPRECATED] the `valid?` method is obsolete'
    -  return false if @public_key.nil?
    -  return false if @attestation.nil?
       true
     end
    diff --git a/docs/Coinbase/Client/CreateServerSignerRequest.html b/docs/Coinbase/Client/CreateServerSignerRequest.html new file mode 100644 index 00000000..775f33ad --- /dev/null +++ b/docs/Coinbase/Client/CreateServerSignerRequest.html @@ -0,0 +1,1895 @@ + + + + + + + Class: Coinbase::Client::CreateServerSignerRequest + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::CreateServerSignerRequest + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/create_server_signer_request.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    + + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ CreateServerSignerRequest + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 53
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::CreateServerSignerRequest` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::CreateServerSignerRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'server_signer_id')
    +    self.server_signer_id = attributes[:'server_signer_id']
    +  else
    +    self.server_signer_id = nil
    +  end
    +
    +  if attributes.key?(:'enrollment_data')
    +    self.enrollment_data = attributes[:'enrollment_data']
    +  else
    +    self.enrollment_data = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #enrollment_dataObject + + + + + +

    +
    + +

    The enrollment data of the server signer. This will be the base64 encoded server-signer-id.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +22
    +23
    +24
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 22
    +
    +def enrollment_data
    +  @enrollment_data
    +end
    +
    +
    + + + +
    +

    + + #server_signer_idObject + + + + + +

    +
    + +

    The ID of the server signer

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +19
    +20
    +21
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 19
    +
    +def server_signer_id
    +  @server_signer_id
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 152
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +33
    +34
    +35
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 33
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +25
    +26
    +27
    +28
    +29
    +30
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 25
    +
    +def self.attribute_map
    +  {
    +    :'server_signer_id' => :'server_signer_id',
    +    :'enrollment_data' => :'enrollment_data'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 128
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +46
    +47
    +48
    +49
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 46
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +38
    +39
    +40
    +41
    +42
    +43
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 38
    +
    +def self.openapi_types
    +  {
    +    :'server_signer_id' => :'String',
    +    :'enrollment_data' => :'String'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +106
    +107
    +108
    +109
    +110
    +111
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 106
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      server_signer_id == o.server_signer_id &&
    +      enrollment_data == o.enrollment_data
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 223
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +115
    +116
    +117
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 115
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +121
    +122
    +123
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 121
    +
    +def hash
    +  [server_signer_id, enrollment_data].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 81
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @server_signer_id.nil?
    +    invalid_properties.push('invalid value for "server_signer_id", server_signer_id cannot be nil.')
    +  end
    +
    +  if @enrollment_data.nil?
    +    invalid_properties.push('invalid value for "enrollment_data", enrollment_data cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +199
    +200
    +201
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 199
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 205
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +193
    +194
    +195
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 193
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +97
    +98
    +99
    +100
    +101
    +102
    +
    +
    # File 'lib/coinbase/client/models/create_server_signer_request.rb', line 97
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @server_signer_id.nil?
    +  return false if @enrollment_data.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/CreateTradeRequest.html b/docs/Coinbase/Client/CreateTradeRequest.html new file mode 100644 index 00000000..12c8382d --- /dev/null +++ b/docs/Coinbase/Client/CreateTradeRequest.html @@ -0,0 +1,1993 @@ + + + + + + + Class: Coinbase::Client::CreateTradeRequest + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::CreateTradeRequest + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/create_trade_request.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    + + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ CreateTradeRequest + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 58
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::CreateTradeRequest` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::CreateTradeRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'amount')
    +    self.amount = attributes[:'amount']
    +  else
    +    self.amount = nil
    +  end
    +
    +  if attributes.key?(:'from_asset_id')
    +    self.from_asset_id = attributes[:'from_asset_id']
    +  else
    +    self.from_asset_id = nil
    +  end
    +
    +  if attributes.key?(:'to_asset_id')
    +    self.to_asset_id = attributes[:'to_asset_id']
    +  else
    +    self.to_asset_id = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #amountObject + + + + + +

    +
    + +

    The amount to trade

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +19
    +20
    +21
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 19
    +
    +def amount
    +  @amount
    +end
    +
    +
    + + + +
    +

    + + #from_asset_idObject + + + + + +

    +
    + +

    The ID of the asset to trade

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +22
    +23
    +24
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 22
    +
    +def from_asset_id
    +  @from_asset_id
    +end
    +
    +
    + + + +
    +

    + + #to_asset_idObject + + + + + +

    +
    + +

    The ID of the asset to receive from the trade

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +25
    +26
    +27
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 25
    +
    +def to_asset_id
    +  @to_asset_id
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 169
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +37
    +38
    +39
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 37
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 28
    +
    +def self.attribute_map
    +  {
    +    :'amount' => :'amount',
    +    :'from_asset_id' => :'from_asset_id',
    +    :'to_asset_id' => :'to_asset_id'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 145
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +51
    +52
    +53
    +54
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 51
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 42
    +
    +def self.openapi_types
    +  {
    +    :'amount' => :'String',
    +    :'from_asset_id' => :'String',
    +    :'to_asset_id' => :'String'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 122
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      amount == o.amount &&
    +      from_asset_id == o.from_asset_id &&
    +      to_asset_id == o.to_asset_id
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +240
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 240
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +132
    +133
    +134
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 132
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +138
    +139
    +140
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 138
    +
    +def hash
    +  [amount, from_asset_id, to_asset_id].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 92
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @amount.nil?
    +    invalid_properties.push('invalid value for "amount", amount cannot be nil.')
    +  end
    +
    +  if @from_asset_id.nil?
    +    invalid_properties.push('invalid value for "from_asset_id", from_asset_id cannot be nil.')
    +  end
    +
    +  if @to_asset_id.nil?
    +    invalid_properties.push('invalid value for "to_asset_id", to_asset_id cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +216
    +217
    +218
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 216
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 222
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +210
    +211
    +212
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 210
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +
    +
    # File 'lib/coinbase/client/models/create_trade_request.rb', line 112
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @amount.nil?
    +  return false if @from_asset_id.nil?
    +  return false if @to_asset_id.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/CreateWalletRequest.html b/docs/Coinbase/Client/CreateWalletRequest.html index 7a0d1eee..c56de844 100644 --- a/docs/Coinbase/Client/CreateWalletRequest.html +++ b/docs/Coinbase/Client/CreateWalletRequest.html @@ -1137,7 +1137,7 @@

    def self.openapi_types { - :'wallet' => :'Wallet' + :'wallet' => :'CreateWalletRequestWallet' } end

    diff --git a/docs/Coinbase/Client/CreateWalletRequestWallet.html b/docs/Coinbase/Client/CreateWalletRequestWallet.html new file mode 100644 index 00000000..07aa915d --- /dev/null +++ b/docs/Coinbase/Client/CreateWalletRequestWallet.html @@ -0,0 +1,1892 @@ + + + + + + + Class: Coinbase::Client::CreateWalletRequestWallet + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::CreateWalletRequestWallet + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/create_wallet_request_wallet.rb
    +
    + +
    + +

    Overview

    +
    + +

    Parameters for configuring a wallet

    + + +
    +
    +
    + + +
    + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #network_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the blockchain network.

      +
      + +
    • + + +
    • + + + #use_server_signer ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Whether the wallet should use the project's server signer or if the addresses in the wallets will belong to a private key the developer manages.

      +
      + +
    • + + +
    + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ CreateWalletRequestWallet + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 54
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::CreateWalletRequestWallet` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::CreateWalletRequestWallet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'network_id')
    +    self.network_id = attributes[:'network_id']
    +  else
    +    self.network_id = nil
    +  end
    +
    +  if attributes.key?(:'use_server_signer')
    +    self.use_server_signer = attributes[:'use_server_signer']
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #network_idObject + + + + + +

    +
    + +

    The ID of the blockchain network

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 20
    +
    +def network_id
    +  @network_id
    +end
    +
    +
    + + + +
    +

    + + #use_server_signerObject + + + + + +

    +
    + +

    Whether the wallet should use the project's server signer or if the addresses in the wallets will belong to a private key the developer manages. Defaults to false.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 23
    +
    +def use_server_signer
    +  @use_server_signer
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 146
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +34
    +35
    +36
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 34
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +26
    +27
    +28
    +29
    +30
    +31
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 26
    +
    +def self.attribute_map
    +  {
    +    :'network_id' => :'network_id',
    +    :'use_server_signer' => :'use_server_signer'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 122
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +47
    +48
    +49
    +50
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 47
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +39
    +40
    +41
    +42
    +43
    +44
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 39
    +
    +def self.openapi_types
    +  {
    +    :'network_id' => :'String',
    +    :'use_server_signer' => :'Boolean'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +100
    +101
    +102
    +103
    +104
    +105
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 100
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      network_id == o.network_id &&
    +      use_server_signer == o.use_server_signer
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 217
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +109
    +110
    +111
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 109
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +115
    +116
    +117
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 115
    +
    +def hash
    +  [network_id, use_server_signer].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 80
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @network_id.nil?
    +    invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +193
    +194
    +195
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 193
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 199
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +187
    +188
    +189
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 187
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +92
    +93
    +94
    +95
    +96
    +
    +
    # File 'lib/coinbase/client/models/create_wallet_request_wallet.rb', line 92
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @network_id.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/SeedCreationEvent.html b/docs/Coinbase/Client/SeedCreationEvent.html new file mode 100644 index 00000000..ffcc7549 --- /dev/null +++ b/docs/Coinbase/Client/SeedCreationEvent.html @@ -0,0 +1,1906 @@ + + + + + + + Class: Coinbase::Client::SeedCreationEvent + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::SeedCreationEvent + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/seed_creation_event.rb
    +
    + +
    + +

    Overview

    +
    + +

    An event representing a seed creation.

    + + +
    +
    +
    + + +
    + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #wallet_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the wallet that the server-signer should create the seed for.

      +
      + +
    • + + +
    • + + + #wallet_user_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the user that the wallet belongs to.

      +
      + +
    • + + +
    + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ SeedCreationEvent + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 54
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::SeedCreationEvent` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::SeedCreationEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'wallet_id')
    +    self.wallet_id = attributes[:'wallet_id']
    +  else
    +    self.wallet_id = nil
    +  end
    +
    +  if attributes.key?(:'wallet_user_id')
    +    self.wallet_user_id = attributes[:'wallet_user_id']
    +  else
    +    self.wallet_user_id = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #wallet_idObject + + + + + +

    +
    + +

    The ID of the wallet that the server-signer should create the seed for

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 20
    +
    +def wallet_id
    +  @wallet_id
    +end
    +
    +
    + + + +
    +

    + + #wallet_user_idObject + + + + + +

    +
    + +

    The ID of the user that the wallet belongs to

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 23
    +
    +def wallet_user_id
    +  @wallet_user_id
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 153
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +34
    +35
    +36
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 34
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +26
    +27
    +28
    +29
    +30
    +31
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 26
    +
    +def self.attribute_map
    +  {
    +    :'wallet_id' => :'wallet_id',
    +    :'wallet_user_id' => :'wallet_user_id'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 129
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +47
    +48
    +49
    +50
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 47
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +39
    +40
    +41
    +42
    +43
    +44
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 39
    +
    +def self.openapi_types
    +  {
    +    :'wallet_id' => :'String',
    +    :'wallet_user_id' => :'String'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +107
    +108
    +109
    +110
    +111
    +112
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 107
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      wallet_id == o.wallet_id &&
    +      wallet_user_id == o.wallet_user_id
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +236
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 224
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +116
    +117
    +118
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 116
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +122
    +123
    +124
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 122
    +
    +def hash
    +  [wallet_id, wallet_user_id].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 82
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @wallet_id.nil?
    +    invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.')
    +  end
    +
    +  if @wallet_user_id.nil?
    +    invalid_properties.push('invalid value for "wallet_user_id", wallet_user_id cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +200
    +201
    +202
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 200
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 206
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +194
    +195
    +196
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 194
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +98
    +99
    +100
    +101
    +102
    +103
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event.rb', line 98
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @wallet_id.nil?
    +  return false if @wallet_user_id.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/SeedCreationEventResult.html b/docs/Coinbase/Client/SeedCreationEventResult.html new file mode 100644 index 00000000..8e011f50 --- /dev/null +++ b/docs/Coinbase/Client/SeedCreationEventResult.html @@ -0,0 +1,2102 @@ + + + + + + + Class: Coinbase::Client::SeedCreationEventResult + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::SeedCreationEventResult + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/seed_creation_event_result.rb
    +
    + +
    + +

    Overview

    +
    + +

    The result to a SeedCreationEvent.

    + + +
    +
    +
    + + +
    + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #extended_public_key ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The extended public key for the first master key derived from seed.

      +
      + +
    • + + +
    • + + + #seed_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the seed in Server-Signer used to generate the extended public key.

      +
      + +
    • + + +
    • + + + #wallet_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the wallet that the seed was created for.

      +
      + +
    • + + +
    • + + + #wallet_user_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the user that the wallet belongs to.

      +
      + +
    • + + +
    + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ SeedCreationEventResult + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 64
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::SeedCreationEventResult` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::SeedCreationEventResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'wallet_id')
    +    self.wallet_id = attributes[:'wallet_id']
    +  else
    +    self.wallet_id = nil
    +  end
    +
    +  if attributes.key?(:'wallet_user_id')
    +    self.wallet_user_id = attributes[:'wallet_user_id']
    +  else
    +    self.wallet_user_id = nil
    +  end
    +
    +  if attributes.key?(:'extended_public_key')
    +    self.extended_public_key = attributes[:'extended_public_key']
    +  else
    +    self.extended_public_key = nil
    +  end
    +
    +  if attributes.key?(:'seed_id')
    +    self.seed_id = attributes[:'seed_id']
    +  else
    +    self.seed_id = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #extended_public_keyObject + + + + + +

    +
    + +

    The extended public key for the first master key derived from seed.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +26
    +27
    +28
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 26
    +
    +def extended_public_key
    +  @extended_public_key
    +end
    +
    +
    + + + +
    +

    + + #seed_idObject + + + + + +

    +
    + +

    The ID of the seed in Server-Signer used to generate the extended public key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +29
    +30
    +31
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 29
    +
    +def seed_id
    +  @seed_id
    +end
    +
    +
    + + + +
    +

    + + #wallet_idObject + + + + + +

    +
    + +

    The ID of the wallet that the seed was created for

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 20
    +
    +def wallet_id
    +  @wallet_id
    +end
    +
    +
    + + + +
    +

    + + #wallet_user_idObject + + + + + +

    +
    + +

    The ID of the user that the wallet belongs to

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 23
    +
    +def wallet_user_id
    +  @wallet_user_id
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 187
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +42
    +43
    +44
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 42
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 32
    +
    +def self.attribute_map
    +  {
    +    :'wallet_id' => :'wallet_id',
    +    :'wallet_user_id' => :'wallet_user_id',
    +    :'extended_public_key' => :'extended_public_key',
    +    :'seed_id' => :'seed_id'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 163
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +57
    +58
    +59
    +60
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 57
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 47
    +
    +def self.openapi_types
    +  {
    +    :'wallet_id' => :'String',
    +    :'wallet_user_id' => :'String',
    +    :'extended_public_key' => :'String',
    +    :'seed_id' => :'String'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 139
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      wallet_id == o.wallet_id &&
    +      wallet_user_id == o.wallet_user_id &&
    +      extended_public_key == o.extended_public_key &&
    +      seed_id == o.seed_id
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +258
    +259
    +260
    +261
    +262
    +263
    +264
    +265
    +266
    +267
    +268
    +269
    +270
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 258
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +150
    +151
    +152
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 150
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +156
    +157
    +158
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 156
    +
    +def hash
    +  [wallet_id, wallet_user_id, extended_public_key, seed_id].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 104
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @wallet_id.nil?
    +    invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.')
    +  end
    +
    +  if @wallet_user_id.nil?
    +    invalid_properties.push('invalid value for "wallet_user_id", wallet_user_id cannot be nil.')
    +  end
    +
    +  if @extended_public_key.nil?
    +    invalid_properties.push('invalid value for "extended_public_key", extended_public_key cannot be nil.')
    +  end
    +
    +  if @seed_id.nil?
    +    invalid_properties.push('invalid value for "seed_id", seed_id cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +234
    +235
    +236
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 234
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +240
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 240
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +228
    +229
    +230
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 228
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +
    +
    # File 'lib/coinbase/client/models/seed_creation_event_result.rb', line 128
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @wallet_id.nil?
    +  return false if @wallet_user_id.nil?
    +  return false if @extended_public_key.nil?
    +  return false if @seed_id.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/ServerSigner.html b/docs/Coinbase/Client/ServerSigner.html new file mode 100644 index 00000000..6ea1c842 --- /dev/null +++ b/docs/Coinbase/Client/ServerSigner.html @@ -0,0 +1,1896 @@ + + + + + + + Class: Coinbase::Client::ServerSigner + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::ServerSigner + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/server_signer.rb
    +
    + +
    + +

    Overview

    +
    + +

    A Server-Signer assigned to sign transactions in a wallet.

    + + +
    +
    +
    + + +
    + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #server_signer_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the server-signer.

      +
      + +
    • + + +
    • + + + #wallets ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The IDs of the wallets that the server-signer can sign for.

      +
      + +
    • + + +
    + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ ServerSigner + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 54
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::ServerSigner` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::ServerSigner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'server_signer_id')
    +    self.server_signer_id = attributes[:'server_signer_id']
    +  else
    +    self.server_signer_id = nil
    +  end
    +
    +  if attributes.key?(:'wallets')
    +    if (value = attributes[:'wallets']).is_a?(Array)
    +      self.wallets = value
    +    end
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #server_signer_idObject + + + + + +

    +
    + +

    The ID of the server-signer

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 20
    +
    +def server_signer_id
    +  @server_signer_id
    +end
    +
    +
    + + + +
    +

    + + #walletsObject + + + + + +

    +
    + +

    The IDs of the wallets that the server-signer can sign for

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 23
    +
    +def wallets
    +  @wallets
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 148
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +34
    +35
    +36
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 34
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +26
    +27
    +28
    +29
    +30
    +31
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 26
    +
    +def self.attribute_map
    +  {
    +    :'server_signer_id' => :'server_signer_id',
    +    :'wallets' => :'wallets'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 124
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +47
    +48
    +49
    +50
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 47
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +39
    +40
    +41
    +42
    +43
    +44
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 39
    +
    +def self.openapi_types
    +  {
    +    :'server_signer_id' => :'String',
    +    :'wallets' => :'Array<String>'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +102
    +103
    +104
    +105
    +106
    +107
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 102
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      server_signer_id == o.server_signer_id &&
    +      wallets == o.wallets
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 219
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +111
    +112
    +113
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 111
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +117
    +118
    +119
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 117
    +
    +def hash
    +  [server_signer_id, wallets].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 82
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @server_signer_id.nil?
    +    invalid_properties.push('invalid value for "server_signer_id", server_signer_id cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +195
    +196
    +197
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 195
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 201
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +189
    +190
    +191
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 189
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +94
    +95
    +96
    +97
    +98
    +
    +
    # File 'lib/coinbase/client/models/server_signer.rb', line 94
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @server_signer_id.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/ServerSignerEvent.html b/docs/Coinbase/Client/ServerSignerEvent.html new file mode 100644 index 00000000..2d624ee8 --- /dev/null +++ b/docs/Coinbase/Client/ServerSignerEvent.html @@ -0,0 +1,1906 @@ + + + + + + + Class: Coinbase::Client::ServerSignerEvent + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::ServerSignerEvent + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/server_signer_event.rb
    +
    + +
    + +

    Overview

    +
    + +

    An event that is waiting to be processed by a Server-Signer.

    + + +
    +
    +
    + + +
    + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #event ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Returns the value of attribute event.

      +
      + +
    • + + +
    • + + + #server_signer_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the server-signer that the event is for.

      +
      + +
    • + + +
    + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ ServerSignerEvent + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 53
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::ServerSignerEvent` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::ServerSignerEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'server_signer_id')
    +    self.server_signer_id = attributes[:'server_signer_id']
    +  else
    +    self.server_signer_id = nil
    +  end
    +
    +  if attributes.key?(:'event')
    +    self.event = attributes[:'event']
    +  else
    +    self.event = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #eventObject + + + + + +

    +
    + +

    Returns the value of attribute event.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +22
    +23
    +24
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 22
    +
    +def event
    +  @event
    +end
    +
    +
    + + + +
    +

    + + #server_signer_idObject + + + + + +

    +
    + +

    The ID of the server-signer that the event is for

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 20
    +
    +def server_signer_id
    +  @server_signer_id
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 152
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +33
    +34
    +35
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 33
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +25
    +26
    +27
    +28
    +29
    +30
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 25
    +
    +def self.attribute_map
    +  {
    +    :'server_signer_id' => :'server_signer_id',
    +    :'event' => :'event'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 128
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +46
    +47
    +48
    +49
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 46
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +38
    +39
    +40
    +41
    +42
    +43
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 38
    +
    +def self.openapi_types
    +  {
    +    :'server_signer_id' => :'String',
    +    :'event' => :'ServerSignerEventEvent'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +106
    +107
    +108
    +109
    +110
    +111
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 106
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      server_signer_id == o.server_signer_id &&
    +      event == o.event
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 223
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +115
    +116
    +117
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 115
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +121
    +122
    +123
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 121
    +
    +def hash
    +  [server_signer_id, event].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 81
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @server_signer_id.nil?
    +    invalid_properties.push('invalid value for "server_signer_id", server_signer_id cannot be nil.')
    +  end
    +
    +  if @event.nil?
    +    invalid_properties.push('invalid value for "event", event cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +199
    +200
    +201
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 199
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 205
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +193
    +194
    +195
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 193
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +97
    +98
    +99
    +100
    +101
    +102
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event.rb', line 97
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @server_signer_id.nil?
    +  return false if @event.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/ServerSignerEventEvent.html b/docs/Coinbase/Client/ServerSignerEventEvent.html new file mode 100644 index 00000000..d835f7e6 --- /dev/null +++ b/docs/Coinbase/Client/ServerSignerEventEvent.html @@ -0,0 +1,326 @@ + + + + + + + Module: Coinbase::Client::ServerSignerEventEvent + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Module: Coinbase::Client::ServerSignerEventEvent + + + +

    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/server_signer_event_event.rb
    +
    + +
    + + + + + + + + + +

    + Class Method Summary + collapse +

    + + + + + + +
    +

    Class Method Details

    + + +
    +

    + + .build(data) ⇒ Object + + + + + +

    +
    + +

    Builds the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Data + + + (Mixed) + + + + — +
      +

      to be matched against the list of oneOf items

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model or the data itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_event.rb', line 30
    +
    +def build(data)
    +  # Go through the list of oneOf items and attempt to identify the appropriate one.
    +  # Note:
    +  # - We do not attempt to check whether exactly one item matches.
    +  # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
    +  #   due to the way the deserialization is made in the base_object template (it just casts without verifying).
    +  # - TODO: scalar values are de facto behaving as if they were nullable.
    +  # - TODO: logging when debugging is set.
    +  openapi_one_of.each do |klass|
    +    begin
    +      next if klass == :AnyType # "nullable: true"
    +      typed_data = find_and_cast_into_type(klass, data)
    +      return typed_data if typed_data
    +    rescue # rescue all errors so we keep iterating even if the current item lookup raises
    +    end
    +  end
    +
    +  openapi_one_of.include?(:AnyType) ? data : nil
    +end
    +
    +
    + +
    +

    + + .openapi_one_ofObject + + + + + +

    +
    + +

    List of class defined in oneOf (OpenAPI v3)

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +23
    +24
    +25
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_event.rb', line 20
    +
    +def openapi_one_of
    +  [
    +    :'SeedCreationEvent',
    +    :'SignatureCreationEvent'
    +  ]
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/ServerSignerEventList.html b/docs/Coinbase/Client/ServerSignerEventList.html new file mode 100644 index 00000000..ebf5ead4 --- /dev/null +++ b/docs/Coinbase/Client/ServerSignerEventList.html @@ -0,0 +1,2095 @@ + + + + + + + Class: Coinbase::Client::ServerSignerEventList + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::ServerSignerEventList + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/server_signer_event_list.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #data ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Returns the value of attribute data.

      +
      + +
    • + + +
    • + + + #has_more ⇒ Object + + + + + + + + + + + + + + + + +
      +

      True if this list has another page of items after this one that can be fetched.

      +
      + +
    • + + +
    • + + + #next_page ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The page token to be used to fetch the next page.

      +
      + +
    • + + +
    • + + + #total_count ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The total number of events for the server signer.

      +
      + +
    • + + +
    + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ ServerSignerEventList + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 63
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::ServerSignerEventList` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::ServerSignerEventList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'data')
    +    if (value = attributes[:'data']).is_a?(Array)
    +      self.data = value
    +    end
    +  else
    +    self.data = nil
    +  end
    +
    +  if attributes.key?(:'has_more')
    +    self.has_more = attributes[:'has_more']
    +  else
    +    self.has_more = nil
    +  end
    +
    +  if attributes.key?(:'next_page')
    +    self.next_page = attributes[:'next_page']
    +  else
    +    self.next_page = nil
    +  end
    +
    +  if attributes.key?(:'total_count')
    +    self.total_count = attributes[:'total_count']
    +  else
    +    self.total_count = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #dataObject + + + + + +

    +
    + +

    Returns the value of attribute data.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +19
    +20
    +21
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 19
    +
    +def data
    +  @data
    +end
    +
    +
    + + + +
    +

    + + #has_moreObject + + + + + +

    +
    + +

    True if this list has another page of items after this one that can be fetched.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +22
    +23
    +24
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 22
    +
    +def has_more
    +  @has_more
    +end
    +
    +
    + + + +
    +

    + + #next_pageObject + + + + + +

    +
    + +

    The page token to be used to fetch the next page.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +25
    +26
    +27
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 25
    +
    +def next_page
    +  @next_page
    +end
    +
    +
    + + + +
    +

    + + #total_countObject + + + + + +

    +
    + +

    The total number of events for the server signer.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +28
    +29
    +30
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 28
    +
    +def total_count
    +  @total_count
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 188
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +41
    +42
    +43
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 41
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 31
    +
    +def self.attribute_map
    +  {
    +    :'data' => :'data',
    +    :'has_more' => :'has_more',
    +    :'next_page' => :'next_page',
    +    :'total_count' => :'total_count'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 164
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +56
    +57
    +58
    +59
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 56
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 46
    +
    +def self.openapi_types
    +  {
    +    :'data' => :'Array<ServerSignerEvent>',
    +    :'has_more' => :'Boolean',
    +    :'next_page' => :'String',
    +    :'total_count' => :'Integer'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 140
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      data == o.data &&
    +      has_more == o.has_more &&
    +      next_page == o.next_page &&
    +      total_count == o.total_count
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +259
    +260
    +261
    +262
    +263
    +264
    +265
    +266
    +267
    +268
    +269
    +270
    +271
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 259
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +151
    +152
    +153
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 151
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +157
    +158
    +159
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 157
    +
    +def hash
    +  [data, has_more, next_page, total_count].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 105
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @data.nil?
    +    invalid_properties.push('invalid value for "data", data cannot be nil.')
    +  end
    +
    +  if @has_more.nil?
    +    invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
    +  end
    +
    +  if @next_page.nil?
    +    invalid_properties.push('invalid value for "next_page", next_page cannot be nil.')
    +  end
    +
    +  if @total_count.nil?
    +    invalid_properties.push('invalid value for "total_count", total_count cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +235
    +236
    +237
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 235
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +253
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 241
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +229
    +230
    +231
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 229
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +
    +
    # File 'lib/coinbase/client/models/server_signer_event_list.rb', line 129
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @data.nil?
    +  return false if @has_more.nil?
    +  return false if @next_page.nil?
    +  return false if @total_count.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/ServerSignersApi.html b/docs/Coinbase/Client/ServerSignersApi.html new file mode 100644 index 00000000..f879bfc8 --- /dev/null +++ b/docs/Coinbase/Client/ServerSignersApi.html @@ -0,0 +1,2401 @@ + + + + + + + Class: Coinbase::Client::ServerSignersApi + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::ServerSignersApi + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/api/server_signers_api.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #api_client ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Returns the value of attribute api_client.

      +
      + +
    • + + +
    + + + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(api_client = ApiClient.default) ⇒ ServerSignersApi + + + + + +

    +
    + +

    Returns a new instance of ServerSignersApi.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +19
    +20
    +21
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 19
    +
    +def initialize(api_client = ApiClient.default)
    +  @api_client = api_client
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #api_clientObject + + + + + +

    +
    + +

    Returns the value of attribute api_client.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +17
    +18
    +19
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 17
    +
    +def api_client
    +  @api_client
    +end
    +
    +
    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + #create_server_signer(opts = {}) ⇒ ServerSigner + + + + + +

    +
    + +

    Create a new Server-Signer Create a new Server-Signer

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + + + + +

    Options Hash (opts):

    + + + +

    Returns:

    + + +
    + + + + +
    +
    +
    +
    +27
    +28
    +29
    +30
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 27
    +
    +def create_server_signer(opts = {})
    +  data, _status_code, _headers = create_server_signer_with_http_info(opts)
    +  data
    +end
    +
    +
    + +
    +

    + + #create_server_signer_with_http_info(opts = {}) ⇒ Array<(ServerSigner, Integer, Hash)> + + + + + +

    +
    + +

    Create a new Server-Signer Create a new Server-Signer

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + + + + +

    Options Hash (opts):

    + + + +

    Returns:

    +
      + +
    • + + + (Array<(ServerSigner, Integer, Hash)>) + + + + — +
      +

      ServerSigner data, response status code and response headers

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 37
    +
    +def create_server_signer_with_http_info(opts = {})
    +  if @api_client.config.debugging
    +    @api_client.config.logger.debug 'Calling API: ServerSignersApi.create_server_signer ...'
    +  end
    +  # resource path
    +  local_var_path = '/v1/server_signers'
    +
    +  # 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'])
    +  # 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[:'create_server_signer_request'])
    +
    +  # return_type
    +  return_type = opts[:debug_return_type] || 'ServerSigner'
    +
    +  # auth_names
    +  auth_names = opts[:debug_auth_names] || []
    +
    +  new_options = opts.merge(
    +    :operation => :"ServerSignersApi.create_server_signer",
    +    :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: ServerSignersApi#create_server_signer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    +  end
    +  return data, status_code, headers
    +end
    +
    +
    + +
    +

    + + #get_server_signer(server_signer_id, opts = {}) ⇒ ServerSigner + + + + + +

    +
    + +

    Get a server signer by ID Get a server signer by ID

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + server_signer_id + + + (String) + + + + — +
      +

      The ID of the server signer to fetch

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + +

    Returns:

    + + +
    + + + + +
    +
    +
    +
    +91
    +92
    +93
    +94
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 91
    +
    +def get_server_signer(server_signer_id, opts = {})
    +  data, _status_code, _headers = get_server_signer_with_http_info(server_signer_id, opts)
    +  data
    +end
    +
    +
    + +
    +

    + + #get_server_signer_with_http_info(server_signer_id, opts = {}) ⇒ Array<(ServerSigner, Integer, Hash)> + + + + + +

    +
    + +

    Get a server signer by ID Get a server signer by ID

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + server_signer_id + + + (String) + + + + — +
      +

      The ID of the server signer to fetch

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Array<(ServerSigner, Integer, Hash)>) + + + + — +
      +

      ServerSigner data, response status code and response headers

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 101
    +
    +def get_server_signer_with_http_info(server_signer_id, opts = {})
    +  if @api_client.config.debugging
    +    @api_client.config.logger.debug 'Calling API: ServerSignersApi.get_server_signer ...'
    +  end
    +  # verify the required parameter 'server_signer_id' is set
    +  if @api_client.config.client_side_validation && server_signer_id.nil?
    +    fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.get_server_signer"
    +  end
    +  # resource path
    +  local_var_path = '/v1/server_signers/{server_signer_id}'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_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'])
    +
    +  # form parameters
    +  form_params = opts[:form_params] || {}
    +
    +  # http body (model)
    +  post_body = opts[:debug_body]
    +
    +  # return_type
    +  return_type = opts[:debug_return_type] || 'ServerSigner'
    +
    +  # auth_names
    +  auth_names = opts[:debug_auth_names] || []
    +
    +  new_options = opts.merge(
    +    :operation => :"ServerSignersApi.get_server_signer",
    +    :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: ServerSignersApi#get_server_signer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    +  end
    +  return data, status_code, headers
    +end
    +
    +
    + +
    +

    + + #list_server_signer_events(server_signer_id, opts = {}) ⇒ ServerSignerEventList + + + + + +

    +
    + +

    List events for a server signer List events for a server signer

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + server_signer_id + + + (String) + + + + — +
      +

      The ID of the server signer to fetch events for

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + + + + + + +

    Options Hash (opts):

    +
      + +
    • + :limit + (Integer) + + + + + —
      +

      A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

      +
      + +
    • + +
    • + :page + (String) + + + + + —
      +

      A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.

      +
      + +
    • + +
    + + +

    Returns:

    + + +
    + + + + +
    +
    +
    +
    +156
    +157
    +158
    +159
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 156
    +
    +def list_server_signer_events(server_signer_id, opts = {})
    +  data, _status_code, _headers = list_server_signer_events_with_http_info(server_signer_id, opts)
    +  data
    +end
    +
    +
    + +
    +

    + + #list_server_signer_events_with_http_info(server_signer_id, opts = {}) ⇒ Array<(ServerSignerEventList, Integer, Hash)> + + + + + +

    +
    + +

    List events for a server signer List events for a server signer

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + server_signer_id + + + (String) + + + + — +
      +

      The ID of the server signer to fetch events for

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + + + + + + +

    Options Hash (opts):

    +
      + +
    • + :limit + (Integer) + + + + + —
      +

      A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

      +
      + +
    • + +
    • + :page + (String) + + + + + —
      +

      A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.

      +
      + +
    • + +
    + + +

    Returns:

    +
      + +
    • + + + (Array<(ServerSignerEventList, Integer, Hash)>) + + + + — +
      +

      ServerSignerEventList data, response status code and response headers

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 168
    +
    +def list_server_signer_events_with_http_info(server_signer_id, opts = {})
    +  if @api_client.config.debugging
    +    @api_client.config.logger.debug 'Calling API: ServerSignersApi.list_server_signer_events ...'
    +  end
    +  # verify the required parameter 'server_signer_id' is set
    +  if @api_client.config.client_side_validation && server_signer_id.nil?
    +    fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.list_server_signer_events"
    +  end
    +  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
    +    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ServerSignersApi.list_server_signer_events, the character length must be smaller than or equal to 5000.'
    +  end
    +
    +  # resource path
    +  local_var_path = '/v1/server_signers/{server_signer_id}/events'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_id.to_s))
    +
    +  # query parameters
    +  query_params = opts[:query_params] || {}
    +  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
    +  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
    +
    +  # header parameters
    +  header_params = opts[:header_params] || {}
    +  # HTTP header 'Accept' (if needed)
    +  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
    +
    +  # form parameters
    +  form_params = opts[:form_params] || {}
    +
    +  # http body (model)
    +  post_body = opts[:debug_body]
    +
    +  # return_type
    +  return_type = opts[:debug_return_type] || 'ServerSignerEventList'
    +
    +  # auth_names
    +  auth_names = opts[:debug_auth_names] || []
    +
    +  new_options = opts.merge(
    +    :operation => :"ServerSignersApi.list_server_signer_events",
    +    :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: ServerSignersApi#list_server_signer_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    +  end
    +  return data, status_code, headers
    +end
    +
    +
    + +
    +

    + + #list_server_signers(opts = {}) ⇒ ServerSigner + + + + + +

    +
    + +

    List server signers for the current project List server signers for the current project

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + +

    Returns:

    + + +
    + + + + +
    +
    +
    +
    +226
    +227
    +228
    +229
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 226
    +
    +def list_server_signers(opts = {})
    +  data, _status_code, _headers = list_server_signers_with_http_info(opts)
    +  data
    +end
    +
    +
    + +
    +

    + + #list_server_signers_with_http_info(opts = {}) ⇒ Array<(ServerSigner, Integer, Hash)> + + + + + +

    +
    + +

    List server signers for the current project List server signers for the current project

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Array<(ServerSigner, Integer, Hash)>) + + + + — +
      +

      ServerSigner data, response status code and response headers

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +235
    +236
    +237
    +238
    +239
    +240
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +253
    +254
    +255
    +256
    +257
    +258
    +259
    +260
    +261
    +262
    +263
    +264
    +265
    +266
    +267
    +268
    +269
    +270
    +271
    +272
    +273
    +274
    +275
    +276
    +277
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 235
    +
    +def list_server_signers_with_http_info(opts = {})
    +  if @api_client.config.debugging
    +    @api_client.config.logger.debug 'Calling API: ServerSignersApi.list_server_signers ...'
    +  end
    +  # resource path
    +  local_var_path = '/v1/server_signers'
    +
    +  # 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'])
    +
    +  # form parameters
    +  form_params = opts[:form_params] || {}
    +
    +  # http body (model)
    +  post_body = opts[:debug_body]
    +
    +  # return_type
    +  return_type = opts[:debug_return_type] || 'ServerSigner'
    +
    +  # auth_names
    +  auth_names = opts[:debug_auth_names] || []
    +
    +  new_options = opts.merge(
    +    :operation => :"ServerSignersApi.list_server_signers",
    +    :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: ServerSignersApi#list_server_signers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    +  end
    +  return data, status_code, headers
    +end
    +
    +
    + +
    +

    + + #submit_server_signer_seed_event_result(server_signer_id, opts = {}) ⇒ SeedCreationEventResult + + + + + +

    +
    + +

    Submit the result of a server signer event Submit the result of a server signer event

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + server_signer_id + + + (String) + + + + — +
      +

      The ID of the server signer to submit the event result for

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + + + + + + +

    Options Hash (opts):

    + + + +

    Returns:

    + + +
    + + + + +
    +
    +
    +
    +285
    +286
    +287
    +288
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 285
    +
    +def submit_server_signer_seed_event_result(server_signer_id, opts = {})
    +  data, _status_code, _headers = submit_server_signer_seed_event_result_with_http_info(server_signer_id, opts)
    +  data
    +end
    +
    +
    + +
    +

    + + #submit_server_signer_seed_event_result_with_http_info(server_signer_id, opts = {}) ⇒ Array<(SeedCreationEventResult, Integer, Hash)> + + + + + +

    +
    + +

    Submit the result of a server signer event Submit the result of a server signer event

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + server_signer_id + + + (String) + + + + — +
      +

      The ID of the server signer to submit the event result for

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + + + + + + +

    Options Hash (opts):

    + + + +

    Returns:

    +
      + +
    • + + + (Array<(SeedCreationEventResult, Integer, Hash)>) + + + + — +
      +

      SeedCreationEventResult data, response status code and response headers

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +296
    +297
    +298
    +299
    +300
    +301
    +302
    +303
    +304
    +305
    +306
    +307
    +308
    +309
    +310
    +311
    +312
    +313
    +314
    +315
    +316
    +317
    +318
    +319
    +320
    +321
    +322
    +323
    +324
    +325
    +326
    +327
    +328
    +329
    +330
    +331
    +332
    +333
    +334
    +335
    +336
    +337
    +338
    +339
    +340
    +341
    +342
    +343
    +344
    +345
    +346
    +347
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 296
    +
    +def submit_server_signer_seed_event_result_with_http_info(server_signer_id, opts = {})
    +  if @api_client.config.debugging
    +    @api_client.config.logger.debug 'Calling API: ServerSignersApi.submit_server_signer_seed_event_result ...'
    +  end
    +  # verify the required parameter 'server_signer_id' is set
    +  if @api_client.config.client_side_validation && server_signer_id.nil?
    +    fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.submit_server_signer_seed_event_result"
    +  end
    +  # resource path
    +  local_var_path = '/v1/server_signers/{server_signer_id}/seed_event_result'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_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'])
    +  # 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[:'seed_creation_event_result'])
    +
    +  # return_type
    +  return_type = opts[:debug_return_type] || 'SeedCreationEventResult'
    +
    +  # auth_names
    +  auth_names = opts[:debug_auth_names] || []
    +
    +  new_options = opts.merge(
    +    :operation => :"ServerSignersApi.submit_server_signer_seed_event_result",
    +    :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: ServerSignersApi#submit_server_signer_seed_event_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    +  end
    +  return data, status_code, headers
    +end
    +
    +
    + +
    +

    + + #submit_server_signer_signature_event_result(server_signer_id, opts = {}) ⇒ SignatureCreationEventResult + + + + + +

    +
    + +

    Submit the result of a server signer event Submit the result of a server signer event

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + server_signer_id + + + (String) + + + + — +
      +

      The ID of the server signer to submit the event result for

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + + + + + + +

    Options Hash (opts):

    + + + +

    Returns:

    + + +
    + + + + +
    +
    +
    +
    +355
    +356
    +357
    +358
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 355
    +
    +def submit_server_signer_signature_event_result(server_signer_id, opts = {})
    +  data, _status_code, _headers = submit_server_signer_signature_event_result_with_http_info(server_signer_id, opts)
    +  data
    +end
    +
    +
    + +
    +

    + + #submit_server_signer_signature_event_result_with_http_info(server_signer_id, opts = {}) ⇒ Array<(SignatureCreationEventResult, Integer, Hash)> + + + + + +

    +
    + +

    Submit the result of a server signer event Submit the result of a server signer event

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + server_signer_id + + + (String) + + + + — +
      +

      The ID of the server signer to submit the event result for

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + + + + + + +

    Options Hash (opts):

    + + + +

    Returns:

    +
      + +
    • + + + (Array<(SignatureCreationEventResult, Integer, Hash)>) + + + + — +
      +

      SignatureCreationEventResult data, response status code and response headers

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +366
    +367
    +368
    +369
    +370
    +371
    +372
    +373
    +374
    +375
    +376
    +377
    +378
    +379
    +380
    +381
    +382
    +383
    +384
    +385
    +386
    +387
    +388
    +389
    +390
    +391
    +392
    +393
    +394
    +395
    +396
    +397
    +398
    +399
    +400
    +401
    +402
    +403
    +404
    +405
    +406
    +407
    +408
    +409
    +410
    +411
    +412
    +413
    +414
    +415
    +416
    +417
    +
    +
    # File 'lib/coinbase/client/api/server_signers_api.rb', line 366
    +
    +def submit_server_signer_signature_event_result_with_http_info(server_signer_id, opts = {})
    +  if @api_client.config.debugging
    +    @api_client.config.logger.debug 'Calling API: ServerSignersApi.submit_server_signer_signature_event_result ...'
    +  end
    +  # verify the required parameter 'server_signer_id' is set
    +  if @api_client.config.client_side_validation && server_signer_id.nil?
    +    fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.submit_server_signer_signature_event_result"
    +  end
    +  # resource path
    +  local_var_path = '/v1/server_signers/{server_signer_id}/signature_event_result'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_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'])
    +  # 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[:'signature_creation_event_result'])
    +
    +  # return_type
    +  return_type = opts[:debug_return_type] || 'SignatureCreationEventResult'
    +
    +  # auth_names
    +  auth_names = opts[:debug_auth_names] || []
    +
    +  new_options = opts.merge(
    +    :operation => :"ServerSignersApi.submit_server_signer_signature_event_result",
    +    :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: ServerSignersApi#submit_server_signer_signature_event_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    +  end
    +  return data, status_code, headers
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/SignatureCreationEvent.html b/docs/Coinbase/Client/SignatureCreationEvent.html new file mode 100644 index 00000000..3a2f8c2b --- /dev/null +++ b/docs/Coinbase/Client/SignatureCreationEvent.html @@ -0,0 +1,2504 @@ + + + + + + + Class: Coinbase::Client::SignatureCreationEvent + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::SignatureCreationEvent + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/signature_creation_event.rb
    +
    + +
    + +

    Overview

    +
    + +

    An event representing a signature creation.

    + + +
    +
    +
    + + +

    Defined Under Namespace

    +

    + + + + + Classes: EnumAttributeValidator + + +

    + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #address_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the address the transfer belongs to.

      +
      + +
    • + + +
    • + + + #address_index ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The index of the address that the server-signer should sign with.

      +
      + +
    • + + +
    • + + + #seed_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the seed that the server-signer should create the signature for.

      +
      + +
    • + + +
    • + + + #signing_payload ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The payload that the server-signer should sign.

      +
      + +
    • + + +
    • + + + #transaction_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the transaction that the server-signer should sign.

      +
      + +
    • + + +
    • + + + #transaction_type ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Returns the value of attribute transaction_type.

      +
      + +
    • + + +
    • + + + #wallet_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the wallet the signature is for.

      +
      + +
    • + + +
    • + + + #wallet_user_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the user that the wallet belongs to.

      +
      + +
    • + + +
    + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ SignatureCreationEvent + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 105
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::SignatureCreationEvent` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::SignatureCreationEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'seed_id')
    +    self.seed_id = attributes[:'seed_id']
    +  else
    +    self.seed_id = nil
    +  end
    +
    +  if attributes.key?(:'wallet_id')
    +    self.wallet_id = attributes[:'wallet_id']
    +  else
    +    self.wallet_id = nil
    +  end
    +
    +  if attributes.key?(:'wallet_user_id')
    +    self.wallet_user_id = attributes[:'wallet_user_id']
    +  else
    +    self.wallet_user_id = nil
    +  end
    +
    +  if attributes.key?(:'address_id')
    +    self.address_id = attributes[:'address_id']
    +  else
    +    self.address_id = nil
    +  end
    +
    +  if attributes.key?(:'address_index')
    +    self.address_index = attributes[:'address_index']
    +  else
    +    self.address_index = nil
    +  end
    +
    +  if attributes.key?(:'signing_payload')
    +    self.signing_payload = attributes[:'signing_payload']
    +  else
    +    self.signing_payload = nil
    +  end
    +
    +  if attributes.key?(:'transaction_type')
    +    self.transaction_type = attributes[:'transaction_type']
    +  else
    +    self.transaction_type = nil
    +  end
    +
    +  if attributes.key?(:'transaction_id')
    +    self.transaction_id = attributes[:'transaction_id']
    +  else
    +    self.transaction_id = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #address_idObject + + + + + +

    +
    + +

    The ID of the address the transfer belongs to

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +29
    +30
    +31
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 29
    +
    +def address_id
    +  @address_id
    +end
    +
    +
    + + + +
    +

    + + #address_indexObject + + + + + +

    +
    + +

    The index of the address that the server-signer should sign with

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +32
    +33
    +34
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 32
    +
    +def address_index
    +  @address_index
    +end
    +
    +
    + + + +
    +

    + + #seed_idObject + + + + + +

    +
    + +

    The ID of the seed that the server-signer should create the signature for

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 20
    +
    +def seed_id
    +  @seed_id
    +end
    +
    +
    + + + +
    +

    + + #signing_payloadObject + + + + + +

    +
    + +

    The payload that the server-signer should sign

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +35
    +36
    +37
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 35
    +
    +def signing_payload
    +  @signing_payload
    +end
    +
    +
    + + + +
    +

    + + #transaction_idObject + + + + + +

    +
    + +

    The ID of the transaction that the server-signer should sign

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +40
    +41
    +42
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 40
    +
    +def transaction_id
    +  @transaction_id
    +end
    +
    +
    + + + +
    +

    + + #transaction_typeObject + + + + + +

    +
    + +

    Returns the value of attribute transaction_type.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +37
    +38
    +39
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 37
    +
    +def transaction_type
    +  @transaction_type
    +end
    +
    +
    + + + +
    +

    + + #wallet_idObject + + + + + +

    +
    + +

    The ID of the wallet the signature is for

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 23
    +
    +def wallet_id
    +  @wallet_id
    +end
    +
    +
    + + + +
    +

    + + #wallet_user_idObject + + + + + +

    +
    + +

    The ID of the user that the wallet belongs to

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +26
    +27
    +28
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 26
    +
    +def wallet_user_id
    +  @wallet_user_id
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +276
    +277
    +278
    +279
    +280
    +281
    +282
    +283
    +284
    +285
    +286
    +287
    +288
    +289
    +290
    +291
    +292
    +293
    +294
    +295
    +296
    +297
    +298
    +299
    +300
    +301
    +302
    +303
    +304
    +305
    +306
    +307
    +308
    +309
    +310
    +311
    +312
    +313
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 276
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +79
    +80
    +81
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 79
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 65
    +
    +def self.attribute_map
    +  {
    +    :'seed_id' => :'seed_id',
    +    :'wallet_id' => :'wallet_id',
    +    :'wallet_user_id' => :'wallet_user_id',
    +    :'address_id' => :'address_id',
    +    :'address_index' => :'address_index',
    +    :'signing_payload' => :'signing_payload',
    +    :'transaction_type' => :'transaction_type',
    +    :'transaction_id' => :'transaction_id'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +252
    +253
    +254
    +255
    +256
    +257
    +258
    +259
    +260
    +261
    +262
    +263
    +264
    +265
    +266
    +267
    +268
    +269
    +270
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 252
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +98
    +99
    +100
    +101
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 98
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 84
    +
    +def self.openapi_types
    +  {
    +    :'seed_id' => :'String',
    +    :'wallet_id' => :'String',
    +    :'wallet_user_id' => :'String',
    +    :'address_id' => :'String',
    +    :'address_index' => :'Integer',
    +    :'signing_payload' => :'String',
    +    :'transaction_type' => :'TransactionType',
    +    :'transaction_id' => :'String'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 224
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      seed_id == o.seed_id &&
    +      wallet_id == o.wallet_id &&
    +      wallet_user_id == o.wallet_user_id &&
    +      address_id == o.address_id &&
    +      address_index == o.address_index &&
    +      signing_payload == o.signing_payload &&
    +      transaction_type == o.transaction_type &&
    +      transaction_id == o.transaction_id
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +347
    +348
    +349
    +350
    +351
    +352
    +353
    +354
    +355
    +356
    +357
    +358
    +359
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 347
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +239
    +240
    +241
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 239
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +245
    +246
    +247
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 245
    +
    +def hash
    +  [seed_id, wallet_id, wallet_user_id, address_id, address_index, signing_payload, transaction_type, transaction_id].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 169
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @seed_id.nil?
    +    invalid_properties.push('invalid value for "seed_id", seed_id cannot be nil.')
    +  end
    +
    +  if @wallet_id.nil?
    +    invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.')
    +  end
    +
    +  if @wallet_user_id.nil?
    +    invalid_properties.push('invalid value for "wallet_user_id", wallet_user_id cannot be nil.')
    +  end
    +
    +  if @address_id.nil?
    +    invalid_properties.push('invalid value for "address_id", address_id cannot be nil.')
    +  end
    +
    +  if @address_index.nil?
    +    invalid_properties.push('invalid value for "address_index", address_index cannot be nil.')
    +  end
    +
    +  if @signing_payload.nil?
    +    invalid_properties.push('invalid value for "signing_payload", signing_payload cannot be nil.')
    +  end
    +
    +  if @transaction_type.nil?
    +    invalid_properties.push('invalid value for "transaction_type", transaction_type cannot be nil.')
    +  end
    +
    +  if @transaction_id.nil?
    +    invalid_properties.push('invalid value for "transaction_id", transaction_id cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +323
    +324
    +325
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 323
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +329
    +330
    +331
    +332
    +333
    +334
    +335
    +336
    +337
    +338
    +339
    +340
    +341
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 329
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +317
    +318
    +319
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 317
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 209
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @seed_id.nil?
    +  return false if @wallet_id.nil?
    +  return false if @wallet_user_id.nil?
    +  return false if @address_id.nil?
    +  return false if @address_index.nil?
    +  return false if @signing_payload.nil?
    +  return false if @transaction_type.nil?
    +  return false if @transaction_id.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/SignatureCreationEvent/EnumAttributeValidator.html b/docs/Coinbase/Client/SignatureCreationEvent/EnumAttributeValidator.html new file mode 100644 index 00000000..61d2d610 --- /dev/null +++ b/docs/Coinbase/Client/SignatureCreationEvent/EnumAttributeValidator.html @@ -0,0 +1,453 @@ + + + + + + + Class: Coinbase::Client::SignatureCreationEvent::EnumAttributeValidator + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::SignatureCreationEvent::EnumAttributeValidator + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/signature_creation_event.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #allowable_values ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
      +

      Returns the value of attribute allowable_values.

      +
      + +
    • + + +
    • + + + #datatype ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
      +

      Returns the value of attribute datatype.

      +
      + +
    • + + +
    + + + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(datatype, allowable_values) ⇒ EnumAttributeValidator + + + + + +

    +
    + +

    Returns a new instance of EnumAttributeValidator.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 46
    +
    +def initialize(datatype, allowable_values)
    +  @allowable_values = allowable_values.map do |value|
    +    case datatype.to_s
    +    when /Integer/i
    +      value.to_i
    +    when /Float/i
    +      value.to_f
    +    else
    +      value
    +    end
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #allowable_valuesObject (readonly) + + + + + +

    +
    + +

    Returns the value of attribute allowable_values.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +44
    +45
    +46
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 44
    +
    +def allowable_values
    +  @allowable_values
    +end
    +
    +
    + + + +
    +

    + + #datatypeObject (readonly) + + + + + +

    +
    + +

    Returns the value of attribute datatype.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +43
    +44
    +45
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 43
    +
    +def datatype
    +  @datatype
    +end
    +
    +
    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + #valid?(value) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +59
    +60
    +61
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event.rb', line 59
    +
    +def valid?(value)
    +  !value || allowable_values.include?(value)
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/SignatureCreationEventResult.html b/docs/Coinbase/Client/SignatureCreationEventResult.html new file mode 100644 index 00000000..c31b34d0 --- /dev/null +++ b/docs/Coinbase/Client/SignatureCreationEventResult.html @@ -0,0 +1,2308 @@ + + + + + + + Class: Coinbase::Client::SignatureCreationEventResult + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::SignatureCreationEventResult + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/signature_creation_event_result.rb
    +
    + +
    + +

    Overview

    +
    + +

    The result to a SignatureCreationEvent.

    + + +
    +
    +
    + + +

    Defined Under Namespace

    +

    + + + + + Classes: EnumAttributeValidator + + +

    + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #address_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the address the transfer belongs to.

      +
      + +
    • + + +
    • + + + #signature ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The signature created by the server-signer.

      +
      + +
    • + + +
    • + + + #transaction_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the transaction that the Server-Signer has signed for.

      +
      + +
    • + + +
    • + + + #transaction_type ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Returns the value of attribute transaction_type.

      +
      + +
    • + + +
    • + + + #wallet_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the wallet that the event was created for.

      +
      + +
    • + + +
    • + + + #wallet_user_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the user that the wallet belongs to.

      +
      + +
    • + + +
    + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ SignatureCreationEventResult + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 95
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::SignatureCreationEventResult` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::SignatureCreationEventResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'wallet_id')
    +    self.wallet_id = attributes[:'wallet_id']
    +  else
    +    self.wallet_id = nil
    +  end
    +
    +  if attributes.key?(:'wallet_user_id')
    +    self.wallet_user_id = attributes[:'wallet_user_id']
    +  else
    +    self.wallet_user_id = nil
    +  end
    +
    +  if attributes.key?(:'address_id')
    +    self.address_id = attributes[:'address_id']
    +  else
    +    self.address_id = nil
    +  end
    +
    +  if attributes.key?(:'transaction_type')
    +    self.transaction_type = attributes[:'transaction_type']
    +  else
    +    self.transaction_type = nil
    +  end
    +
    +  if attributes.key?(:'transaction_id')
    +    self.transaction_id = attributes[:'transaction_id']
    +  else
    +    self.transaction_id = nil
    +  end
    +
    +  if attributes.key?(:'signature')
    +    self.signature = attributes[:'signature']
    +  else
    +    self.signature = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #address_idObject + + + + + +

    +
    + +

    The ID of the address the transfer belongs to

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +26
    +27
    +28
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 26
    +
    +def address_id
    +  @address_id
    +end
    +
    +
    + + + +
    +

    + + #signatureObject + + + + + +

    +
    + +

    The signature created by the server-signer.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +34
    +35
    +36
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 34
    +
    +def signature
    +  @signature
    +end
    +
    +
    + + + +
    +

    + + #transaction_idObject + + + + + +

    +
    + +

    The ID of the transaction that the Server-Signer has signed for

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +31
    +32
    +33
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 31
    +
    +def transaction_id
    +  @transaction_id
    +end
    +
    +
    + + + +
    +

    + + #transaction_typeObject + + + + + +

    +
    + +

    Returns the value of attribute transaction_type.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +28
    +29
    +30
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 28
    +
    +def transaction_type
    +  @transaction_type
    +end
    +
    +
    + + + +
    +

    + + #wallet_idObject + + + + + +

    +
    + +

    The ID of the wallet that the event was created for.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 20
    +
    +def wallet_id
    +  @wallet_id
    +end
    +
    +
    + + + +
    +

    + + #wallet_user_idObject + + + + + +

    +
    + +

    The ID of the user that the wallet belongs to

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 23
    +
    +def wallet_user_id
    +  @wallet_user_id
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +242
    +243
    +244
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +253
    +254
    +255
    +256
    +257
    +258
    +259
    +260
    +261
    +262
    +263
    +264
    +265
    +266
    +267
    +268
    +269
    +270
    +271
    +272
    +273
    +274
    +275
    +276
    +277
    +278
    +279
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 242
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +71
    +72
    +73
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 71
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 59
    +
    +def self.attribute_map
    +  {
    +    :'wallet_id' => :'wallet_id',
    +    :'wallet_user_id' => :'wallet_user_id',
    +    :'address_id' => :'address_id',
    +    :'transaction_type' => :'transaction_type',
    +    :'transaction_id' => :'transaction_id',
    +    :'signature' => :'signature'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +236
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 218
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +88
    +89
    +90
    +91
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 88
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 76
    +
    +def self.openapi_types
    +  {
    +    :'wallet_id' => :'String',
    +    :'wallet_user_id' => :'String',
    +    :'address_id' => :'String',
    +    :'transaction_type' => :'TransactionType',
    +    :'transaction_id' => :'String',
    +    :'signature' => :'String'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 192
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      wallet_id == o.wallet_id &&
    +      wallet_user_id == o.wallet_user_id &&
    +      address_id == o.address_id &&
    +      transaction_type == o.transaction_type &&
    +      transaction_id == o.transaction_id &&
    +      signature == o.signature
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +313
    +314
    +315
    +316
    +317
    +318
    +319
    +320
    +321
    +322
    +323
    +324
    +325
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 313
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +205
    +206
    +207
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 205
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +211
    +212
    +213
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 211
    +
    +def hash
    +  [wallet_id, wallet_user_id, address_id, transaction_type, transaction_id, signature].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 147
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @wallet_id.nil?
    +    invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.')
    +  end
    +
    +  if @wallet_user_id.nil?
    +    invalid_properties.push('invalid value for "wallet_user_id", wallet_user_id cannot be nil.')
    +  end
    +
    +  if @address_id.nil?
    +    invalid_properties.push('invalid value for "address_id", address_id cannot be nil.')
    +  end
    +
    +  if @transaction_type.nil?
    +    invalid_properties.push('invalid value for "transaction_type", transaction_type cannot be nil.')
    +  end
    +
    +  if @transaction_id.nil?
    +    invalid_properties.push('invalid value for "transaction_id", transaction_id cannot be nil.')
    +  end
    +
    +  if @signature.nil?
    +    invalid_properties.push('invalid value for "signature", signature cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +289
    +290
    +291
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 289
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +295
    +296
    +297
    +298
    +299
    +300
    +301
    +302
    +303
    +304
    +305
    +306
    +307
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 295
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +283
    +284
    +285
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 283
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 179
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @wallet_id.nil?
    +  return false if @wallet_user_id.nil?
    +  return false if @address_id.nil?
    +  return false if @transaction_type.nil?
    +  return false if @transaction_id.nil?
    +  return false if @signature.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/SignatureCreationEventResult/EnumAttributeValidator.html b/docs/Coinbase/Client/SignatureCreationEventResult/EnumAttributeValidator.html new file mode 100644 index 00000000..31a4b10d --- /dev/null +++ b/docs/Coinbase/Client/SignatureCreationEventResult/EnumAttributeValidator.html @@ -0,0 +1,453 @@ + + + + + + + Class: Coinbase::Client::SignatureCreationEventResult::EnumAttributeValidator + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::SignatureCreationEventResult::EnumAttributeValidator + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/signature_creation_event_result.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #allowable_values ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
      +

      Returns the value of attribute allowable_values.

      +
      + +
    • + + +
    • + + + #datatype ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
      +

      Returns the value of attribute datatype.

      +
      + +
    • + + +
    + + + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(datatype, allowable_values) ⇒ EnumAttributeValidator + + + + + +

    +
    + +

    Returns a new instance of EnumAttributeValidator.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 40
    +
    +def initialize(datatype, allowable_values)
    +  @allowable_values = allowable_values.map do |value|
    +    case datatype.to_s
    +    when /Integer/i
    +      value.to_i
    +    when /Float/i
    +      value.to_f
    +    else
    +      value
    +    end
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #allowable_valuesObject (readonly) + + + + + +

    +
    + +

    Returns the value of attribute allowable_values.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +38
    +39
    +40
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 38
    +
    +def allowable_values
    +  @allowable_values
    +end
    +
    +
    + + + +
    +

    + + #datatypeObject (readonly) + + + + + +

    +
    + +

    Returns the value of attribute datatype.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +37
    +38
    +39
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 37
    +
    +def datatype
    +  @datatype
    +end
    +
    +
    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + #valid?(value) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +53
    +54
    +55
    +
    +
    # File 'lib/coinbase/client/models/signature_creation_event_result.rb', line 53
    +
    +def valid?(value)
    +  !value || allowable_values.include?(value)
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/Trade.html b/docs/Coinbase/Client/Trade.html new file mode 100644 index 00000000..5605ccf6 --- /dev/null +++ b/docs/Coinbase/Client/Trade.html @@ -0,0 +1,2592 @@ + + + + + + + Class: Coinbase::Client::Trade + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::Trade + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/trade.rb
    +
    + +
    + +

    Overview

    +
    + +

    A trade of an asset to another asset

    + + +
    +
    +
    + + +
    + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #address_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The onchain address of the sender.

      +
      + +
    • + + +
    • + + + #from_amount ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The amount of the from asset to be traded (in atomic units of the from asset).

      +
      + +
    • + + +
    • + + + #from_asset ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Returns the value of attribute from_asset.

      +
      + +
    • + + +
    • + + + #network_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the blockchain network.

      +
      + +
    • + + +
    • + + + #to_amount ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The amount of the to asset that will be received (in atomic units of the to asset).

      +
      + +
    • + + +
    • + + + #to_asset ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Returns the value of attribute to_asset.

      +
      + +
    • + + +
    • + + + #trade_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the trade.

      +
      + +
    • + + +
    • + + + #transaction ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Returns the value of attribute transaction.

      +
      + +
    • + + +
    • + + + #wallet_id ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The ID of the wallet that owns the from address.

      +
      + +
    • + + +
    + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + +
      + +
    • + + + #==(o) ⇒ Object + + + + + + + + + + + + + +
      +

      Checks equality by comparing each attribute.

      +
      + +
    • + + +
    • + + + #_to_hash(value) ⇒ Hash + + + + + + + + + + + + + +
      +

      Outputs non-array value in the form of hash For object, use to_hash.

      +
      + +
    • + + +
    • + + + #eql?(o) ⇒ Boolean + + + + + + + + + + + + + +
      + +
    • + + +
    • + + + #hash ⇒ Integer + + + + + + + + + + + + + +
      +

      Calculates hash code according to all attributes.

      +
      + +
    • + + +
    • + + + #initialize(attributes = {}) ⇒ Trade + + + + + + + constructor + + + + + + + + +
      +

      Initializes the object.

      +
      + +
    • + + +
    • + + + #list_invalid_properties ⇒ Object + + + + + + + + + + + + + +
      +

      Show invalid properties with the reasons.

      +
      + +
    • + + +
    • + + + #to_body ⇒ Hash + + + + + + + + + + + + + +
      +

      to_body is an alias to to_hash (backward compatibility).

      +
      + +
    • + + +
    • + + + #to_hash ⇒ Hash + + + + + + + + + + + + + +
      +

      Returns the object in the form of hash.

      +
      + +
    • + + +
    • + + + #to_s ⇒ String + + + + + + + + + + + + + +
      +

      Returns the string representation of the object.

      +
      + +
    • + + +
    • + + + #valid? ⇒ Boolean + + + + + + + + + + + + + +
      +

      Check to see if the all the properties in the model are valid.

      +
      + +
    • + + +
    + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ Trade + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 86
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::Trade` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::Trade`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'network_id')
    +    self.network_id = attributes[:'network_id']
    +  else
    +    self.network_id = nil
    +  end
    +
    +  if attributes.key?(:'wallet_id')
    +    self.wallet_id = attributes[:'wallet_id']
    +  else
    +    self.wallet_id = nil
    +  end
    +
    +  if attributes.key?(:'address_id')
    +    self.address_id = attributes[:'address_id']
    +  else
    +    self.address_id = nil
    +  end
    +
    +  if attributes.key?(:'trade_id')
    +    self.trade_id = attributes[:'trade_id']
    +  else
    +    self.trade_id = nil
    +  end
    +
    +  if attributes.key?(:'from_amount')
    +    self.from_amount = attributes[:'from_amount']
    +  else
    +    self.from_amount = nil
    +  end
    +
    +  if attributes.key?(:'from_asset')
    +    self.from_asset = attributes[:'from_asset']
    +  else
    +    self.from_asset = nil
    +  end
    +
    +  if attributes.key?(:'to_amount')
    +    self.to_amount = attributes[:'to_amount']
    +  else
    +    self.to_amount = nil
    +  end
    +
    +  if attributes.key?(:'to_asset')
    +    self.to_asset = attributes[:'to_asset']
    +  else
    +    self.to_asset = nil
    +  end
    +
    +  if attributes.key?(:'transaction')
    +    self.transaction = attributes[:'transaction']
    +  else
    +    self.transaction = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #address_idObject + + + + + +

    +
    + +

    The onchain address of the sender

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +26
    +27
    +28
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 26
    +
    +def address_id
    +  @address_id
    +end
    +
    +
    + + + +
    +

    + + #from_amountObject + + + + + +

    +
    + +

    The amount of the from asset to be traded (in atomic units of the from asset)

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +32
    +33
    +34
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 32
    +
    +def from_amount
    +  @from_amount
    +end
    +
    +
    + + + +
    +

    + + #from_assetObject + + + + + +

    +
    + +

    Returns the value of attribute from_asset.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +34
    +35
    +36
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 34
    +
    +def from_asset
    +  @from_asset
    +end
    +
    +
    + + + +
    +

    + + #network_idObject + + + + + +

    +
    + +

    The ID of the blockchain network

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 20
    +
    +def network_id
    +  @network_id
    +end
    +
    +
    + + + +
    +

    + + #to_amountObject + + + + + +

    +
    + +

    The amount of the to asset that will be received (in atomic units of the to asset)

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +37
    +38
    +39
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 37
    +
    +def to_amount
    +  @to_amount
    +end
    +
    +
    + + + +
    +

    + + #to_assetObject + + + + + +

    +
    + +

    Returns the value of attribute to_asset.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +39
    +40
    +41
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 39
    +
    +def to_asset
    +  @to_asset
    +end
    +
    +
    + + + +
    +

    + + #trade_idObject + + + + + +

    +
    + +

    The ID of the trade

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +29
    +30
    +31
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 29
    +
    +def trade_id
    +  @trade_id
    +end
    +
    +
    + + + +
    +

    + + #transactionObject + + + + + +

    +
    + +

    Returns the value of attribute transaction.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +41
    +42
    +43
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 41
    +
    +def transaction
    +  @transaction
    +end
    +
    +
    + + + +
    +

    + + #wallet_idObject + + + + + +

    +
    + +

    The ID of the wallet that owns the from address

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 23
    +
    +def wallet_id
    +  @wallet_id
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +269
    +270
    +271
    +272
    +273
    +274
    +275
    +276
    +277
    +278
    +279
    +280
    +281
    +282
    +283
    +284
    +285
    +286
    +287
    +288
    +289
    +290
    +291
    +292
    +293
    +294
    +295
    +296
    +297
    +298
    +299
    +300
    +301
    +302
    +303
    +304
    +305
    +306
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 269
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +59
    +60
    +61
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 59
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 44
    +
    +def self.attribute_map
    +  {
    +    :'network_id' => :'network_id',
    +    :'wallet_id' => :'wallet_id',
    +    :'address_id' => :'address_id',
    +    :'trade_id' => :'trade_id',
    +    :'from_amount' => :'from_amount',
    +    :'from_asset' => :'from_asset',
    +    :'to_amount' => :'to_amount',
    +    :'to_asset' => :'to_asset',
    +    :'transaction' => :'transaction'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +253
    +254
    +255
    +256
    +257
    +258
    +259
    +260
    +261
    +262
    +263
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 245
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +79
    +80
    +81
    +82
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 79
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 64
    +
    +def self.openapi_types
    +  {
    +    :'network_id' => :'String',
    +    :'wallet_id' => :'String',
    +    :'address_id' => :'String',
    +    :'trade_id' => :'String',
    +    :'from_amount' => :'String',
    +    :'from_asset' => :'Asset',
    +    :'to_amount' => :'String',
    +    :'to_asset' => :'Asset',
    +    :'transaction' => :'Transaction'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +216
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 216
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      network_id == o.network_id &&
    +      wallet_id == o.wallet_id &&
    +      address_id == o.address_id &&
    +      trade_id == o.trade_id &&
    +      from_amount == o.from_amount &&
    +      from_asset == o.from_asset &&
    +      to_amount == o.to_amount &&
    +      to_asset == o.to_asset &&
    +      transaction == o.transaction
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +340
    +341
    +342
    +343
    +344
    +345
    +346
    +347
    +348
    +349
    +350
    +351
    +352
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 340
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +232
    +233
    +234
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 232
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +238
    +239
    +240
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 238
    +
    +def hash
    +  [network_id, wallet_id, address_id, trade_id, from_amount, from_asset, to_amount, to_asset, transaction].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 156
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @network_id.nil?
    +    invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
    +  end
    +
    +  if @wallet_id.nil?
    +    invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.')
    +  end
    +
    +  if @address_id.nil?
    +    invalid_properties.push('invalid value for "address_id", address_id cannot be nil.')
    +  end
    +
    +  if @trade_id.nil?
    +    invalid_properties.push('invalid value for "trade_id", trade_id cannot be nil.')
    +  end
    +
    +  if @from_amount.nil?
    +    invalid_properties.push('invalid value for "from_amount", from_amount cannot be nil.')
    +  end
    +
    +  if @from_asset.nil?
    +    invalid_properties.push('invalid value for "from_asset", from_asset cannot be nil.')
    +  end
    +
    +  if @to_amount.nil?
    +    invalid_properties.push('invalid value for "to_amount", to_amount cannot be nil.')
    +  end
    +
    +  if @to_asset.nil?
    +    invalid_properties.push('invalid value for "to_asset", to_asset cannot be nil.')
    +  end
    +
    +  if @transaction.nil?
    +    invalid_properties.push('invalid value for "transaction", transaction cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +316
    +317
    +318
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 316
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +322
    +323
    +324
    +325
    +326
    +327
    +328
    +329
    +330
    +331
    +332
    +333
    +334
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 322
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +310
    +311
    +312
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 310
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +
    +
    # File 'lib/coinbase/client/models/trade.rb', line 200
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @network_id.nil?
    +  return false if @wallet_id.nil?
    +  return false if @address_id.nil?
    +  return false if @trade_id.nil?
    +  return false if @from_amount.nil?
    +  return false if @from_asset.nil?
    +  return false if @to_amount.nil?
    +  return false if @to_asset.nil?
    +  return false if @transaction.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/TradeList.html b/docs/Coinbase/Client/TradeList.html new file mode 100644 index 00000000..cbb4b3e4 --- /dev/null +++ b/docs/Coinbase/Client/TradeList.html @@ -0,0 +1,2095 @@ + + + + + + + Class: Coinbase::Client::TradeList + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::TradeList + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/trade_list.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #data ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Returns the value of attribute data.

      +
      + +
    • + + +
    • + + + #has_more ⇒ Object + + + + + + + + + + + + + + + + +
      +

      True if this list has another page of items after this one that can be fetched.

      +
      + +
    • + + +
    • + + + #next_page ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The page token to be used to fetch the next page.

      +
      + +
    • + + +
    • + + + #total_count ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The total number of trades for the address in the wallet.

      +
      + +
    • + + +
    + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ TradeList + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 63
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::TradeList` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::TradeList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'data')
    +    if (value = attributes[:'data']).is_a?(Array)
    +      self.data = value
    +    end
    +  else
    +    self.data = nil
    +  end
    +
    +  if attributes.key?(:'has_more')
    +    self.has_more = attributes[:'has_more']
    +  else
    +    self.has_more = nil
    +  end
    +
    +  if attributes.key?(:'next_page')
    +    self.next_page = attributes[:'next_page']
    +  else
    +    self.next_page = nil
    +  end
    +
    +  if attributes.key?(:'total_count')
    +    self.total_count = attributes[:'total_count']
    +  else
    +    self.total_count = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #dataObject + + + + + +

    +
    + +

    Returns the value of attribute data.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +19
    +20
    +21
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 19
    +
    +def data
    +  @data
    +end
    +
    +
    + + + +
    +

    + + #has_moreObject + + + + + +

    +
    + +

    True if this list has another page of items after this one that can be fetched.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +22
    +23
    +24
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 22
    +
    +def has_more
    +  @has_more
    +end
    +
    +
    + + + +
    +

    + + #next_pageObject + + + + + +

    +
    + +

    The page token to be used to fetch the next page.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +25
    +26
    +27
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 25
    +
    +def next_page
    +  @next_page
    +end
    +
    +
    + + + +
    +

    + + #total_countObject + + + + + +

    +
    + +

    The total number of trades for the address in the wallet.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +28
    +29
    +30
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 28
    +
    +def total_count
    +  @total_count
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +202
    +203
    +204
    +205
    +206
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 188
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +41
    +42
    +43
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 41
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 31
    +
    +def self.attribute_map
    +  {
    +    :'data' => :'data',
    +    :'has_more' => :'has_more',
    +    :'next_page' => :'next_page',
    +    :'total_count' => :'total_count'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 164
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +56
    +57
    +58
    +59
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 56
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 46
    +
    +def self.openapi_types
    +  {
    +    :'data' => :'Array<Trade>',
    +    :'has_more' => :'Boolean',
    +    :'next_page' => :'String',
    +    :'total_count' => :'Integer'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 140
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      data == o.data &&
    +      has_more == o.has_more &&
    +      next_page == o.next_page &&
    +      total_count == o.total_count
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +259
    +260
    +261
    +262
    +263
    +264
    +265
    +266
    +267
    +268
    +269
    +270
    +271
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 259
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +151
    +152
    +153
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 151
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +157
    +158
    +159
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 157
    +
    +def hash
    +  [data, has_more, next_page, total_count].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +121
    +122
    +123
    +124
    +125
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 105
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @data.nil?
    +    invalid_properties.push('invalid value for "data", data cannot be nil.')
    +  end
    +
    +  if @has_more.nil?
    +    invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
    +  end
    +
    +  if @next_page.nil?
    +    invalid_properties.push('invalid value for "next_page", next_page cannot be nil.')
    +  end
    +
    +  if @total_count.nil?
    +    invalid_properties.push('invalid value for "total_count", total_count cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +235
    +236
    +237
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 235
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +253
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 241
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +229
    +230
    +231
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 229
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +
    +
    # File 'lib/coinbase/client/models/trade_list.rb', line 129
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @data.nil?
    +  return false if @has_more.nil?
    +  return false if @next_page.nil?
    +  return false if @total_count.nil?
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/TradesApi.html b/docs/Coinbase/Client/TradesApi.html new file mode 100644 index 00000000..d17cc1bc --- /dev/null +++ b/docs/Coinbase/Client/TradesApi.html @@ -0,0 +1,2005 @@ + + + + + + + Class: Coinbase::Client::TradesApi + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::TradesApi + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/api/trades_api.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #api_client ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Returns the value of attribute api_client.

      +
      + +
    • + + +
    + + + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(api_client = ApiClient.default) ⇒ TradesApi + + + + + +

    +
    + +

    Returns a new instance of TradesApi.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +19
    +20
    +21
    +
    +
    # File 'lib/coinbase/client/api/trades_api.rb', line 19
    +
    +def initialize(api_client = ApiClient.default)
    +  @api_client = api_client
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #api_clientObject + + + + + +

    +
    + +

    Returns the value of attribute api_client.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +17
    +18
    +19
    +
    +
    # File 'lib/coinbase/client/api/trades_api.rb', line 17
    +
    +def api_client
    +  @api_client
    +end
    +
    +
    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + #broadcast_trade(wallet_id, address_id, trade_id, broadcast_trade_request, opts = {}) ⇒ Trade + + + + + +

    +
    + +

    Broadcast a trade Broadcast a trade

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + wallet_id + + + (String) + + + + — +
      +

      The ID of the wallet the address belongs to

      +
      + +
    • + +
    • + + address_id + + + (String) + + + + — +
      +

      The ID of the address the trade belongs to

      +
      + +
    • + +
    • + + trade_id + + + (String) + + + + — +
      +

      The ID of the trade to broadcast

      +
      + +
    • + +
    • + + broadcast_trade_request + + + (BroadcastTradeRequest) + + + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Trade) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +30
    +31
    +32
    +33
    +
    +
    # File 'lib/coinbase/client/api/trades_api.rb', line 30
    +
    +def broadcast_trade(wallet_id, address_id, trade_id, broadcast_trade_request, opts = {})
    +  data, _status_code, _headers = broadcast_trade_with_http_info(wallet_id, address_id, trade_id, broadcast_trade_request, opts)
    +  data
    +end
    +
    +
    + +
    +

    + + #broadcast_trade_with_http_info(wallet_id, address_id, trade_id, broadcast_trade_request, opts = {}) ⇒ Array<(Trade, Integer, Hash)> + + + + + +

    +
    + +

    Broadcast a trade Broadcast a trade

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + wallet_id + + + (String) + + + + — +
      +

      The ID of the wallet the address belongs to

      +
      + +
    • + +
    • + + address_id + + + (String) + + + + — +
      +

      The ID of the address the trade belongs to

      +
      + +
    • + +
    • + + trade_id + + + (String) + + + + — +
      +

      The ID of the trade to broadcast

      +
      + +
    • + +
    • + + broadcast_trade_request + + + (BroadcastTradeRequest) + + + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Array<(Trade, Integer, Hash)>) + + + + — +
      +

      Trade data, response status code and response headers

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +
    +
    # File 'lib/coinbase/client/api/trades_api.rb', line 43
    +
    +def broadcast_trade_with_http_info(wallet_id, address_id, trade_id, broadcast_trade_request, opts = {})
    +  if @api_client.config.debugging
    +    @api_client.config.logger.debug 'Calling API: TradesApi.broadcast_trade ...'
    +  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 TradesApi.broadcast_trade"
    +  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 TradesApi.broadcast_trade"
    +  end
    +  # verify the required parameter 'trade_id' is set
    +  if @api_client.config.client_side_validation && trade_id.nil?
    +    fail ArgumentError, "Missing the required parameter 'trade_id' when calling TradesApi.broadcast_trade"
    +  end
    +  # verify the required parameter 'broadcast_trade_request' is set
    +  if @api_client.config.client_side_validation && broadcast_trade_request.nil?
    +    fail ArgumentError, "Missing the required parameter 'broadcast_trade_request' when calling TradesApi.broadcast_trade"
    +  end
    +  # resource path
    +  local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/trades/{trade_id}/broadcast'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'trade_id' + '}', CGI.escape(trade_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'])
    +  # 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(broadcast_trade_request)
    +
    +  # return_type
    +  return_type = opts[:debug_return_type] || 'Trade'
    +
    +  # auth_names
    +  auth_names = opts[:debug_auth_names] || []
    +
    +  new_options = opts.merge(
    +    :operation => :"TradesApi.broadcast_trade",
    +    :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: TradesApi#broadcast_trade\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    +  end
    +  return data, status_code, headers
    +end
    +
    +
    + +
    +

    + + #create_trade(wallet_id, address_id, create_trade_request, opts = {}) ⇒ Trade + + + + + +

    +
    + +

    Create a new trade for an address Create a new trade

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + wallet_id + + + (String) + + + + — +
      +

      The ID of the wallet the source address belongs to

      +
      + +
    • + +
    • + + address_id + + + (String) + + + + — +
      +

      The ID of the address to conduct the trade from

      +
      + +
    • + +
    • + + create_trade_request + + + (CreateTradeRequest) + + + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Trade) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +115
    +116
    +117
    +118
    +
    +
    # File 'lib/coinbase/client/api/trades_api.rb', line 115
    +
    +def create_trade(wallet_id, address_id, create_trade_request, opts = {})
    +  data, _status_code, _headers = create_trade_with_http_info(wallet_id, address_id, create_trade_request, opts)
    +  data
    +end
    +
    +
    + +
    +

    + + #create_trade_with_http_info(wallet_id, address_id, create_trade_request, opts = {}) ⇒ Array<(Trade, Integer, Hash)> + + + + + +

    +
    + +

    Create a new trade for an address Create a new trade

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + wallet_id + + + (String) + + + + — +
      +

      The ID of the wallet the source address belongs to

      +
      + +
    • + +
    • + + address_id + + + (String) + + + + — +
      +

      The ID of the address to conduct the trade from

      +
      + +
    • + +
    • + + create_trade_request + + + (CreateTradeRequest) + + + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Array<(Trade, Integer, Hash)>) + + + + — +
      +

      Trade data, response status code and response headers

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +173
    +174
    +175
    +176
    +177
    +178
    +179
    +180
    +181
    +182
    +183
    +184
    +185
    +186
    +
    +
    # File 'lib/coinbase/client/api/trades_api.rb', line 127
    +
    +def create_trade_with_http_info(wallet_id, address_id, create_trade_request, opts = {})
    +  if @api_client.config.debugging
    +    @api_client.config.logger.debug 'Calling API: TradesApi.create_trade ...'
    +  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 TradesApi.create_trade"
    +  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 TradesApi.create_trade"
    +  end
    +  # verify the required parameter 'create_trade_request' is set
    +  if @api_client.config.client_side_validation && create_trade_request.nil?
    +    fail ArgumentError, "Missing the required parameter 'create_trade_request' when calling TradesApi.create_trade"
    +  end
    +  # resource path
    +  local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/trades'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_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'])
    +  # 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(create_trade_request)
    +
    +  # return_type
    +  return_type = opts[:debug_return_type] || 'Trade'
    +
    +  # auth_names
    +  auth_names = opts[:debug_auth_names] || []
    +
    +  new_options = opts.merge(
    +    :operation => :"TradesApi.create_trade",
    +    :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: TradesApi#create_trade\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    +  end
    +  return data, status_code, headers
    +end
    +
    +
    + +
    +

    + + #get_trade(wallet_id, address_id, trade_id, opts = {}) ⇒ Trade + + + + + +

    +
    + +

    Get a trade by ID Get a trade by ID

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + wallet_id + + + (String) + + + + — +
      +

      The ID of the wallet the address belongs to

      +
      + +
    • + +
    • + + address_id + + + (String) + + + + — +
      +

      The ID of the address the trade belongs to

      +
      + +
    • + +
    • + + trade_id + + + (String) + + + + — +
      +

      The ID of the trade to fetch

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Trade) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +195
    +196
    +197
    +198
    +
    +
    # File 'lib/coinbase/client/api/trades_api.rb', line 195
    +
    +def get_trade(wallet_id, address_id, trade_id, opts = {})
    +  data, _status_code, _headers = get_trade_with_http_info(wallet_id, address_id, trade_id, opts)
    +  data
    +end
    +
    +
    + +
    +

    + + #get_trade_with_http_info(wallet_id, address_id, trade_id, opts = {}) ⇒ Array<(Trade, Integer, Hash)> + + + + + +

    +
    + +

    Get a trade by ID Get a trade by ID

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + wallet_id + + + (String) + + + + — +
      +

      The ID of the wallet the address belongs to

      +
      + +
    • + +
    • + + address_id + + + (String) + + + + — +
      +

      The ID of the address the trade belongs to

      +
      + +
    • + +
    • + + trade_id + + + (String) + + + + — +
      +

      The ID of the trade to fetch

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Array<(Trade, Integer, Hash)>) + + + + — +
      +

      Trade data, response status code and response headers

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +236
    +237
    +238
    +239
    +240
    +241
    +242
    +243
    +244
    +245
    +246
    +247
    +248
    +249
    +250
    +251
    +252
    +253
    +254
    +255
    +256
    +257
    +258
    +259
    +260
    +261
    +
    +
    # File 'lib/coinbase/client/api/trades_api.rb', line 207
    +
    +def get_trade_with_http_info(wallet_id, address_id, trade_id, opts = {})
    +  if @api_client.config.debugging
    +    @api_client.config.logger.debug 'Calling API: TradesApi.get_trade ...'
    +  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 TradesApi.get_trade"
    +  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 TradesApi.get_trade"
    +  end
    +  # verify the required parameter 'trade_id' is set
    +  if @api_client.config.client_side_validation && trade_id.nil?
    +    fail ArgumentError, "Missing the required parameter 'trade_id' when calling TradesApi.get_trade"
    +  end
    +  # resource path
    +  local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/trades/{trade_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'trade_id' + '}', CGI.escape(trade_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'])
    +
    +  # form parameters
    +  form_params = opts[:form_params] || {}
    +
    +  # http body (model)
    +  post_body = opts[:debug_body]
    +
    +  # return_type
    +  return_type = opts[:debug_return_type] || 'Trade'
    +
    +  # auth_names
    +  auth_names = opts[:debug_auth_names] || []
    +
    +  new_options = opts.merge(
    +    :operation => :"TradesApi.get_trade",
    +    :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: TradesApi#get_trade\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    +  end
    +  return data, status_code, headers
    +end
    +
    +
    + +
    +

    + + #list_trades(wallet_id, address_id, opts = {}) ⇒ TradeList + + + + + +

    +
    + +

    List trades for an address. List trades for an address.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + wallet_id + + + (String) + + + + — +
      +

      The ID of the wallet the address belongs to

      +
      + +
    • + +
    • + + address_id + + + (String) + + + + — +
      +

      The ID of the address to list trades for

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + + + + + + + + +

    Options Hash (opts):

    +
      + +
    • + :limit + (Integer) + + + + + —
      +

      A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

      +
      + +
    • + +
    • + :page + (String) + + + + + —
      +

      A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.

      +
      + +
    • + +
    + + +

    Returns:

    + + +
    + + + + +
    +
    +
    +
    +271
    +272
    +273
    +274
    +
    +
    # File 'lib/coinbase/client/api/trades_api.rb', line 271
    +
    +def list_trades(wallet_id, address_id, opts = {})
    +  data, _status_code, _headers = list_trades_with_http_info(wallet_id, address_id, opts)
    +  data
    +end
    +
    +
    + +
    +

    + + #list_trades_with_http_info(wallet_id, address_id, opts = {}) ⇒ Array<(TradeList, Integer, Hash)> + + + + + +

    +
    + +

    List trades for an address. List trades for an address.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + wallet_id + + + (String) + + + + — +
      +

      The ID of the wallet the address belongs to

      +
      + +
    • + +
    • + + address_id + + + (String) + + + + — +
      +

      The ID of the address to list trades for

      +
      + +
    • + +
    • + + opts + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      the optional parameters

      +
      + +
    • + +
    + + + + + + + + +

    Options Hash (opts):

    +
      + +
    • + :limit + (Integer) + + + + + —
      +

      A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

      +
      + +
    • + +
    • + :page + (String) + + + + + —
      +

      A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.

      +
      + +
    • + +
    + + +

    Returns:

    +
      + +
    • + + + (Array<(TradeList, Integer, Hash)>) + + + + — +
      +

      TradeList data, response status code and response headers

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +284
    +285
    +286
    +287
    +288
    +289
    +290
    +291
    +292
    +293
    +294
    +295
    +296
    +297
    +298
    +299
    +300
    +301
    +302
    +303
    +304
    +305
    +306
    +307
    +308
    +309
    +310
    +311
    +312
    +313
    +314
    +315
    +316
    +317
    +318
    +319
    +320
    +321
    +322
    +323
    +324
    +325
    +326
    +327
    +328
    +329
    +330
    +331
    +332
    +333
    +334
    +335
    +336
    +337
    +338
    +339
    +340
    +
    +
    # File 'lib/coinbase/client/api/trades_api.rb', line 284
    +
    +def list_trades_with_http_info(wallet_id, address_id, opts = {})
    +  if @api_client.config.debugging
    +    @api_client.config.logger.debug 'Calling API: TradesApi.list_trades ...'
    +  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 TradesApi.list_trades"
    +  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 TradesApi.list_trades"
    +  end
    +  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
    +    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TradesApi.list_trades, the character length must be smaller than or equal to 5000.'
    +  end
    +
    +  # resource path
    +  local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/trades'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
    +
    +  # query parameters
    +  query_params = opts[:query_params] || {}
    +  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
    +  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
    +
    +  # header parameters
    +  header_params = opts[:header_params] || {}
    +  # HTTP header 'Accept' (if needed)
    +  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
    +
    +  # form parameters
    +  form_params = opts[:form_params] || {}
    +
    +  # http body (model)
    +  post_body = opts[:debug_body]
    +
    +  # return_type
    +  return_type = opts[:debug_return_type] || 'TradeList'
    +
    +  # auth_names
    +  auth_names = opts[:debug_auth_names] || []
    +
    +  new_options = opts.merge(
    +    :operation => :"TradesApi.list_trades",
    +    :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: TradesApi#list_trades\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    +  end
    +  return data, status_code, headers
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/Transaction.html b/docs/Coinbase/Client/Transaction.html new file mode 100644 index 00000000..8609d67a --- /dev/null +++ b/docs/Coinbase/Client/Transaction.html @@ -0,0 +1,2088 @@ + + + + + + + Class: Coinbase::Client::Transaction + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::Transaction + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/transaction.rb
    +
    + +
    + +

    Overview

    +
    + +

    An onchain transaction.

    + + +
    +
    +
    + + +

    Defined Under Namespace

    +

    + + + + + Classes: EnumAttributeValidator + + +

    + + + + +

    Instance Attribute Summary collapse

    + + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(attributes = {}) ⇒ Transaction + + + + + +

    +
    + +

    Initializes the object

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + (defaults to: {}) + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +86
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 86
    +
    +def initialize(attributes = {})
    +  if (!attributes.is_a?(Hash))
    +    fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::Transaction` initialize method"
    +  end
    +
    +  # check to see if the attribute exists and convert string to symbol for hash key
    +  attributes = attributes.each_with_object({}) { |(k, v), h|
    +    if (!self.class.attribute_map.key?(k.to_sym))
    +      fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::Transaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    +    end
    +    h[k.to_sym] = v
    +  }
    +
    +  if attributes.key?(:'unsigned_payload')
    +    self.unsigned_payload = attributes[:'unsigned_payload']
    +  else
    +    self.unsigned_payload = nil
    +  end
    +
    +  if attributes.key?(:'signed_payload')
    +    self.signed_payload = attributes[:'signed_payload']
    +  end
    +
    +  if attributes.key?(:'transaction_hash')
    +    self.transaction_hash = attributes[:'transaction_hash']
    +  end
    +
    +  if attributes.key?(:'status')
    +    self.status = attributes[:'status']
    +  else
    +    self.status = nil
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #signed_payloadObject + + + + + +

    +
    + +

    The signed payload of the transaction. This is the payload that has been signed by the sender.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 23
    +
    +def signed_payload
    +  @signed_payload
    +end
    +
    +
    + + + +
    +

    + + #statusObject + + + + + +

    +
    + +

    The status of the transaction

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +29
    +30
    +31
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 29
    +
    +def status
    +  @status
    +end
    +
    +
    + + + +
    +

    + + #transaction_hashObject + + + + + +

    +
    + +

    The hash of the transaction

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +26
    +27
    +28
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 26
    +
    +def transaction_hash
    +  @transaction_hash
    +end
    +
    +
    + + + +
    +

    + + #unsigned_payloadObject + + + + + +

    +
    + +

    The unsigned payload of the transaction. This is the payload that needs to be signed by the sender.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 20
    +
    +def unsigned_payload
    +  @unsigned_payload
    +end
    +
    +
    + +
    + + +
    +

    Class Method Details

    + + +
    +

    + + ._deserialize(type, value) ⇒ Object + + + + + +

    +
    + +

    Deserializes the data based on type

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + string + + + + + + + — +
      +

      type Data type

      +
      + +
    • + +
    • + + string + + + + + + + — +
      +

      value Value to be deserialized

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Deserialized data

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +207
    +208
    +209
    +210
    +211
    +212
    +213
    +214
    +215
    +216
    +217
    +218
    +219
    +220
    +221
    +222
    +223
    +224
    +225
    +226
    +227
    +228
    +229
    +230
    +231
    +232
    +233
    +234
    +235
    +236
    +237
    +238
    +239
    +240
    +241
    +242
    +243
    +244
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 207
    +
    +def self._deserialize(type, value)
    +  case type.to_sym
    +  when :Time
    +    Time.parse(value)
    +  when :Date
    +    Date.parse(value)
    +  when :String
    +    value.to_s
    +  when :Integer
    +    value.to_i
    +  when :Float
    +    value.to_f
    +  when :Boolean
    +    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
    +      true
    +    else
    +      false
    +    end
    +  when :Object
    +    # generic object (usually a Hash), return directly
    +    value
    +  when /\AArray<(?<inner_type>.+)>\z/
    +    inner_type = Regexp.last_match[:inner_type]
    +    value.map { |v| _deserialize(inner_type, v) }
    +  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    +    k_type = Regexp.last_match[:k_type]
    +    v_type = Regexp.last_match[:v_type]
    +    {}.tap do |hash|
    +      value.each do |k, v|
    +        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
    +      end
    +    end
    +  else # model
    +    # models (e.g. Pet) or oneOf
    +    klass = Coinbase::Client.const_get(type)
    +    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    +  end
    +end
    +
    +
    + +
    +

    + + .acceptable_attributesObject + + + + + +

    +
    + +

    Returns all the JSON keys this model knows about

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +64
    +65
    +66
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 64
    +
    +def self.acceptable_attributes
    +  attribute_map.values
    +end
    +
    +
    + +
    +

    + + .attribute_mapObject + + + + + +

    +
    + +

    Attribute mapping from ruby-style variable name to JSON key.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 54
    +
    +def self.attribute_map
    +  {
    +    :'unsigned_payload' => :'unsigned_payload',
    +    :'signed_payload' => :'signed_payload',
    +    :'transaction_hash' => :'transaction_hash',
    +    :'status' => :'status'
    +  }
    +end
    +
    +
    + +
    +

    + + .build_from_hash(attributes) ⇒ Object + + + + + +

    +
    + +

    Builds the object from hash

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attributes + + + (Hash) + + + + — +
      +

      Model attributes in the form of hash

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Object) + + + + — +
      +

      Returns the model itself

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +183
    +184
    +185
    +186
    +187
    +188
    +189
    +190
    +191
    +192
    +193
    +194
    +195
    +196
    +197
    +198
    +199
    +200
    +201
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 183
    +
    +def self.build_from_hash(attributes)
    +  return nil unless attributes.is_a?(Hash)
    +  attributes = attributes.transform_keys(&:to_sym)
    +  transformed_hash = {}
    +  openapi_types.each_pair do |key, type|
    +    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = nil
    +    elsif type =~ /\AArray<(.*)>/i
    +      # check to ensure the input is an array given that the attribute
    +      # is documented as an array but the input is not
    +      if attributes[attribute_map[key]].is_a?(Array)
    +        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
    +      end
    +    elsif !attributes[attribute_map[key]].nil?
    +      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    +    end
    +  end
    +  new(transformed_hash)
    +end
    +
    +
    + +
    +

    + + .openapi_nullableObject + + + + + +

    +
    + +

    List of attributes with nullable: true

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +79
    +80
    +81
    +82
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 79
    +
    +def self.openapi_nullable
    +  Set.new([
    +  ])
    +end
    +
    +
    + +
    +

    + + .openapi_typesObject + + + + + +

    +
    + +

    Attribute type mapping.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 69
    +
    +def self.openapi_types
    +  {
    +    :'unsigned_payload' => :'String',
    +    :'signed_payload' => :'String',
    +    :'transaction_hash' => :'String',
    +    :'status' => :'String'
    +  }
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #==(o) ⇒ Object + + + + + +

    +
    + +

    Checks equality by comparing each attribute.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 159
    +
    +def ==(o)
    +  return true if self.equal?(o)
    +  self.class == o.class &&
    +      unsigned_payload == o.unsigned_payload &&
    +      signed_payload == o.signed_payload &&
    +      transaction_hash == o.transaction_hash &&
    +      status == o.status
    +end
    +
    +
    + +
    +

    + + #_to_hash(value) ⇒ Hash + + + + + +

    +
    + +

    Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + value + + + (Object) + + + + — +
      +

      Any valid value

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the value in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +278
    +279
    +280
    +281
    +282
    +283
    +284
    +285
    +286
    +287
    +288
    +289
    +290
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 278
    +
    +def _to_hash(value)
    +  if value.is_a?(Array)
    +    value.compact.map { |v| _to_hash(v) }
    +  elsif value.is_a?(Hash)
    +    {}.tap do |hash|
    +      value.each { |k, v| hash[k] = _to_hash(v) }
    +    end
    +  elsif value.respond_to? :to_hash
    +    value.to_hash
    +  else
    +    value
    +  end
    +end
    +
    +
    + +
    +

    + + #eql?(o) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + Object + + + (Object) + + + + — +
      +

      to be compared

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +

    See Also:

    +
      + +
    • `==` method
    • + +
    + +
    + + + + +
    +
    +
    +
    +170
    +171
    +172
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 170
    +
    +def eql?(o)
    +  self == o
    +end
    +
    +
    + +
    +

    + + #hashInteger + + + + + +

    +
    + +

    Calculates hash code according to all attributes.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      Hash code

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +176
    +177
    +178
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 176
    +
    +def hash
    +  [unsigned_payload, signed_payload, transaction_hash, status].hash
    +end
    +
    +
    + +
    +

    + + #list_invalid_propertiesObject + + + + + +

    +
    + +

    Show invalid properties with the reasons. Usually used together with valid?

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + + + + + +
      +

      Array for valid properties with the reasons

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +122
    +123
    +124
    +125
    +126
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 122
    +
    +def list_invalid_properties
    +  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
    +  invalid_properties = Array.new
    +  if @unsigned_payload.nil?
    +    invalid_properties.push('invalid value for "unsigned_payload", unsigned_payload cannot be nil.')
    +  end
    +
    +  if @status.nil?
    +    invalid_properties.push('invalid value for "status", status cannot be nil.')
    +  end
    +
    +  invalid_properties
    +end
    +
    +
    + +
    +

    + + #to_bodyHash + + + + + +

    +
    + +

    to_body is an alias to to_hash (backward compatibility)

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +254
    +255
    +256
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 254
    +
    +def to_body
    +  to_hash
    +end
    +
    +
    + +
    +

    + + #to_hashHash + + + + + +

    +
    + +

    Returns the object in the form of hash

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      Returns the object in the form of hash

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +260
    +261
    +262
    +263
    +264
    +265
    +266
    +267
    +268
    +269
    +270
    +271
    +272
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 260
    +
    +def to_hash
    +  hash = {}
    +  self.class.attribute_map.each_pair do |attr, param|
    +    value = self.send(attr)
    +    if value.nil?
    +      is_nullable = self.class.openapi_nullable.include?(attr)
    +      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    +    end
    +
    +    hash[param] = _to_hash(value)
    +  end
    +  hash
    +end
    +
    +
    + +
    +

    + + #to_sString + + + + + +

    +
    + +

    Returns the string representation of the object

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      String presentation of the object

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +248
    +249
    +250
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 248
    +
    +def to_s
    +  to_hash.to_s
    +end
    +
    +
    + +
    +

    + + #valid?Boolean + + + + + +

    +
    + +

    Check to see if the all the properties in the model are valid

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      true if the model is valid

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 138
    +
    +def valid?
    +  warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @unsigned_payload.nil?
    +  return false if @status.nil?
    +  status_validator = EnumAttributeValidator.new('String', ["pending", "broadcast", "complete", "failed"])
    +  return false unless status_validator.valid?(@status)
    +  true
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/Transaction/EnumAttributeValidator.html b/docs/Coinbase/Client/Transaction/EnumAttributeValidator.html new file mode 100644 index 00000000..6b11d272 --- /dev/null +++ b/docs/Coinbase/Client/Transaction/EnumAttributeValidator.html @@ -0,0 +1,453 @@ + + + + + + + Class: Coinbase::Client::Transaction::EnumAttributeValidator + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::Transaction::EnumAttributeValidator + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/transaction.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #allowable_values ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
      +

      Returns the value of attribute allowable_values.

      +
      + +
    • + + +
    • + + + #datatype ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
      +

      Returns the value of attribute datatype.

      +
      + +
    • + + +
    + + + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(datatype, allowable_values) ⇒ EnumAttributeValidator + + + + + +

    +
    + +

    Returns a new instance of EnumAttributeValidator.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 35
    +
    +def initialize(datatype, allowable_values)
    +  @allowable_values = allowable_values.map do |value|
    +    case datatype.to_s
    +    when /Integer/i
    +      value.to_i
    +    when /Float/i
    +      value.to_f
    +    else
    +      value
    +    end
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #allowable_valuesObject (readonly) + + + + + +

    +
    + +

    Returns the value of attribute allowable_values.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +33
    +34
    +35
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 33
    +
    +def allowable_values
    +  @allowable_values
    +end
    +
    +
    + + + +
    +

    + + #datatypeObject (readonly) + + + + + +

    +
    + +

    Returns the value of attribute datatype.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +32
    +33
    +34
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 32
    +
    +def datatype
    +  @datatype
    +end
    +
    +
    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + #valid?(value) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +48
    +49
    +50
    +
    +
    # File 'lib/coinbase/client/models/transaction.rb', line 48
    +
    +def valid?(value)
    +  !value || allowable_values.include?(value)
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/TransactionType.html b/docs/Coinbase/Client/TransactionType.html new file mode 100644 index 00000000..595294f4 --- /dev/null +++ b/docs/Coinbase/Client/TransactionType.html @@ -0,0 +1,427 @@ + + + + + + + Class: Coinbase::Client::TransactionType + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::TransactionType + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/transaction_type.rb
    +
    + +
    + + + +

    + Constant Summary + collapse +

    + +
    + +
    TRANSFER = + +
    +
    "transfer".freeze
    + +
    + + + + + + + + + +

    + Class Method Summary + collapse +

    + + + +

    + Instance Method Summary + collapse +

    + + + + + + +
    +

    Class Method Details

    + + +
    +

    + + .all_varsObject + + + + + +

    + + + + +
    +
    +
    +
    +20
    +21
    +22
    +
    +
    # File 'lib/coinbase/client/models/transaction_type.rb', line 20
    +
    +def self.all_vars
    +  @all_vars ||= [TRANSFER].freeze
    +end
    +
    +
    + +
    +

    + + .build_from_hash(value) ⇒ String + + + + + +

    +
    + +

    Builds the enum from string

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + The + + + (String) + + + + — +
      +

      enum value in the form of the string

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      The enum value

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +27
    +28
    +29
    +
    +
    # File 'lib/coinbase/client/models/transaction_type.rb', line 27
    +
    +def self.build_from_hash(value)
    +  new.build_from_hash(value)
    +end
    +
    +
    + +
    + +
    +

    Instance Method Details

    + + +
    +

    + + #build_from_hash(value) ⇒ String + + + + + +

    +
    + +

    Builds the enum from string

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + The + + + (String) + + + + — +
      +

      enum value in the form of the string

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      The enum value

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +34
    +35
    +36
    +37
    +
    +
    # File 'lib/coinbase/client/models/transaction_type.rb', line 34
    +
    +def build_from_hash(value)
    +  return value if TransactionType.all_vars.include?(value)
    +  raise "Invalid ENUM value #{value} for class #TransactionType"
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Client/Wallet.html b/docs/Coinbase/Client/Wallet.html index 31d22d19..78b39725 100644 --- a/docs/Coinbase/Client/Wallet.html +++ b/docs/Coinbase/Client/Wallet.html @@ -99,6 +99,16 @@ +

    Defined Under Namespace

    +

    + + + + + Classes: EnumAttributeValidator + + +

    @@ -184,6 +194,33 @@

    Instance Attribute Summary collaps

    The ID of the blockchain network.

    + + + +
  • + + + #server_signer_status ⇒ Object + + + + + + + + + + + + + + + + +
    +

    The status of the Server-Signer for the wallet if present.

    +
    +
  • @@ -647,36 +684,42 @@

     
     
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 57
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 84
     
     def initialize(attributes = {})
       if (!attributes.is_a?(Hash))
    @@ -693,6 +736,8 @@ 

    if attributes.key?(:'id') self.id = attributes[:'id'] + else + self.id = nil end if attributes.key?(:'network_id') @@ -704,6 +749,10 @@

    if attributes.key?(:'default_address') self.default_address = attributes[:'default_address'] end + + if attributes.key?(:'server_signer_status') + self.server_signer_status = attributes[:'server_signer_status'] + end end

    @@ -844,6 +893,49 @@

    + + +
    +

    + + #server_signer_statusObject + + + + + +

    +
    + +

    The status of the Server-Signer for the wallet if present.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +27
    +28
    +29
    +
    +
    # File 'lib/coinbase/client/models/wallet.rb', line 27
    +
    +def server_signer_status
    +  @server_signer_status
    +end
    +
    +
    + @@ -931,47 +1023,47 @@

     
     
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    -178
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 154
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 205
     
     def self._deserialize(type, value)
       case type.to_sym
    @@ -1042,12 +1134,12 @@ 

     
     
    -36
    -37
    -38
    +62 +63 +64

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 36
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 62
     
     def self.acceptable_attributes
       attribute_map.values
    @@ -1083,22 +1175,24 @@ 

     
     
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    +52 +53 +54 +55 +56 +57 +58 +59

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 27
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 52
     
     def self.attribute_map
       {
         :'id' => :'id',
         :'network_id' => :'network_id',
    -    :'default_address' => :'default_address'
    +    :'default_address' => :'default_address',
    +    :'server_signer_status' => :'server_signer_status'
       }
     end
    @@ -1170,28 +1264,28 @@

     
     
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 130
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 181
     
     def self.build_from_hash(attributes)
       return nil unless attributes.is_a?(Hash)
    @@ -1243,13 +1337,13 @@ 

     
     
    -50
    -51
    -52
    -53
    +77 +78 +79 +80

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 50
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 77
     
     def self.openapi_nullable
       Set.new([
    @@ -1286,22 +1380,24 @@ 

     
     
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    +67 +68 +69 +70 +71 +72 +73 +74

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 41
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 67
     
     def self.openapi_types
       {
         :'id' => :'String',
         :'network_id' => :'String',
    -    :'default_address' => :'Address'
    +    :'default_address' => :'Address',
    +    :'server_signer_status' => :'String'
       }
     end
    @@ -1361,23 +1457,25 @@

     
     
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    +157 +158 +159 +160 +161 +162 +163 +164

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 107
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 157
     
     def ==(o)
       return true if self.equal?(o)
       self.class == o.class &&
           id == o.id &&
           network_id == o.network_id &&
    -      default_address == o.default_address
    +      default_address == o.default_address &&
    +      server_signer_status == o.server_signer_status
     end
    @@ -1448,22 +1546,22 @@

     
     
    -225
    -226
    -227
    -228
    -229
    -230
    -231
    -232
    -233
    -234
    -235
    -236
    -237
    +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 225
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 276
     
     def _to_hash(value)
       if value.is_a?(Array)
    @@ -1547,12 +1645,12 @@ 

     
     
    -117
    -118
    -119
    +168 +169 +170

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 117
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 168
     
     def eql?(o)
       self == o
    @@ -1606,15 +1704,15 @@ 

     
     
    -123
    -124
    -125
    +174 +175 +176

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 123
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 174
     
     def hash
    -  [id, network_id, default_address].hash
    +  [id, network_id, default_address, server_signer_status].hash
     end
    @@ -1665,22 +1763,30 @@

     
     
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 87
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 120
     
     def list_invalid_properties
       warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
       invalid_properties = Array.new
    +  if @id.nil?
    +    invalid_properties.push('invalid value for "id", id cannot be nil.')
    +  end
    +
       if @network_id.nil?
         invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
       end
    @@ -1736,12 +1842,12 @@ 

     
     
    -201
    -202
    -203
    +252 +253 +254

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 201
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 252
     
     def to_body
       to_hash
    @@ -1795,22 +1901,22 @@ 

     
     
    -207
    -208
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -218
    -219
    +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 207
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 258
     
     def to_hash
       hash = {}
    @@ -1874,12 +1980,12 @@ 

     
     
    -195
    -196
    -197
    +246 +247 +248

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 195
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 246
     
     def to_s
       to_hash.to_s
    @@ -1933,18 +2039,24 @@ 

     
     
    -99
    -100
    -101
    -102
    -103
    +136 +137 +138 +139 +140 +141 +142 +143

    -
    # File 'lib/coinbase/client/models/wallet.rb', line 99
    +      
    # File 'lib/coinbase/client/models/wallet.rb', line 136
     
     def valid?
       warn '[DEPRECATED] the `valid?` method is obsolete'
    +  return false if @id.nil?
       return false if @network_id.nil?
    +  server_signer_status_validator = EnumAttributeValidator.new('String', ["pending_seed_creation", "active_seed"])
    +  return false unless server_signer_status_validator.valid?(@server_signer_status)
       true
     end
    diff --git a/docs/Coinbase/Client/Wallet/EnumAttributeValidator.html b/docs/Coinbase/Client/Wallet/EnumAttributeValidator.html new file mode 100644 index 00000000..3aa0f629 --- /dev/null +++ b/docs/Coinbase/Client/Wallet/EnumAttributeValidator.html @@ -0,0 +1,453 @@ + + + + + + + Class: Coinbase::Client::Wallet::EnumAttributeValidator + + — Documentation by YARD 0.9.36 + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Coinbase::Client::Wallet::EnumAttributeValidator + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/client/models/wallet.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #allowable_values ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
      +

      Returns the value of attribute allowable_values.

      +
      + +
    • + + +
    • + + + #datatype ⇒ Object + + + + + + + + + readonly + + + + + + + + + +
      +

      Returns the value of attribute datatype.

      +
      + +
    • + + +
    + + + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(datatype, allowable_values) ⇒ EnumAttributeValidator + + + + + +

    +
    + +

    Returns a new instance of EnumAttributeValidator.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +
    +
    # File 'lib/coinbase/client/models/wallet.rb', line 33
    +
    +def initialize(datatype, allowable_values)
    +  @allowable_values = allowable_values.map do |value|
    +    case datatype.to_s
    +    when /Integer/i
    +      value.to_i
    +    when /Float/i
    +      value.to_f
    +    else
    +      value
    +    end
    +  end
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #allowable_valuesObject (readonly) + + + + + +

    +
    + +

    Returns the value of attribute allowable_values.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +31
    +32
    +33
    +
    +
    # File 'lib/coinbase/client/models/wallet.rb', line 31
    +
    +def allowable_values
    +  @allowable_values
    +end
    +
    +
    + + + +
    +

    + + #datatypeObject (readonly) + + + + + +

    +
    + +

    Returns the value of attribute datatype.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +30
    +31
    +32
    +
    +
    # File 'lib/coinbase/client/models/wallet.rb', line 30
    +
    +def datatype
    +  @datatype
    +end
    +
    +
    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + #valid?(value) ⇒ Boolean + + + + + +

    +
    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +46
    +47
    +48
    +
    +
    # File 'lib/coinbase/client/models/wallet.rb', line 46
    +
    +def valid?(value)
    +  !value || allowable_values.include?(value)
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/Coinbase/Configuration.html b/docs/Coinbase/Configuration.html index 504a0ace..8af2a619 100644 --- a/docs/Coinbase/Configuration.html +++ b/docs/Coinbase/Configuration.html @@ -201,7 +201,7 @@

    Instance Attribute Summary collaps
  • - #backup_file_path ⇒ Object + #base_sepolia_client ⇒ Object @@ -210,6 +210,8 @@

    Instance Attribute Summary collaps + readonly + @@ -219,7 +221,7 @@

    Instance Attribute Summary collaps
    -

    Returns the value of attribute backup_file_path.

    +

    Returns the value of attribute base_sepolia_client.

  • @@ -228,7 +230,7 @@

    Instance Attribute Summary collaps
  • - #base_sepolia_client ⇒ Object + #base_sepolia_rpc_url ⇒ Object @@ -237,8 +239,6 @@

    Instance Attribute Summary collaps - readonly - @@ -248,7 +248,7 @@

    Instance Attribute Summary collaps
    -

    Returns the value of attribute base_sepolia_client.

    +

    Returns the value of attribute base_sepolia_rpc_url.

  • @@ -257,7 +257,7 @@

    Instance Attribute Summary collaps
  • - #base_sepolia_rpc_url ⇒ Object + #debug_api ⇒ Object @@ -275,7 +275,7 @@

    Instance Attribute Summary collaps
    -

    Returns the value of attribute base_sepolia_rpc_url.

    +

    Returns the value of attribute debug_api.

  • @@ -284,7 +284,7 @@

    Instance Attribute Summary collaps
  • - #debug_api ⇒ Object + #use_server_signer ⇒ Object @@ -302,7 +302,7 @@

    Instance Attribute Summary collaps
    -

    Returns the value of attribute debug_api.

    +

    Returns the value of attribute use_server_signer.

  • @@ -348,7 +348,7 @@

  • - #from_json(file_path = 'coinbase_cloud_api_key.json') ⇒ Object + #from_json(file_path = 'cdp_api_key.json') ⇒ Object @@ -427,23 +427,23 @@

     
     
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    +59 +60 +61 +62 +63 +64 +65

  • -
    # File 'lib/coinbase.rb', line 53
    +      
    # File 'lib/coinbase.rb', line 59
     
     def initialize
       @base_sepolia_rpc_url = 'https://sepolia.base.org'
       @base_sepolia_client = Jimson::Client.new(@base_sepolia_rpc_url)
       @api_url = 'https://api.cdp.coinbase.com'
       @debug_api = false
    -  @backup_file_path = 'seeds.json'
    +  @use_server_signer = false
     end
    @@ -483,12 +483,12 @@

     
     
    -50
    -51
    -52
    +56 +57 +58

    -
    # File 'lib/coinbase.rb', line 50
    +      
    # File 'lib/coinbase.rb', line 56
     
     def api_key_name
       @api_key_name
    @@ -526,12 +526,12 @@ 

     
     
    -50
    -51
    -52
    +56 +57 +58

    -
    # File 'lib/coinbase.rb', line 50
    +      
    # File 'lib/coinbase.rb', line 56
     
     def api_key_private_key
       @api_key_private_key
    @@ -569,12 +569,12 @@ 

     
     
    -50
    -51
    -52
    +56 +57 +58

    -
    # File 'lib/coinbase.rb', line 50
    +      
    # File 'lib/coinbase.rb', line 56
     
     def api_url
       @api_url
    @@ -585,11 +585,11 @@ 

    - +
    -

    +

    - #backup_file_pathObject + #base_sepolia_clientObject (readonly) @@ -598,7 +598,7 @@

    -

    Returns the value of attribute backup_file_path.

    +

    Returns the value of attribute base_sepolia_client.

    @@ -612,15 +612,15 @@

     
     
    -50
    -51
    -52
    +55 +56 +57

    -
    # File 'lib/coinbase.rb', line 50
    +      
    # File 'lib/coinbase.rb', line 55
     
    -def backup_file_path
    -  @backup_file_path
    +def base_sepolia_client
    +  @base_sepolia_client
     end
    @@ -628,11 +628,11 @@

    - +
    -

    +

    - #base_sepolia_clientObject (readonly) + #base_sepolia_rpc_urlObject @@ -641,7 +641,7 @@

    -

    Returns the value of attribute base_sepolia_client.

    +

    Returns the value of attribute base_sepolia_rpc_url.

    @@ -655,15 +655,15 @@

     
     
    -49
    -50
    -51
    +55 +56 +57

    -
    # File 'lib/coinbase.rb', line 49
    +      
    # File 'lib/coinbase.rb', line 55
     
    -def base_sepolia_client
    -  @base_sepolia_client
    +def base_sepolia_rpc_url
    +  @base_sepolia_rpc_url
     end
    @@ -671,11 +671,11 @@

    - +
    -

    +

    - #base_sepolia_rpc_urlObject + #debug_apiObject @@ -684,7 +684,7 @@

    -

    Returns the value of attribute base_sepolia_rpc_url.

    +

    Returns the value of attribute debug_api.

    @@ -698,15 +698,15 @@

     
     
    -49
    -50
    -51
    +56 +57 +58

    -
    # File 'lib/coinbase.rb', line 49
    +      
    # File 'lib/coinbase.rb', line 56
     
    -def base_sepolia_rpc_url
    -  @base_sepolia_rpc_url
    +def debug_api
    +  @debug_api
     end
    @@ -714,11 +714,11 @@

    - +
    -

    +

    - #debug_apiObject + #use_server_signerObject @@ -727,7 +727,7 @@

    -

    Returns the value of attribute debug_api.

    +

    Returns the value of attribute use_server_signer.

    @@ -741,15 +741,15 @@

     
     
    -50
    -51
    -52
    +56 +57 +58

    -
    # File 'lib/coinbase.rb', line 50
    +      
    # File 'lib/coinbase.rb', line 56
     
    -def debug_api
    -  @debug_api
    +def use_server_signer
    +  @use_server_signer
     end
    @@ -807,12 +807,12 @@

     
     
    -85
    -86
    -87
    +91 +92 +93

    -
    # File 'lib/coinbase.rb', line 85
    +      
    # File 'lib/coinbase.rb', line 91
     
     def api_client
       @api_client ||= Coinbase::Client::ApiClient.new(Middleware.config)
    @@ -825,7 +825,7 @@ 

    - #from_json(file_path = 'coinbase_cloud_api_key.json') ⇒ Object + #from_json(file_path = 'cdp_api_key.json') ⇒ Object @@ -851,7 +851,7 @@

    (String) - (defaults to: 'coinbase_cloud_api_key.json') + (defaults to: 'cdp_api_key.json') — @@ -883,22 +883,22 @@

     
     
    -64
    -65
    -66
    -67
    -68
    -69
     70
     71
     72
     73
    -74
    +74 +75 +76 +77 +78 +79 +80

    -
    # File 'lib/coinbase.rb', line 64
    +      
    # File 'lib/coinbase.rb', line 70
     
    -def from_json(file_path = 'coinbase_cloud_api_key.json')
    +def from_json(file_path = 'cdp_api_key.json')
       # Expand paths to respect shortcuts like ~.
       file_path = File.expand_path(file_path)
     
    diff --git a/docs/Coinbase/Transfer.html b/docs/Coinbase/Transfer.html
    index 204388d8..e3587206 100644
    --- a/docs/Coinbase/Transfer.html
    +++ b/docs/Coinbase/Transfer.html
    @@ -326,6 +326,30 @@ 

    Returns the Network ID of the Transfer.

    + + + +
  • + + + #reload ⇒ Transfer + + + + + + + + + + + + + +
    +

    Reload reloads the Transfer model with the latest version from the server side.

    +
    +
  • @@ -374,6 +398,28 @@

    Returns the status of the Transfer.

    + + + +
  • + + + #terminal_state? ⇒ Boolean + + + + + + + + + + + + + +
    +
  • @@ -470,6 +516,28 @@

    Returns the link to the transaction on the blockchain explorer.

    + + + +
  • + + + #transfers_api ⇒ Object + + + + + + + + + + + + + +
    +
  • @@ -500,7 +568,7 @@

  • - #wait!(interval_seconds = 0.2, timeout_seconds = 10) ⇒ Transfer + #wait!(interval_seconds = 0.2, timeout_seconds = 20) ⇒ Transfer @@ -968,12 +1036,12 @@

     
     
    -190
    -191
    -192
    +182 +183 +184

  • -
    # File 'lib/coinbase/transfer.rb', line 190
    +      
    # File 'lib/coinbase/transfer.rb', line 182
     
     def inspect
       to_s
    @@ -1040,6 +1108,73 @@ 

    + + +
    +

    + + #reloadTransfer + + + + + +

    +
    + +

    Reload reloads the Transfer model with the latest version from the server side.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Transfer) + + + + — +
      +

      The most recent version of Transfer from the server.

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +
    +
    # File 'lib/coinbase/transfer.rb', line 142
    +
    +def reload
    +  @model = Coinbase.call_api do
    +    transfers_api.get_transfer(wallet_id, from_address_id, id)
    +  end
    +
    +  self
    +end
    +
    @@ -1147,53 +1282,65 @@

    136 137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158

    +138
    # File 'lib/coinbase/transfer.rb', line 136
     
     def status
    -  # Check if the transfer has been signed yet.
    -  return Status::PENDING if transaction_hash.nil?
    -
    -  onchain_transaction = Coinbase.configuration.base_sepolia_client.eth_getTransactionByHash(transaction_hash)
    -
    -  if onchain_transaction.nil?
    -    # If the transaction has not been broadcast, it is still pending.
    -    Status::PENDING
    -  elsif onchain_transaction['blockHash'].nil?
    -    # If the transaction has been broadcast but hasn't been included in a block, it is
    -    # broadcast.
    -    Status::BROADCAST
    -  else
    -    transaction_receipt = Coinbase.configuration.base_sepolia_client.eth_getTransactionReceipt(transaction_hash)
    +  @model.status
    +end
    + + + + + +
    +

    + + #terminal_state?Boolean + - if transaction_receipt['status'].to_i(16) == 1 - Status::COMPLETE - else - Status::FAILED - end - end + + + +

    +
    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + +
    • + +
    + +
    + + + @@ -1244,15 +1391,15 @@

     
     
    -181
    -182
    -183
    -184
    -185
    -186
    +173 +174 +175 +176 +177 +178

    +
    +
    +
    +190
    +191
    +192
    +
    +
    # File 'lib/coinbase/transfer.rb', line 190
    +
    +def terminal_state?
    +  status == Status::COMPLETE.to_s || status == Status::FAILED.to_s
     end
    -
    # File 'lib/coinbase/transfer.rb', line 181
    +      
    # File 'lib/coinbase/transfer.rb', line 173
     
     def to_s
       "Coinbase::Transfer{transfer_id: '#{id}', network_id: '#{network_id}', " \
    @@ -1478,6 +1625,36 @@ 
    +
    + +
    +

    + + #transfers_apiObject + + + + + +

    + + + + +
    +
    +
    +
    +186
    +187
    +188
    +
    +
    # File 'lib/coinbase/transfer.rb', line 186
    +
    +def transfers_api
    +  @transfers_api ||= Coinbase::Client::TransfersApi.new(Coinbase.configuration.api_client)
    +end
    +
    @@ -1542,7 +1719,7 @@

    - #wait!(interval_seconds = 0.2, timeout_seconds = 10) ⇒ Transfer + #wait!(interval_seconds = 0.2, timeout_seconds = 20) ⇒ Transfer @@ -1586,7 +1763,7 @@

    (Integer) - (defaults to: 10) + (defaults to: 20) — @@ -1623,28 +1800,32 @@

     
     
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
     165
     166
     167
     168
    -169
    -170
    -171
    -172
    -173
    -174
    -175
    -176
    -177
    +169

    -
    # File 'lib/coinbase/transfer.rb', line 165
    +      
    # File 'lib/coinbase/transfer.rb', line 155
     
    -def wait!(interval_seconds = 0.2, timeout_seconds = 10)
    +def wait!(interval_seconds = 0.2, timeout_seconds = 20)
       start_time = Time.now
     
       loop do
    -    return self if status == Status::COMPLETE || status == Status::FAILED
    +    reload
    +
    +    return self if terminal_state?
     
         raise Timeout::Error, 'Transfer timed out' if Time.now - start_time > timeout_seconds
     
    diff --git a/docs/Coinbase/User.html b/docs/Coinbase/User.html
    index 50a18be3..73f7f65e 100644
    --- a/docs/Coinbase/User.html
    +++ b/docs/Coinbase/User.html
    @@ -128,7 +128,7 @@ 

  • - #create_wallet ⇒ Coinbase::Wallet + #create_wallet(create_wallet_options = {}) ⇒ Coinbase::Wallet @@ -250,31 +250,7 @@

  • - #load_wallets_from_local ⇒ Map<String>Coinbase::Wallet - - - - - - - - - - - - - -
    -

    Loads all wallets belonging to the User with backup persisted to the local file system.

    -
    - -
  • - - -
  • - - - #save_wallet_locally!(wallet, encrypt: false) ⇒ Coinbase::Wallet + #to_s ⇒ String @@ -289,7 +265,7 @@

    -

    Saves a wallet to local file system.

    +

    Returns a string representation of the User.

  • @@ -298,7 +274,7 @@

  • - #to_s ⇒ String + #wallet(wallet_id) ⇒ Coinbase::Wallet @@ -313,7 +289,7 @@

    -

    Returns a string representation of the User.

    +

    Returns the Wallet with the given ID.

  • @@ -322,7 +298,7 @@

  • - #wallets(page_size: 10, next_page_token: nil) ⇒ Coinbase::Wallet + #wallets(page_size: 10, next_page_token: nil) ⇒ Array<Coinbase::Wallet, String> @@ -420,7 +396,7 @@

    Instance Method Details

    - #create_walletCoinbase::Wallet + #create_wallet(create_wallet_options = {}) ⇒ Coinbase::Wallet @@ -435,7 +411,27 @@

    +

    Parameters:

    +
      + +
    • + + network_id + + + (String) + + + + — +
      +

      (Optional) the ID of the blockchain network. Defaults to 'base-sepolia'.

      +
      + +
    • +
    +

    Returns:

      @@ -461,39 +457,23 @@

       
       
      -24
       25
       26
       27
       28
       29
       30
      -31
      -32
      -33
      -34
      -35
      -36
      -37
      -38
      +31

  • -
    # File 'lib/coinbase/user.rb', line 24
    -
    -def create_wallet
    -  create_wallet_request = {
    -    wallet: {
    -      # TODO: Don't hardcode this.
    -      network_id: 'base-sepolia'
    -    }
    -  }
    -  opts = { create_wallet_request: create_wallet_request }
    +      
    # File 'lib/coinbase/user.rb', line 25
     
    -  model = Coinbase.call_api do
    -    wallets_api.create_wallet(opts)
    -  end
    +def create_wallet(create_wallet_options = {})
    +  # For ruby 2.7 compatibility we cannot pass in keyword args when the create wallet
    +  # options is empty
    +  return Wallet.create if create_wallet_options.empty?
     
    -  Wallet.new(model)
    +  Wallet.create(**create_wallet_options)
     end
    @@ -623,12 +603,12 @@

     
     
    -43
    -44
    -45
    +36 +37 +38

    -
    # File 'lib/coinbase/user.rb', line 43
    +      
    # File 'lib/coinbase/user.rb', line 36
     
     def import_wallet(data)
       Wallet.import(data)
    @@ -682,12 +662,12 @@ 

     
     
    -162
    -163
    -164
    +97 +98 +99

    -
    # File 'lib/coinbase/user.rb', line 162
    +      
    # File 'lib/coinbase/user.rb', line 97
     
     def inspect
       to_s
    @@ -698,9 +678,9 @@ 

    -

    +

    - #load_wallets_from_localMap<String>Coinbase::Wallet + #to_sString @@ -709,7 +689,7 @@

    -

    Loads all wallets belonging to the User with backup persisted to the local file system.

    +

    Returns a string representation of the User.

    @@ -722,28 +702,15 @@

  • - (Map<String>Coinbase::Wallet) + (String)
    -

    the map of wallet_ids to the wallets.

    +

    a string representation of the User

    -
  • - - -

    Raises:

    -
      - -
    • - - - (ArgumentError) - - -
    @@ -754,69 +721,15 @@

     
     
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    +91 +92 +93

    -
    # File 'lib/coinbase/user.rb', line 123
    -
    -def load_wallets_from_local
    -  existing_seeds_in_store = existing_seeds
    -  raise ArgumentError, 'Backup file not found' if existing_seeds_in_store == {}
    -
    -  wallets = {}
    -  existing_seeds_in_store.each do |wallet_id, seed_data|
    -    seed = seed_data['seed']
    -    raise ArgumentError, 'Malformed backup data' if seed.nil? || seed == ''
    -
    -    if seed_data['encrypted']
    -      shared_secret = store_encryption_key
    -      raise ArgumentError, 'Malformed encrypted seed data' if seed_data['iv'] == '' ||
    -                                                              seed_data['auth_tag'] == ''
    -
    -      cipher = OpenSSL::Cipher.new('aes-256-gcm').decrypt
    -      cipher.key = OpenSSL::Digest.digest('SHA256', shared_secret)
    -      iv = [seed_data['iv']].pack('H*')
    -      cipher.iv = iv
    -      auth_tag = [seed_data['auth_tag']].pack('H*')
    -      cipher.auth_tag = auth_tag
    -      cipher.auth_data = ''
    -      hex_decoded_data = [seed_data['seed']].pack('H*')
    -      seed = cipher.update(hex_decoded_data) + cipher.final
    -    end
    +      
    # File 'lib/coinbase/user.rb', line 91
     
    -    data = Coinbase::Wallet::Data.new(wallet_id: wallet_id, seed: seed)
    -    wallets[wallet_id] = import_wallet(data)
    -  end
    -  wallets
    +def to_s
    +  "Coinbase::User{user_id: '#{id}'}"
     end
    @@ -824,9 +737,9 @@

    -

    +

    - #save_wallet_locally!(wallet, encrypt: false) ⇒ Coinbase::Wallet + #wallet(wallet_id) ⇒ Coinbase::Wallet @@ -835,9 +748,7 @@

    -

    Saves a wallet to local file system. Wallet saved this way can be re-instantiated with load_wallets_from_local function, provided the backup_file is available. This is an insecure method of storing wallet seeds and should only be used for development purposes. If you call save_wallet_locally! twice with wallets containing the same wallet_id, the backup will be overwritten during the second attempt. The default backup_file is `seeds.json` in the root folder. It can be configured by changing Coinbase.configuration.backup_file_path.

    - -

    encrypted or not. Data is unencrypted by default.

    +

    Returns the Wallet with the given ID.

    @@ -848,34 +759,16 @@

  • - wallet + wallet_id - (Coinbase::Wallet) - - - - — -
    -

    The wallet model to save.

    -
    - -
  • - -
  • - - encrypt - - - (bool) - + (String) - (defaults to: false)
    -

    (Optional) Boolean representing whether the backup persisted to local file system should be

    +

    the ID of the Wallet

  • @@ -894,7 +787,7 @@

    -

    the saved wallet.

    +

    the unhydrated Wallet

    @@ -907,130 +800,31 @@

     
     
    -89
    -90
    -91
    -92
    -93
    -94
    -95
    -96
    -97
    -98
    -99
    -100
    -101
    -102
    -103
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87

    -
    # File 'lib/coinbase/user.rb', line 89
    -
    -def save_wallet_locally!(wallet, encrypt: false)
    -  existing_seeds_in_store = existing_seeds
    -  data = wallet.export
    -  seed_to_store = data.seed
    -  auth_tag = ''
    -  iv = ''
    -  if encrypt
    -    shared_secret = store_encryption_key
    -    cipher = OpenSSL::Cipher.new('aes-256-gcm').encrypt
    -    cipher.key = OpenSSL::Digest.digest('SHA256', shared_secret)
    -    iv = cipher.random_iv
    -    cipher.iv = iv
    -    cipher.auth_data = ''
    -    encrypted_data = cipher.update(data.seed) + cipher.final
    -    auth_tag = cipher.auth_tag.unpack1('H*')
    -    iv = iv.unpack1('H*')
    -    seed_to_store = encrypted_data.unpack1('H*')
    -  end
    +      
    # File 'lib/coinbase/user.rb', line 77
     
    -  existing_seeds_in_store[data.wallet_id] = {
    -    seed: seed_to_store,
    -    encrypted: encrypt,
    -    auth_tag: auth_tag,
    -    iv: iv
    -  }
    -
    -  File.open(Coinbase.configuration.backup_file_path, 'w') do |file|
    -    file.write(JSON.pretty_generate(existing_seeds_in_store))
    +def wallet(wallet_id)
    +  wallet_model = Coinbase.call_api do
    +    wallets_api.get_wallet(wallet_id)
       end
    -  wallet
    -end
    - - - - - -
    -

    - - #to_sString - - - - -

    -
    - -

    Returns a string representation of the User.

    - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (String) - - - - — -
      -

      a string representation of the User

      -
      - -
    • - -
    - -
    - - - @@ -1040,7 +834,7 @@

    - #wallets(page_size: 10, next_page_token: nil) ⇒ Coinbase::Wallet + #wallets(page_size: 10, next_page_token: nil) ⇒ Array<Coinbase::Wallet, String> @@ -1102,13 +896,13 @@

  • - (Coinbase::Wallet) + (Array<Coinbase::Wallet, String>)
    -

    the Wallets belonging to the User

    +

    the Wallets belonging to the User and the pagination token, if any.

  • @@ -1121,6 +915,12 @@

     
     
    +45
    +46
    +47
    +48
    +49
    +50
     51
     52
     53
    @@ -1142,14 +942,10 @@ 

    69 70 71 -72 -73 -74 -75 -76

    +72

    diff --git a/docs/Coinbase/Wallet.html b/docs/Coinbase/Wallet.html index 47b56745..5d40e2ae 100644 --- a/docs/Coinbase/Wallet.html +++ b/docs/Coinbase/Wallet.html @@ -114,6 +114,8 @@

    Overview

    + Modules: ServerSignerStatus + Classes: Data @@ -228,6 +230,30 @@

  • + .create(network_id: 'base-sepolia', interval_seconds: 0.2, timeout_seconds: 20) ⇒ Coinbase::Wallet + + + + + + + + + + + + + +
    +

    Creates a new Wallet on the specified Network and generate a default address for it.

    +
    + +
  • + + +
  • + + .import(data) ⇒ Coinbase::Wallet @@ -521,6 +547,30 @@

    Same as to_s.

  • + + + +
  • + + + #load_seed(file_path) ⇒ String + + + + + + + + + + + + + +
    +

    Loads the seed of the Wallet from the given file.

    +
    +
  • @@ -545,6 +595,30 @@

    Returns the Network ID of the Wallet.

    + + + +
  • + + + #save_seed!(file_path, encrypt: false) ⇒ String + + + + + + + + + + + + + +
    +

    Saves the seed of the Wallet to the given file.

    +
    +
  • @@ -569,6 +643,30 @@

    Sets the seed of the Wallet.

    + + + +
  • + + + #server_signer_status ⇒ Symbol + + + + + + + + + + + + + +
    +

    Returns the ServerSigner Status of the Wallet.

    +
    +
  • @@ -614,7 +712,7 @@

    -

    Transfers the given amount of the given Asset to the given address.

    +

    Transfers the given amount of the given Asset to the specified address or wallet.

    @@ -724,69 +822,29 @@

     
     
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    +125 +126 +127 +128 +129 +130 +131 +132 +133 +134

    @@ -892,7 +950,160 @@

    Class Method Details

    -

    +

    + + .create(network_id: 'base-sepolia', interval_seconds: 0.2, timeout_seconds: 20) ⇒ Coinbase::Wallet + + + + + +

    +
    + +

    Creates a new Wallet on the specified Network and generate a default address for it. have an active seed, if using a ServerSigner, in seconds create a seed for the Wallet, in seconds

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + network_id + + + (String) + + + (defaults to: 'base-sepolia') + + + — +
      +

      (Optional) the ID of the blockchain network. Defaults to 'base-sepolia'.

      +
      + +
    • + +
    • + + interval_seconds + + + (Integer) + + + (defaults to: 0.2) + + + — +
      +

      The interval at which to poll the CDPService for the Wallet to

      +
      + +
    • + +
    • + + timeout_seconds + + + (Integer) + + + (defaults to: 20) + + + — +
      +

      The maximum amount of time to wait for the ServerSigner to

      +
      + +
    • + +
    + +

    Returns:

    + + +
    -
    -
    -
    -156
    -157
    -158
    -
    -
    # File 'lib/coinbase/user.rb', line 156
    +  addresses_list = Coinbase.call_api do
    +    addresses_api.list_addresses(wallet_model.id, { limit: Coinbase::Wallet::MAX_ADDRESSES })
    +  end
     
    -def to_s
    -  "Coinbase::User{user_id: '#{id}'}"
    +  Wallet.new(wallet_model, seed: '', address_models: addresses_list.data)
     end
    -
    # File 'lib/coinbase/user.rb', line 51
    +      
    # File 'lib/coinbase/user.rb', line 45
     
     def wallets(page_size: 10, next_page_token: nil)
       opts = {
    @@ -1173,9 +969,11 @@ 

    address_model_map[wallet_model.id] = addresses_list.data end - wallet_list.data.map do |wallet_model| + wallets = wallet_list.data.map do |wallet_model| Wallet.new(wallet_model, seed: '', address_models: address_model_map[wallet_model.id]) end + + [wallets, wallet_list.next_page] end

    -
    # File 'lib/coinbase/wallet.rb', line 59
    +      
    # File 'lib/coinbase/wallet.rb', line 125
     
     def initialize(model, seed: nil, address_models: [])
       validate_seed_and_address_models(seed, address_models)
     
       @model = model
    -
    -  @master = if seed.nil?
    -              MoneyTree::Master.new
    -            elsif seed.empty?
    -              nil
    -            else
    -              MoneyTree::Master.new(seed_hex: seed)
    -            end
    -
    -  # TODO: Make Network an argument to the constructor.
    -  @network_id = :base_sepolia
    -
    +  @master = master_node(seed)
       @addresses = []
    -
    -  # TODO: Adjust derivation path prefix based on network protocol.
    -  @address_path_prefix = "m/44'/60'/0'/0"
       @private_key_index = 0
     
    -  if address_models.any?
    -    derive_addresses(address_models)
    -  else
    -    create_address
    -    # Update the model to reflect the new default address.
    -    update_model
    -  end
    +  derive_addresses(address_models)
     end
    + + + + +
    +
    +
    +
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +
    +
    # File 'lib/coinbase/wallet.rb', line 56
    +
    +def create(network_id: 'base-sepolia', interval_seconds: 0.2, timeout_seconds: 20)
    +  model = Coinbase.call_api do
    +    wallets_api.create_wallet(
    +      create_wallet_request: {
    +        wallet: {
    +          network_id: network_id,
    +          use_server_signer: Coinbase.use_server_signer?
    +        }
    +      }
    +    )
    +  end
    +
    +  wallet = new(model)
    +
    +  # When used with a ServerSigner, the Signer must first register
    +  # with the Wallet before addresses can be created.
    +  wait_for_signer(wallet.id, interval_seconds, timeout_seconds) if Coinbase.use_server_signer?
    +
    +  wallet.create_address
    +  wallet
    +end
    +
    +
    + +
    +

    .import(data) ⇒ Coinbase::Wallet @@ -968,22 +1179,22 @@

     
     
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
     35
    -36
    +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47

    -
    # File 'lib/coinbase/wallet.rb', line 24
    +      
    # File 'lib/coinbase/wallet.rb', line 35
     
     def import(data)
       raise ArgumentError, 'data must be a Coinbase::Wallet::Data object' unless data.is_a?(Data)
    @@ -1073,12 +1284,12 @@ 

     
     
    -149
    -150
    -151
    +207 +208 +209

    -
    # File 'lib/coinbase/wallet.rb', line 149
    +      
    # File 'lib/coinbase/wallet.rb', line 207
     
     def address(address_id)
       @addresses.find { |address| address.id == address_id }
    @@ -1152,18 +1363,18 @@ 

     
     
    -166
    -167
    -168
    -169
    -170
    -171
    -172
    -173
    -174
    +224 +225 +226 +227 +228 +229 +230 +231 +232

    -
    # File 'lib/coinbase/wallet.rb', line 166
    +      
    # File 'lib/coinbase/wallet.rb', line 224
     
     def balance(asset_id)
       response = Coinbase.call_api do
    @@ -1223,16 +1434,16 @@ 

     
     
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    +213 +214 +215 +216 +217 +218 +219

    -
    # File 'lib/coinbase/wallet.rb', line 155
    +      
    # File 'lib/coinbase/wallet.rb', line 213
     
     def balances
       response = Coinbase.call_api do
    @@ -1290,12 +1501,12 @@ 

     
     
    -218
    -219
    -220
    +266 +267 +268

    -
    # File 'lib/coinbase/wallet.rb', line 218
    +      
    # File 'lib/coinbase/wallet.rb', line 266
     
     def can_sign?
       !@master.nil?
    @@ -1349,42 +1560,54 @@ 

     
     
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196

    -
    # File 'lib/coinbase/wallet.rb', line 122
    +      
    # File 'lib/coinbase/wallet.rb', line 174
     
     def create_address
    -  key = derive_key
    -  attestation = create_attestation(key)
    -  public_key = key.public_key.compressed.unpack1('H*')
    -
    -  opts = {
    -    create_address_request: {
    -      public_key: public_key,
    -      attestation: attestation
    +  opts = { create_address_request: {} }
    +
    +  unless Coinbase.use_server_signer?
    +    key = derive_key
    +
    +    opts = {
    +      create_address_request: {
    +        public_key: key.public_key.compressed.unpack1('H*'),
    +        attestation: create_attestation(key)
    +      }
         }
    -  }
    +  end
    +
       address_model = Coinbase.call_api do
         addresses_api.create_address(id, opts)
       end
     
    +  # Auto-reload wallet to set default address on first address creation.
    +  reload if addresses.empty?
    +
       cache_address(address_model, key)
     end
    @@ -1436,12 +1659,12 @@

     
     
    -142
    -143
    -144
    +200 +201 +202

    -
    # File 'lib/coinbase/wallet.rb', line 142
    +      
    # File 'lib/coinbase/wallet.rb', line 200
     
     def default_address
       address(@model.default_address&.address_id)
    @@ -1495,14 +1718,14 @@ 

     
     
    -199
    -200
    -201
    -202
    -203
    +247 +248 +249 +250 +251

    -
    # File 'lib/coinbase/wallet.rb', line 199
    +      
    # File 'lib/coinbase/wallet.rb', line 247
     
     def export
       raise 'Cannot export Wallet without loaded seed' if @master.nil?
    @@ -1590,14 +1813,14 @@ 

     
     
    -210
    -211
    -212
    -213
    -214
    +258 +259 +260 +261 +262

    -
    # File 'lib/coinbase/wallet.rb', line 210
    +      
    # File 'lib/coinbase/wallet.rb', line 258
     
     def faucet
       Coinbase.call_api do
    @@ -1653,12 +1876,12 @@ 

     
     
    -92
    -93
    -94
    +138 +139 +140

    -
    # File 'lib/coinbase/wallet.rb', line 92
    +      
    # File 'lib/coinbase/wallet.rb', line 138
     
     def id
       @model.id
    @@ -1712,12 +1935,12 @@ 

     
     
    -231
    -232
    -233
    +360 +361 +362

    -
    # File 'lib/coinbase/wallet.rb', line 231
    +      
    # File 'lib/coinbase/wallet.rb', line 360
     
     def inspect
       to_s
    @@ -1725,6 +1948,162 @@ 

    + + +
    +

    + + #load_seed(file_path) ⇒ String + + + + + +

    +
    + +

    Loads the seed of the Wallet from the given file.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + file_path + + + (String) + + + + — +
      +

      The path of the file to load the seed from

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      A string indicating the success of the operation

      +
      + +
    • + +
    +

    Raises:

    +
      + +
    • + + + (ArgumentError) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +315
    +316
    +317
    +318
    +319
    +320
    +321
    +322
    +323
    +324
    +325
    +326
    +327
    +328
    +329
    +330
    +331
    +332
    +333
    +334
    +335
    +336
    +337
    +338
    +339
    +340
    +341
    +342
    +343
    +344
    +345
    +346
    +347
    +348
    +349
    +
    +
    # File 'lib/coinbase/wallet.rb', line 315
    +
    +def load_seed(file_path)
    +  raise 'Wallet already has seed loaded' unless @master.nil?
    +
    +  existing_seeds_in_store = existing_seeds(file_path)
    +
    +  raise ArgumentError, "File #{file_path} does not contain seed data" if existing_seeds_in_store == {}
    +
    +  if existing_seeds_in_store[id].nil?
    +    raise ArgumentError, "File #{file_path} does not contain seed data for wallet #{id}"
    +  end
    +
    +  seed_data = existing_seeds_in_store[id]
    +  local_seed = seed_data['seed']
    +
    +  raise ArgumentError, 'Seed data is malformed' if local_seed.nil? || local_seed == ''
    +
    +  if seed_data['encrypted']
    +    raise ArgumentError, 'Encrypted seed data is malformed' if seed_data['iv'] == '' ||
    +                                                               seed_data['auth_tag'] == ''
    +
    +    cipher = OpenSSL::Cipher.new('aes-256-gcm').decrypt
    +    cipher.key = OpenSSL::Digest.digest('SHA256', encryption_key)
    +    iv = [seed_data['iv']].pack('H*')
    +    cipher.iv = iv
    +    auth_tag = [seed_data['auth_tag']].pack('H*')
    +    cipher.auth_tag = auth_tag
    +    cipher.auth_data = ''
    +    hex_decoded_data = [seed_data['seed']].pack('H*')
    +    local_seed = cipher.update(hex_decoded_data) + cipher.final
    +  end
    +
    +  self.seed = local_seed
    +
    +  "Successfully loaded seed for wallet #{id} from #{file_path}."
    +end
    +
    @@ -1771,12 +2150,12 @@

     
     
    -98
    -99
    -100
    +144 +145 +146

    -
    # File 'lib/coinbase/wallet.rb', line 98
    +      
    # File 'lib/coinbase/wallet.rb', line 144
     
     def network_id
       Coinbase.to_sym(@model.network_id)
    @@ -1784,6 +2163,165 @@ 

    + + +
    +

    + + #save_seed!(file_path, encrypt: false) ⇒ String + + + + + +

    +
    + +

    Saves the seed of the Wallet to the given file. Wallets whose seeds are saved this way can be rehydrated using load_seed. A single file can be used for multiple Wallet seeds. This is an insecure method of storing Wallet seeds and should only be used for development purposes.

    + +

    encrypted or not. Data is unencrypted by default.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + file_path + + + (String) + + + + — +
      +

      The path of the file to save the seed to

      +
      + +
    • + +
    • + + encrypt + + + (bool) + + + (defaults to: false) + + + — +
      +

      (Optional) Whether the seed information persisted to the local file system should be

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + + — +
      +

      A string indicating the success of the operation

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +278
    +279
    +280
    +281
    +282
    +283
    +284
    +285
    +286
    +287
    +288
    +289
    +290
    +291
    +292
    +293
    +294
    +295
    +296
    +297
    +298
    +299
    +300
    +301
    +302
    +303
    +304
    +305
    +306
    +307
    +308
    +309
    +310
    +
    +
    # File 'lib/coinbase/wallet.rb', line 278
    +
    +def save_seed!(file_path, encrypt: false)
    +  raise 'Wallet does not have seed loaded' if @master.nil?
    +
    +  existing_seeds_in_store = existing_seeds(file_path)
    +
    +  seed_to_store = @master.seed_hex
    +  auth_tag = ''
    +  iv = ''
    +  if encrypt
    +    cipher = OpenSSL::Cipher.new('aes-256-gcm').encrypt
    +    cipher.key = OpenSSL::Digest.digest('SHA256', encryption_key)
    +    iv = cipher.random_iv
    +    cipher.iv = iv
    +    cipher.auth_data = ''
    +    encrypted_data = cipher.update(@master.seed_hex) + cipher.final
    +    auth_tag = cipher.auth_tag.unpack1('H*')
    +    iv = iv.unpack1('H*')
    +    seed_to_store = encrypted_data.unpack1('H*')
    +  end
    +
    +  existing_seeds_in_store[id] = {
    +    seed: seed_to_store,
    +    encrypted: encrypt,
    +    auth_tag: auth_tag,
    +    iv: iv
    +  }
    +
    +  File.open(file_path, 'w') do |file|
    +    file.write(JSON.pretty_generate(existing_seeds_in_store))
    +  end
    +
    +  "Successfully saved seed for wallet #{id} to #{file_path}."
    +end
    +
    @@ -1845,24 +2383,24 @@

     
     
    -104
    -105
    -106
    -107
    -108
    -109
    -110
    -111
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170

    -
    # File 'lib/coinbase/wallet.rb', line 104
    +      
    # File 'lib/coinbase/wallet.rb', line 156
     
     def seed=(seed)
       raise ArgumentError, 'Seed must be 32 bytes' if seed.length != 64
    @@ -1882,6 +2420,65 @@ 

    + + +
    +

    + + #server_signer_statusSymbol + + + + + +

    +
    + +

    Returns the ServerSigner Status of the Wallet.

    + + +
    +
    +
    + +

    Returns:

    +
      + +
    • + + + (Symbol) + + + + — +
      +

      The ServerSigner Status

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +150
    +151
    +152
    +
    +
    # File 'lib/coinbase/wallet.rb', line 150
    +
    +def server_signer_status
    +  Coinbase.to_sym(@model.server_signer_status)
    +end
    +
    @@ -1928,13 +2525,13 @@

     
     
    -224
    -225
    -226
    -227
    +353 +354 +355 +356

    -
    # File 'lib/coinbase/wallet.rb', line 224
    +      
    # File 'lib/coinbase/wallet.rb', line 353
     
     def to_s
       "Coinbase::Wallet{wallet_id: '#{id}', network_id: '#{network_id}', " \
    @@ -1957,7 +2554,7 @@ 

    -

    Transfers the given amount of the given Asset to the given address. Only same-Network Transfers are supported. Currently only the default_address is used to source the Transfer.

    +

    Transfers the given amount of the given Asset to the specified address or wallet. Only same-network Transfers are supported. Currently only the default_address is used to source the Transfer.

    @@ -2041,34 +2638,14 @@

     
     
    -183
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    -192
    -193
    -194
    -195
    +241 +242 +243

    -
    # File 'lib/coinbase/wallet.rb', line 183
    +      
    # File 'lib/coinbase/wallet.rb', line 241
     
     def transfer(amount, asset_id, destination)
    -  if destination.is_a?(Wallet)
    -    raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != @network_id
    -
    -    destination = destination.default_address.id
    -  elsif destination.is_a?(Address)
    -    raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != @network_id
    -
    -    destination = destination.id
    -  end
    -
       default_address.transfer(amount, asset_id, destination)
     end
    diff --git a/docs/Coinbase/Wallet/Data.html b/docs/Coinbase/Wallet/Data.html index 6d4d49bd..d8a5dfb9 100644 --- a/docs/Coinbase/Wallet/Data.html +++ b/docs/Coinbase/Wallet/Data.html @@ -339,13 +339,13 @@

     
     
    -242
    -243
    -244
    -245
    +371 +372 +373 +374

    -
    # File 'lib/coinbase/wallet.rb', line 242
    +      
    # File 'lib/coinbase/wallet.rb', line 371
     
     def initialize(wallet_id:, seed:)
       @wallet_id = wallet_id
    @@ -389,12 +389,12 @@ 

     
     
    -237
    -238
    -239
    +366 +367 +368

    -
    # File 'lib/coinbase/wallet.rb', line 237
    +      
    # File 'lib/coinbase/wallet.rb', line 366
     
     def seed
       @seed
    @@ -432,12 +432,12 @@ 

     
     
    -237
    -238
    -239
    +366 +367 +368

    -
    # File 'lib/coinbase/wallet.rb', line 237
    +      
    # File 'lib/coinbase/wallet.rb', line 366
     
     def wallet_id
       @wallet_id
    @@ -518,12 +518,12 @@ 

     
     
    -256
    -257
    -258
    +385 +386 +387

    -
    # File 'lib/coinbase/wallet.rb', line 256
    +      
    # File 'lib/coinbase/wallet.rb', line 385
     
     def self.from_hash(data)
       Data.new(wallet_id: data['wallet_id'], seed: data['seed'])
    @@ -583,12 +583,12 @@ 

     
     
    -249
    -250
    -251
    +378 +379 +380

    -
    # File 'lib/coinbase/wallet.rb', line 249
    +      
    # File 'lib/coinbase/wallet.rb', line 378
     
     def to_hash
       { wallet_id: wallet_id, seed: seed }
    diff --git a/docs/Coinbase/Wallet/ServerSignerStatus.html b/docs/Coinbase/Wallet/ServerSignerStatus.html
    new file mode 100644
    index 00000000..ec52991d
    --- /dev/null
    +++ b/docs/Coinbase/Wallet/ServerSignerStatus.html
    @@ -0,0 +1,157 @@
    +
    +
    +  
    +    
    +
    +
    +  Module: Coinbase::Wallet::ServerSignerStatus
    +  
    +    — Documentation by YARD 0.9.36
    +  
    +
    +
    +  
    +
    +  
    +
    +
    +
    +
    +  
    +
    +  
    +
    +
    +  
    +  
    +    
    +
    +    
    + + +

    Module: Coinbase::Wallet::ServerSignerStatus + + + +

    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/coinbase/wallet.rb
    +
    + +
    + +

    Overview

    +
    + +

    A representation of ServerSigner status in a Wallet.

    + + +
    +
    +
    + + +
    + +

    + Constant Summary + collapse +

    + +
    + +
    PENDING = +
    +
    + +

    The Wallet is awaiting seed creation by the ServerSigner. At this point, the Wallet cannot create addresses or sign transactions.

    + + +
    +
    +
    + + +
    +
    +
    'pending_seed_creation'
    + +
    ACTIVE = +
    +
    + +

    The Wallet has an associated seed created by the ServerSigner. It is ready to create addresses and sign transactions.

    + + +
    +
    +
    + + +
    +
    +
    'active_seed'
    + +
    + + + + + + + + + + +
    + + + +
    + + \ No newline at end of file diff --git a/docs/_index.html b/docs/_index.html index 6610c6d7..b441038b 100644 --- a/docs/_index.html +++ b/docs/_index.html @@ -88,16 +88,16 @@

    Namespace Listing A-Z

  • - Address + Address - (Coinbase) + (Coinbase::Client)
  • - Address + Address - (Coinbase::Client) + (Coinbase)
  • @@ -172,6 +172,13 @@

    Namespace Listing A-Z

  • B
  • @@ -285,6 +313,34 @@

    Namespace Listing A-Z

    +
  • + EnumAttributeValidator + + (Coinbase::Client::Transaction) + +
  • + +
  • + EnumAttributeValidator + + (Coinbase::Client::SignatureCreationEvent) + +
  • + +
  • + EnumAttributeValidator + + (Coinbase::Client::Wallet) + +
  • + +
  • + EnumAttributeValidator + + (Coinbase::Client::SignatureCreationEventResult) + +
  • +
  • Error @@ -308,16 +364,16 @@

    Namespace Listing A-Z

  • - FaucetTransaction + FaucetTransaction - (Coinbase::Client) + (Coinbase)
  • - FaucetTransaction + FaucetTransaction - (Coinbase) + (Coinbase::Client)
  • @@ -504,6 +560,76 @@

    Namespace Listing A-Z

  • S
    • +
    • + SeedCreationEvent + + (Coinbase::Client) + +
    • + +
    • + SeedCreationEventResult + + (Coinbase::Client) + +
    • + +
    • + ServerSigner + + (Coinbase::Client) + +
    • + +
    • + ServerSignerEvent + + (Coinbase::Client) + +
    • + +
    • + ServerSignerEventEvent + + (Coinbase::Client) + +
    • + +
    • + ServerSignerEventList + + (Coinbase::Client) + +
    • + +
    • + ServerSignerStatus + + (Coinbase::Wallet) + +
    • + +
    • + ServerSignersApi + + (Coinbase::Client) + +
    • + +
    • + SignatureCreationEvent + + (Coinbase::Client) + +
    • + +
    • + SignatureCreationEventResult + + (Coinbase::Client) + +
    • +
    • Status @@ -519,6 +645,41 @@

      Namespace Listing A-Z

    • T
      • +
      • + Trade + + (Coinbase::Client) + +
      • + +
      • + TradeList + + (Coinbase::Client) + +
      • + +
      • + TradesApi + + (Coinbase::Client) + +
      • + +
      • + Transaction + + (Coinbase::Client) + +
      • + +
      • + TransactionType + + (Coinbase::Client) + +
      • +
      • Transfer @@ -577,16 +738,16 @@

        Namespace Listing A-Z

      • - User + User - (Coinbase) + (Coinbase::Client)
      • - User + User - (Coinbase::Client) + (Coinbase)
      • @@ -606,16 +767,16 @@

        Namespace Listing A-Z

        • - Wallet + Wallet - (Coinbase) + (Coinbase::Client)
        • - Wallet + Wallet - (Coinbase::Client) + (Coinbase)
        • diff --git a/docs/class_list.html b/docs/class_list.html index 16f8216b..2291d16b 100644 --- a/docs/class_list.html +++ b/docs/class_list.html @@ -43,7 +43,7 @@

          Class List

          diff --git a/docs/file.README.html b/docs/file.README.html index 85eefce6..d98a66e6 100644 --- a/docs/file.README.html +++ b/docs/file.README.html @@ -200,6 +200,11 @@

          Creating a Wallet

          u = Coinbase.default_user
           
          +

          If you are using a CDP Server-Signer to manage your private keys, enable it with

          + +
          Coinbase.configuration.use_server_signer=true
          +
          +

          Now, create a wallet from the User. Wallets are created with a single default address.

          # Create a wallet with one address by default.
          @@ -256,12 +261,15 @@ 

          Persisting a Wallet

          For more information on wallet persistence, see the documentation on wallets.

          -

          Alternatively, you can use the save_wallet_locally! function to persist wallets on your local file system. This is a convenience function purely for testing purposes, and should not be considered a secure method of persisting wallets.

          +

          Alternatively, you can use the save_seed! function to persist a wallet's seed to a local file. This is a convenience function purely for testing purposes, and should not be considered a secure method of persisting wallets.

          -
          # Set encrypt: true to encrypt the wallet export data with your CDP API key.
          -u.save_wallet_locally!(w1, encrypt: true)
          +
          # Pick a file to which to save your wallet seed.
          +file_path = 'my_seed.json'
           
          -puts "Wallet #{w1.id} successfully saved to local file storage."
          +# Set encrypt: true to encrypt the wallet seed with your CDP API key.
          +w1.save_seed!(file_path, encrypt: true)
          +
          +puts "Seed for wallet #{w1.id} successfully saved to #{file_path}."
           

          Re-instantiating a Wallet

          @@ -276,15 +284,14 @@

          Re-instantiating a Wallet

          w3 = u.import_wallet(fetched_data)
          -

          If you used the save_wallet_locally! function to persist wallets on your local file system, then you can use the load_wallets_from_local function re-instantiate the wallets.

          - -
          # wallets will contain a Hash from wallet ID to wallet.
          -wallets = u.load_wallets_from_local
          +

          If you used the save_seed! function to persist a wallet's seed to a local file, then you can first fetch the unhydrated wallet from the server, and then use the load_seed method to re-instantiate the wallet.

          -puts "Wallets successfully loaded from local file storage." +
          # Get the unhydrated wallet from the server.
          +w4 = u.wallet(w1.id)
           
          -# w4 will be equivalent to w1 and w3.
          -w4 = wallets[w1.id]
          +# You can now load the seed into the wallet from the local file.
          +# w4 will be equivalent to w1.
          +w4.load_seed(file_path)
           

          Development

          diff --git a/docs/index.html b/docs/index.html index ce51cfef..dcc12301 100644 --- a/docs/index.html +++ b/docs/index.html @@ -200,6 +200,11 @@

          Creating a Wallet

          u = Coinbase.default_user
           
          +

          If you are using a CDP Server-Signer to manage your private keys, enable it with

          + +
          Coinbase.configuration.use_server_signer=true
          +
          +

          Now, create a wallet from the User. Wallets are created with a single default address.

          # Create a wallet with one address by default.
          @@ -256,12 +261,15 @@ 

          Persisting a Wallet

          For more information on wallet persistence, see the documentation on wallets.

          -

          Alternatively, you can use the save_wallet_locally! function to persist wallets on your local file system. This is a convenience function purely for testing purposes, and should not be considered a secure method of persisting wallets.

          +

          Alternatively, you can use the save_seed! function to persist a wallet's seed to a local file. This is a convenience function purely for testing purposes, and should not be considered a secure method of persisting wallets.

          -
          # Set encrypt: true to encrypt the wallet export data with your CDP API key.
          -u.save_wallet_locally!(w1, encrypt: true)
          +
          # Pick a file to which to save your wallet seed.
          +file_path = 'my_seed.json'
           
          -puts "Wallet #{w1.id} successfully saved to local file storage."
          +# Set encrypt: true to encrypt the wallet seed with your CDP API key.
          +w1.save_seed!(file_path, encrypt: true)
          +
          +puts "Seed for wallet #{w1.id} successfully saved to #{file_path}."
           

          Re-instantiating a Wallet

          @@ -276,15 +284,14 @@

          Re-instantiating a Wallet

          w3 = u.import_wallet(fetched_data)
          -

          If you used the save_wallet_locally! function to persist wallets on your local file system, then you can use the load_wallets_from_local function re-instantiate the wallets.

          - -
          # wallets will contain a Hash from wallet ID to wallet.
          -wallets = u.load_wallets_from_local
          +

          If you used the save_seed! function to persist a wallet's seed to a local file, then you can first fetch the unhydrated wallet from the server, and then use the load_seed method to re-instantiate the wallet.

          -puts "Wallets successfully loaded from local file storage." +
          # Get the unhydrated wallet from the server.
          +w4 = u.wallet(w1.id)
           
          -# w4 will be equivalent to w1 and w3.
          -w4 = wallets[w1.id]
          +# You can now load the seed into the wallet from the local file.
          +# w4 will be equivalent to w1.
          +w4.load_seed(file_path)
           

          Development

          diff --git a/docs/method_list.html b/docs/method_list.html index 55cb2d1d..42f2e8a7 100644 --- a/docs/method_list.html +++ b/docs/method_list.html @@ -46,983 +46,983 @@

          Method List

        • - #== - Coinbase::Client::CreateWalletRequest + #== + Coinbase::Client::Address
        • - #== - Coinbase::Client::BroadcastTransferRequest + #== + Coinbase::Client::Asset
        • - #== - Coinbase::Client::CreateTransferRequest + #== + Coinbase::Client::TransferList
        • - #== - Coinbase::Client::CreateAddressRequest + #== + Coinbase::Client::Balance
        • - #== - Coinbase::Client::User + #== + Coinbase::Client::CreateServerSignerRequest
        • - #== - Coinbase::Client::AddressBalanceList + #== + Coinbase::Client::SeedCreationEventResult
        • - #== - Coinbase::Client::FaucetTransaction + #== + Coinbase::Client::BroadcastTradeRequest
        • - #== - Coinbase::Client::TransferList + #== + Coinbase::Client::CreateWalletRequest
        • - #== - Coinbase::Client::AddressList + #== + Coinbase::Client::Error
        • - #== - Coinbase::Client::WalletList + #== + Coinbase::Client::TradeList
        • - #== - Coinbase::Client::Transfer + #== + Coinbase::Client::AddressList
        • - #== - Coinbase::Client::Balance + #== + Coinbase::Client::Transfer
        • - #== - Coinbase::Client::Address + #== + Coinbase::Client::Trade
        • - #== - Coinbase::Client::Wallet + #== + Coinbase::Client::Transaction
        • - #== - Coinbase::Client::Error + #== + Coinbase::Client::CreateTransferRequest
        • - #== - Coinbase::Client::Asset + #== + Coinbase::Client::CreateTradeRequest
        • - _deserialize - Coinbase::Client::AddressList + #== + Coinbase::Client::WalletList
        • - _deserialize - Coinbase::Client::FaucetTransaction + #== + Coinbase::Client::User
        • - _deserialize - Coinbase::Client::BroadcastTransferRequest + #== + Coinbase::Client::CreateAddressRequest
        • - _deserialize - Coinbase::Client::TransferList + #== + Coinbase::Client::ServerSignerEventList
        • - _deserialize - Coinbase::Client::WalletList + #== + Coinbase::Client::AddressBalanceList
        • - _deserialize - Coinbase::Client::CreateTransferRequest + #== + Coinbase::Client::ServerSigner
        • - _deserialize - Coinbase::Client::Error + #== + Coinbase::Client::ServerSignerEvent
        • - _deserialize - Coinbase::Client::User + #== + Coinbase::Client::SeedCreationEvent
        • - _deserialize - Coinbase::Client::CreateAddressRequest + #== + Coinbase::Client::CreateWalletRequestWallet
        • - _deserialize - Coinbase::Client::Address + #== + Coinbase::Client::Wallet
        • - _deserialize - Coinbase::Client::Transfer + #== + Coinbase::Client::SignatureCreationEvent
        • - _deserialize - Coinbase::Client::CreateWalletRequest + #== + Coinbase::Client::BroadcastTransferRequest
        • - _deserialize - Coinbase::Client::Asset + #== + Coinbase::Client::SignatureCreationEventResult
        • - _deserialize - Coinbase::Client::Wallet + #== + Coinbase::Client::FaucetTransaction
        • - _deserialize - Coinbase::Client::AddressBalanceList + _deserialize + Coinbase::Client::User
        • - _deserialize - Coinbase::Client::Balance + _deserialize + Coinbase::Client::SignatureCreationEvent
        • - #_to_hash - Coinbase::Client::Wallet + _deserialize + Coinbase::Client::Address
        • - #_to_hash - Coinbase::Client::TransferList + _deserialize + Coinbase::Client::CreateServerSignerRequest
        • - #_to_hash - Coinbase::Client::AddressList + _deserialize + Coinbase::Client::Balance
        • - #_to_hash - Coinbase::Client::Error + _deserialize + Coinbase::Client::ServerSigner
        • - #_to_hash - Coinbase::Client::WalletList + _deserialize + Coinbase::Client::SignatureCreationEventResult
        • - #_to_hash - Coinbase::Client::Transfer + _deserialize + Coinbase::Client::CreateWalletRequestWallet
        • - #_to_hash - Coinbase::Client::User + _deserialize + Coinbase::Client::SeedCreationEventResult
        • - #_to_hash - Coinbase::Client::Balance + _deserialize + Coinbase::Client::TransferList
        • - #_to_hash - Coinbase::Client::BroadcastTransferRequest + _deserialize + Coinbase::Client::CreateTransferRequest
        • - #_to_hash - Coinbase::Client::Asset + _deserialize + Coinbase::Client::BroadcastTransferRequest
        • - #_to_hash - Coinbase::Client::CreateTransferRequest + _deserialize + Coinbase::Client::AddressBalanceList
        • - #_to_hash - Coinbase::Client::Address + _deserialize + Coinbase::Client::Error
        • - #_to_hash - Coinbase::Client::CreateAddressRequest + _deserialize + Coinbase::Client::BroadcastTradeRequest
        • - #_to_hash - Coinbase::Client::CreateWalletRequest + _deserialize + Coinbase::Client::CreateAddressRequest
        • - #_to_hash - Coinbase::Client::AddressBalanceList + _deserialize + Coinbase::Client::Transaction
        • - #_to_hash - Coinbase::Client::FaucetTransaction + _deserialize + Coinbase::Client::Asset
        • - acceptable_attributes - Coinbase::Client::CreateWalletRequest + _deserialize + Coinbase::Client::CreateTradeRequest
        • - acceptable_attributes - Coinbase::Client::User + _deserialize + Coinbase::Client::ServerSignerEventList
        • - acceptable_attributes - Coinbase::Client::Asset + _deserialize + Coinbase::Client::Transfer
        • - acceptable_attributes - Coinbase::Client::Error + _deserialize + Coinbase::Client::TradeList
        • - acceptable_attributes - Coinbase::Client::Wallet + _deserialize + Coinbase::Client::ServerSignerEvent
        • - acceptable_attributes - Coinbase::Client::Address + _deserialize + Coinbase::Client::AddressList
        • - acceptable_attributes - Coinbase::Client::Balance + _deserialize + Coinbase::Client::Wallet
        • - acceptable_attributes - Coinbase::Client::Transfer + _deserialize + Coinbase::Client::WalletList
        • - acceptable_attributes - Coinbase::Client::WalletList + _deserialize + Coinbase::Client::FaucetTransaction
        • - acceptable_attributes - Coinbase::Client::AddressList + _deserialize + Coinbase::Client::SeedCreationEvent
        • - acceptable_attributes - Coinbase::Client::TransferList + _deserialize + Coinbase::Client::Trade
        • - acceptable_attributes - Coinbase::Client::FaucetTransaction + _deserialize + Coinbase::Client::CreateWalletRequest
        • - acceptable_attributes - Coinbase::Client::AddressBalanceList + #_to_hash + Coinbase::Client::CreateTradeRequest
        • - acceptable_attributes - Coinbase::Client::CreateAddressRequest + #_to_hash + Coinbase::Client::WalletList
        • - acceptable_attributes - Coinbase::Client::CreateTransferRequest + #_to_hash + Coinbase::Client::Transfer
        • - acceptable_attributes - Coinbase::Client::BroadcastTransferRequest + #_to_hash + Coinbase::Client::Transaction
        • - #access_token - Coinbase::Client::Configuration + #_to_hash + Coinbase::Client::TradeList
        • - #access_token_getter - Coinbase::Client::Configuration + #_to_hash + Coinbase::Client::CreateWalletRequestWallet
        • - #access_token_with_refresh - Coinbase::Client::Configuration + #_to_hash + Coinbase::Client::AddressList
        • - #add - Coinbase::BalanceMap + #_to_hash + Coinbase::Client::ServerSigner
        • - #address - Coinbase::Wallet + #_to_hash + Coinbase::Client::CreateServerSignerRequest
        • - #address_id - Coinbase::Client::Address + #_to_hash + Coinbase::Client::Balance
        • - #address_id - Coinbase::Asset + #_to_hash + Coinbase::Client::SeedCreationEventResult
        • - #address_id - Coinbase::Client::Transfer + #_to_hash + Coinbase::Client::TransferList
        • - #addresses - Coinbase::Wallet + #_to_hash + Coinbase::Client::Address
        • - #allowable_values - Coinbase::Client::Transfer::EnumAttributeValidator + #_to_hash + Coinbase::Client::SignatureCreationEventResult
        • - #amount - Coinbase::Client::Transfer + #_to_hash + Coinbase::Client::BroadcastTransferRequest
        • - #amount - Coinbase::Client::CreateTransferRequest + #_to_hash + Coinbase::Client::SignatureCreationEvent
        • - #amount - Coinbase::Client::Balance + #_to_hash + Coinbase::Client::Wallet
        • - #amount - Coinbase::Balance + #_to_hash + Coinbase::Client::FaucetTransaction
        • - #amount - Coinbase::Transfer + #_to_hash + Coinbase::Client::ServerSignerEventList
        • - #api_client - Coinbase::Client::TransfersApi + #_to_hash + Coinbase::Client::SeedCreationEvent
        • - #api_client - Coinbase::Configuration + #_to_hash + Coinbase::Client::ServerSignerEvent
        • - #api_client - Coinbase::Client::UsersApi + #_to_hash + Coinbase::Client::AddressBalanceList
        • - #api_client - Coinbase::Client::WalletsApi + #_to_hash + Coinbase::Client::CreateTransferRequest
        • - #api_client - Coinbase::Client::AddressesApi + #_to_hash + Coinbase::Client::Trade
        • - #api_code - Coinbase::APIError + #_to_hash + Coinbase::Client::User
        • - #api_key - Coinbase::Client::Configuration + #_to_hash + Coinbase::Client::BroadcastTradeRequest
        • - #api_key_name - Coinbase::Configuration + #_to_hash + Coinbase::Client::CreateWalletRequest
        • - #api_key_prefix - Coinbase::Client::Configuration + #_to_hash + Coinbase::Client::CreateAddressRequest
        • - #api_key_private_key - Coinbase::Configuration + #_to_hash + Coinbase::Client::Asset
        • - #api_key_with_prefix - Coinbase::Client::Configuration + #_to_hash + Coinbase::Client::Error
        • - #api_message - Coinbase::APIError + acceptable_attributes + Coinbase::Client::TradeList
        • - #api_url - Coinbase::Configuration + acceptable_attributes + Coinbase::Client::SignatureCreationEventResult
        • - #asset - Coinbase::Client::Balance + acceptable_attributes + Coinbase::Client::BroadcastTransferRequest
        • - #asset_id - Coinbase::Asset + acceptable_attributes + Coinbase::Client::Asset
        • - #asset_id - Coinbase::Client::Asset + acceptable_attributes + Coinbase::Client::AddressList
        • - #asset_id - Coinbase::Balance + acceptable_attributes + Coinbase::Client::Transfer
        • - #asset_id - Coinbase::Client::Transfer + acceptable_attributes + Coinbase::Client::Error
        • - #asset_id - Coinbase::Transfer + acceptable_attributes + Coinbase::Client::CreateTransferRequest
        • - #asset_id - Coinbase::Client::CreateTransferRequest + acceptable_attributes + Coinbase::Client::CreateWalletRequestWallet
        • - #attestation - Coinbase::Client::CreateAddressRequest + acceptable_attributes + Coinbase::Client::Transaction
        • - attribute_map - Coinbase::Client::CreateAddressRequest + acceptable_attributes + Coinbase::Client::SignatureCreationEvent
        • - attribute_map - Coinbase::Client::User + acceptable_attributes + Coinbase::Client::BroadcastTradeRequest
        • - attribute_map - Coinbase::Client::Wallet + acceptable_attributes + Coinbase::Client::CreateTradeRequest
        • - attribute_map - Coinbase::Client::Transfer + acceptable_attributes + Coinbase::Client::SeedCreationEvent
        • - attribute_map - Coinbase::Client::Address + acceptable_attributes + Coinbase::Client::Wallet
        • - attribute_map - Coinbase::Client::BroadcastTransferRequest + acceptable_attributes + Coinbase::Client::User
        • - attribute_map - Coinbase::Client::AddressBalanceList + acceptable_attributes + Coinbase::Client::CreateAddressRequest
        • - attribute_map - Coinbase::Client::Error + acceptable_attributes + Coinbase::Client::ServerSignerEventList
        • - attribute_map - Coinbase::Client::TransferList + acceptable_attributes + Coinbase::Client::ServerSignerEvent
        • - attribute_map - Coinbase::Client::Asset + acceptable_attributes + Coinbase::Client::ServerSigner
        • - attribute_map - Coinbase::Client::WalletList + acceptable_attributes + Coinbase::Client::AddressBalanceList
        • - attribute_map - Coinbase::Client::CreateTransferRequest + acceptable_attributes + Coinbase::Client::Address
        • - attribute_map - Coinbase::Client::FaucetTransaction + acceptable_attributes + Coinbase::Client::WalletList
        • - attribute_map - Coinbase::Client::Balance + acceptable_attributes + Coinbase::Client::TransferList
        • - attribute_map - Coinbase::Client::AddressList + acceptable_attributes + Coinbase::Client::SeedCreationEventResult
        • - attribute_map - Coinbase::Client::CreateWalletRequest + acceptable_attributes + Coinbase::Client::CreateServerSignerRequest
        • - #auth_settings - Coinbase::Client::Configuration + acceptable_attributes + Coinbase::Client::FaucetTransaction
        • - #backup_file_path - Coinbase::Configuration + acceptable_attributes + Coinbase::Client::Balance
        • - #balance - Coinbase::Wallet + acceptable_attributes + Coinbase::Client::Trade
        • - #balance - Coinbase::Address + acceptable_attributes + Coinbase::Client::CreateWalletRequest
        • - #balances - Coinbase::Wallet + #access_token + Coinbase::Client::Configuration
        • - #balances - Coinbase::Address + #access_token_getter + Coinbase::Client::Configuration
        • - #base_path + #access_token_with_refresh Coinbase::Client::Configuration
        • @@ -1030,151 +1030,151 @@

          Method List

        • - #base_sepolia_client - Coinbase::Configuration + #add + Coinbase::BalanceMap
        • - #base_sepolia_rpc_url - Coinbase::Configuration + #address + Coinbase::Wallet
        • - #base_url - Coinbase::Client::Configuration + #address_id + Coinbase::Asset
        • - #basic_auth - Coinbase::Client::ApiClient + #address_id + Coinbase::Client::Transfer
        • - #basic_auth_token - Coinbase::Client::Configuration + #address_id + Coinbase::Client::Trade
        • - #broadcast_transfer - Coinbase::Client::TransfersApi + #address_id + Coinbase::Client::SignatureCreationEventResult
        • - #broadcast_transfer_with_http_info - Coinbase::Client::TransfersApi + #address_id + Coinbase::Client::SignatureCreationEvent
        • - #build_collection_param - Coinbase::Client::ApiClient + #address_id + Coinbase::Client::Address
        • - #build_connection - Coinbase::Client::ApiClient + #address_index + Coinbase::Client::SignatureCreationEvent
        • - build_from_hash - Coinbase::Client::FaucetTransaction + #addresses + Coinbase::Wallet
        • - build_from_hash - Coinbase::Client::Balance + all_vars + Coinbase::Client::TransactionType
        • - build_from_hash - Coinbase::Client::CreateTransferRequest + #allowable_values + Coinbase::Client::Transfer::EnumAttributeValidator
        • - build_from_hash - Coinbase::Client::Wallet + #allowable_values + Coinbase::Client::Wallet::EnumAttributeValidator
        • - build_from_hash - Coinbase::Client::CreateWalletRequest + #allowable_values + Coinbase::Client::SignatureCreationEventResult::EnumAttributeValidator
        • - build_from_hash - Coinbase::Client::Address + #allowable_values + Coinbase::Client::Transaction::EnumAttributeValidator
        • - build_from_hash - Coinbase::Client::Asset + #allowable_values + Coinbase::Client::SignatureCreationEvent::EnumAttributeValidator
        • - build_from_hash - Coinbase::Client::WalletList + #amount + Coinbase::Client::CreateTransferRequest
        • - build_from_hash - Coinbase::Client::TransferList + #amount + Coinbase::Transfer
        • - build_from_hash + #amount Coinbase::Client::Transfer
        • @@ -1182,351 +1182,351 @@

          Method List

        • - build_from_hash - Coinbase::Client::Error + #amount + Coinbase::Client::CreateTradeRequest
        • - build_from_hash - Coinbase::Client::AddressBalanceList + #amount + Coinbase::Client::Balance
        • - build_from_hash - Coinbase::Client::CreateAddressRequest + #amount + Coinbase::Balance
        • - build_from_hash - Coinbase::Client::AddressList + #api_client + Coinbase::Client::WalletsApi
        • - build_from_hash - Coinbase::Client::User + #api_client + Coinbase::Client::AddressesApi
        • - build_from_hash - Coinbase::Client::BroadcastTransferRequest + #api_client + Coinbase::Client::TransfersApi
        • - #build_jwt - Coinbase::Authenticator + #api_client + Coinbase::Configuration
        • - #build_request - Coinbase::Client::ApiClient + #api_client + Coinbase::Client::ServerSignersApi
        • - #build_request_body - Coinbase::Client::ApiClient + #api_client + Coinbase::Client::UsersApi
        • - #build_request_url - Coinbase::Client::ApiClient + #api_client + Coinbase::Client::TradesApi
        • - #call - Coinbase::Authenticator + #api_code + Coinbase::APIError
        • - call_api - Coinbase + #api_key + Coinbase::Client::Configuration
        • - #call_api - Coinbase::Client::ApiClient + #api_key_name + Coinbase::Configuration
        • - #can_sign? - Coinbase::Wallet + #api_key_prefix + Coinbase::Client::Configuration
        • - #can_sign? - Coinbase::Address + #api_key_private_key + Coinbase::Configuration
        • - #chain_id - Coinbase::Network + #api_key_with_prefix + Coinbase::Client::Configuration
        • - #client_side_validation - Coinbase::Client::Configuration + #api_message + Coinbase::APIError
        • - #code - Coinbase::Client::ApiError + #api_url + Coinbase::Configuration
        • - #code - Coinbase::Client::Error + #asset + Coinbase::Client::Balance
        • - config - Coinbase::Middleware + #asset_id + Coinbase::Transfer
        • - #config - Coinbase::Client::ApiClient + #asset_id + Coinbase::Client::CreateTransferRequest
        • - configuration - Coinbase + #asset_id + Coinbase::Balance
        • - configure - Coinbase::Client + #asset_id + Coinbase::Client::Asset
        • - configure - Coinbase + #asset_id + Coinbase::Client::Transfer
        • - #configure - Coinbase::Client::Configuration + #asset_id + Coinbase::Asset
        • - #configure_connection - Coinbase::Client::Configuration + #attestation + Coinbase::Client::CreateAddressRequest
        • - #configure_faraday_connection - Coinbase::Client::Configuration + attribute_map + Coinbase::Client::User
        • - configure_from_json - Coinbase + attribute_map + Coinbase::Client::AddressBalanceList
        • - #configure_middleware - Coinbase::Client::Configuration + attribute_map + Coinbase::Client::ServerSigner
        • - #connection - Coinbase::Client::ApiClient + attribute_map + Coinbase::Client::ServerSignerEvent
        • - #connection_multipart - Coinbase::Client::ApiClient + attribute_map + Coinbase::Client::ServerSignerEventList
        • - #connection_regular - Coinbase::Client::ApiClient + attribute_map + Coinbase::Client::CreateTradeRequest
        • - #contract_address - Coinbase::Client::Asset + attribute_map + Coinbase::Client::BroadcastTradeRequest
        • - #convert_to_type - Coinbase::Client::ApiClient + attribute_map + Coinbase::Client::Wallet
        • - #create_address - Coinbase::Wallet + attribute_map + Coinbase::Client::SeedCreationEvent
        • - #create_address - Coinbase::Client::AddressesApi + attribute_map + Coinbase::Client::Transfer
        • - #create_address_with_http_info - Coinbase::Client::AddressesApi + attribute_map + Coinbase::Client::Error
        • - #create_transfer - Coinbase::Client::TransfersApi + attribute_map + Coinbase::Client::SignatureCreationEvent
        • - #create_transfer_with_http_info - Coinbase::Client::TransfersApi + attribute_map + Coinbase::Client::Transaction
        • - #create_wallet - Coinbase::User + attribute_map + Coinbase::Client::CreateWalletRequestWallet
        • - #create_wallet - Coinbase::Client::WalletsApi + attribute_map + Coinbase::Client::TransferList
        • - #create_wallet_with_http_info - Coinbase::Client::WalletsApi + attribute_map + Coinbase::Client::CreateAddressRequest
        • - #data - Coinbase::Client::AddressBalanceList + attribute_map + Coinbase::Client::CreateTransferRequest
        • - #data + attribute_map Coinbase::Client::AddressList
        • @@ -1534,159 +1534,175 @@

          Method List

        • - #data - Coinbase::Client::TransferList + attribute_map + Coinbase::Client::CreateWalletRequest
        • - #data - Coinbase::Client::WalletList + attribute_map + Coinbase::Client::Asset
        • - #datatype - Coinbase::Client::Transfer::EnumAttributeValidator + attribute_map + Coinbase::Client::BroadcastTransferRequest
        • - #debug_api - Coinbase::Configuration + attribute_map + Coinbase::Client::Trade
        • - #debugging - Coinbase::Client::Configuration + attribute_map + Coinbase::Client::SignatureCreationEventResult
        • - #decimals - Coinbase::Client::Asset + attribute_map + Coinbase::Client::CreateServerSignerRequest
        • - default - Coinbase::Client::ApiClient + attribute_map + Coinbase::Client::TradeList
        • - default - Coinbase::Client::Configuration + attribute_map + Coinbase::Client::Balance
        • - #default_address - Coinbase::Wallet + attribute_map + Coinbase::Client::SeedCreationEventResult
        • - #default_address - Coinbase::Client::Wallet + attribute_map + Coinbase::Client::FaucetTransaction
        • - #default_headers - Coinbase::Client::ApiClient + attribute_map + Coinbase::Client::WalletList
        • - default_user - Coinbase + attribute_map + Coinbase::Client::Address
        • - #deserialize - Coinbase::Client::ApiClient + #auth_settings + Coinbase::Client::Configuration
        • - #deserialize_file - Coinbase::Client::ApiClient + #balance + Coinbase::Address
        • - #destination - Coinbase::Client::CreateTransferRequest + #balance + Coinbase::Wallet
        • - #destination - Coinbase::Client::Transfer + #balances + Coinbase::Wallet
        • - #destination_address_id - Coinbase::Transfer + #balances + Coinbase::Address
        • - #display_name - Coinbase::Asset + #base_path + Coinbase::Client::Configuration
        • - #display_name - Coinbase::Client::User + #base_sepolia_client + Coinbase::Configuration
        • - #download_file + #base_sepolia_rpc_url + Coinbase::Configuration +
          +
        • + + +
        • +
          + #base_url + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + #basic_auth Coinbase::Client::ApiClient
        • @@ -1694,119 +1710,135 @@

          Method List

        • - #eql? - Coinbase::Client::Balance + #basic_auth_token + Coinbase::Client::Configuration
        • - #eql? - Coinbase::Client::CreateAddressRequest + #broadcast_trade + Coinbase::Client::TradesApi
        • - #eql? - Coinbase::Client::Wallet + #broadcast_trade_with_http_info + Coinbase::Client::TradesApi
        • - #eql? - Coinbase::Client::CreateWalletRequest + #broadcast_transfer + Coinbase::Client::TransfersApi
        • - #eql? - Coinbase::Client::BroadcastTransferRequest + #broadcast_transfer_with_http_info + Coinbase::Client::TransfersApi
        • - #eql? - Coinbase::Client::FaucetTransaction + build + Coinbase::Client::ServerSignerEventEvent
        • - #eql? - Coinbase::Client::Error + #build_collection_param + Coinbase::Client::ApiClient
        • - #eql? - Coinbase::Client::TransferList + #build_connection + Coinbase::Client::ApiClient
        • - #eql? - Coinbase::Client::WalletList + build_from_hash + Coinbase::Client::FaucetTransaction
        • - #eql? - Coinbase::Client::Address + build_from_hash + Coinbase::Client::ServerSignerEvent
        • - #eql? - Coinbase::Client::User + build_from_hash + Coinbase::Client::ServerSignerEventList
        • - #eql? - Coinbase::Client::AddressList + build_from_hash + Coinbase::Client::SeedCreationEvent
        • - #eql? - Coinbase::Client::CreateTransferRequest + build_from_hash + Coinbase::Client::Error
        • - #eql? - Coinbase::Client::Asset + build_from_hash + Coinbase::Client::ServerSigner
        • - #eql? + build_from_hash + Coinbase::Client::Address +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::BroadcastTransferRequest +
          +
        • + + +
        • +
          + build_from_hash Coinbase::Client::AddressBalanceList
        • @@ -1814,727 +1846,3335 @@

          Method List

        • - #eql? - Coinbase::Client::Transfer + #build_from_hash + Coinbase::Client::TransactionType
        • - #export - Coinbase::Address + build_from_hash + Coinbase::Client::CreateWalletRequest
        • - #export - Coinbase::Wallet + build_from_hash + Coinbase::Client::TransactionType
        • - #faucet - Coinbase::Wallet + build_from_hash + Coinbase::Client::Wallet
        • - #faucet - Coinbase::Address + build_from_hash + Coinbase::Client::BroadcastTradeRequest
        • - #force_ending_format - Coinbase::Client::Configuration + build_from_hash + Coinbase::Client::CreateWalletRequestWallet
        • - #from_address_id - Coinbase::Transfer + build_from_hash + Coinbase::Client::CreateTransferRequest
        • - from_atomic_amount - Coinbase::Asset + build_from_hash + Coinbase::Client::TransferList
        • - from_balances - Coinbase::BalanceMap + build_from_hash + Coinbase::Client::CreateServerSignerRequest +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::SignatureCreationEventResult +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::WalletList +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::Balance +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::Trade +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::CreateAddressRequest +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::CreateTradeRequest +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::TradeList +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::Asset +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::User +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::Transfer +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::AddressList +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::Transaction +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::SignatureCreationEvent +
          +
        • + + +
        • +
          + build_from_hash + Coinbase::Client::SeedCreationEventResult +
          +
        • + + +
        • +
          + #build_jwt + Coinbase::Authenticator +
          +
        • + + +
        • +
          + #build_request + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #build_request_body + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #build_request_url + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #call + Coinbase::Authenticator +
          +
        • + + +
        • +
          + call_api + Coinbase +
          +
        • + + +
        • +
          + #call_api + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #can_sign? + Coinbase::Address +
          +
        • + + +
        • +
          + #can_sign? + Coinbase::Wallet +
          +
        • + + +
        • +
          + #chain_id + Coinbase::Network +
          +
        • + + +
        • +
          + #client_side_validation + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + #code + Coinbase::Client::Error +
          +
        • + + +
        • +
          + #code + Coinbase::Client::ApiError +
          +
        • + + +
        • +
          + config + Coinbase::Middleware +
          +
        • + + +
        • +
          + #config + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + configuration + Coinbase +
          +
        • + + +
        • +
          + #configure + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + configure + Coinbase +
          +
        • + + +
        • +
          + configure + Coinbase::Client +
          +
        • + + +
        • +
          + #configure_connection + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + #configure_faraday_connection + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + configure_from_json + Coinbase +
          +
        • + + +
        • +
          + #configure_middleware + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + #connection + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #connection_multipart + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #connection_regular + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #contract_address + Coinbase::Client::Asset +
          +
        • + + +
        • +
          + #convert_to_type + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + create + Coinbase::Wallet +
          +
        • + + +
        • +
          + #create_address + Coinbase::Wallet +
          +
        • + + +
        • +
          + #create_address + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #create_address_with_http_info + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #create_server_signer + Coinbase::Client::ServerSignersApi +
          +
        • + + +
        • +
          + #create_server_signer_with_http_info + Coinbase::Client::ServerSignersApi +
          +
        • + + +
        • +
          + #create_trade + Coinbase::Client::TradesApi +
          +
        • + + +
        • +
          + #create_trade_with_http_info + Coinbase::Client::TradesApi +
          +
        • + + +
        • +
          + #create_transfer + Coinbase::Client::TransfersApi +
          +
        • + + +
        • +
          + #create_transfer_with_http_info + Coinbase::Client::TransfersApi +
          +
        • + + +
        • +
          + #create_wallet + Coinbase::User +
          +
        • + + +
        • +
          + #create_wallet + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + #create_wallet_with_http_info + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + #data + Coinbase::Client::AddressBalanceList +
          +
        • + + +
        • +
          + #data + Coinbase::Client::ServerSignerEventList +
          +
        • + + +
        • +
          + #data + Coinbase::Client::TransferList +
          +
        • + + +
        • +
          + #data + Coinbase::Client::TradeList +
          +
        • + + +
        • +
          + #data + Coinbase::Client::AddressList +
          +
        • + + +
        • +
          + #data + Coinbase::Client::WalletList +
          +
        • + + +
        • +
          + #datatype + Coinbase::Client::Transaction::EnumAttributeValidator +
          +
        • + + +
        • +
          + #datatype + Coinbase::Client::Wallet::EnumAttributeValidator +
          +
        • + + +
        • +
          + #datatype + Coinbase::Client::SignatureCreationEvent::EnumAttributeValidator +
          +
        • + + +
        • +
          + #datatype + Coinbase::Client::Transfer::EnumAttributeValidator +
          +
        • + + +
        • +
          + #datatype + Coinbase::Client::SignatureCreationEventResult::EnumAttributeValidator +
          +
        • + + +
        • +
          + #debug_api + Coinbase::Configuration +
          +
        • + + +
        • +
          + #debugging + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + #decimals + Coinbase::Client::Asset +
          +
        • + + +
        • +
          + default + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + default + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #default_address + Coinbase::Wallet +
          +
        • + + +
        • +
          + #default_address + Coinbase::Client::Wallet +
          +
        • + + +
        • +
          + #default_headers + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + default_user + Coinbase +
          +
        • + + +
        • +
          + #deserialize + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #deserialize_file + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #destination + Coinbase::Client::CreateTransferRequest +
          +
        • + + +
        • +
          + #destination + Coinbase::Client::Transfer +
          +
        • + + +
        • +
          + #destination_address_id + Coinbase::Transfer +
          +
        • + + +
        • +
          + #display_name + Coinbase::Asset +
          +
        • + + +
        • +
          + #display_name + Coinbase::Client::User +
          +
        • + + +
        • +
          + #download_file + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #enrollment_data + Coinbase::Client::CreateServerSignerRequest +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::AddressList +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::CreateAddressRequest +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::Asset +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::CreateWalletRequest +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::BroadcastTradeRequest +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::Trade +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::CreateTransferRequest +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::CreateTradeRequest +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::User +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::ServerSignerEventList +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::AddressBalanceList +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::ServerSignerEvent +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::SeedCreationEvent +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::SignatureCreationEventResult +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::Wallet +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::SignatureCreationEvent +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::BroadcastTransferRequest +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::FaucetTransaction +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::Address +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::SeedCreationEventResult +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::CreateServerSignerRequest +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::Balance +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::TransferList +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::CreateWalletRequestWallet +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::ServerSigner +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::Transaction +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::Error +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::Transfer +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::TradeList +
          +
        • + + +
        • +
          + #eql? + Coinbase::Client::WalletList +
          +
        • + + +
        • +
          + #event + Coinbase::Client::ServerSignerEvent +
          +
        • + + +
        • +
          + #export + Coinbase::Wallet +
          +
        • + + +
        • +
          + #export + Coinbase::Address +
          +
        • + + +
        • +
          + #extended_public_key + Coinbase::Client::SeedCreationEventResult +
          +
        • + + +
        • +
          + #faucet + Coinbase::Address +
          +
        • + + +
        • +
          + #faucet + Coinbase::Wallet +
          +
        • + + +
        • +
          + #force_ending_format + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + #from_address_id + Coinbase::Transfer +
          +
        • + + +
        • +
          + #from_amount + Coinbase::Client::Trade +
          +
        • + + +
        • +
          + #from_asset + Coinbase::Client::Trade +
          +
        • + + +
        • +
          + #from_asset_id + Coinbase::Client::CreateTradeRequest +
          +
        • + + +
        • +
          + from_atomic_amount + Coinbase::Asset +
          +
        • + + +
        • +
          + from_balances + Coinbase::BalanceMap +
          +
        • + + +
        • +
          + from_error + Coinbase::APIError +
          +
        • + + +
        • +
          + from_hash + Coinbase::Wallet::Data +
          +
        • + + +
        • +
          + #from_json + Coinbase::Configuration +
          +
        • + + +
        • +
          + from_model + Coinbase::Balance +
          +
        • + + +
        • +
          + from_model_and_asset_id + Coinbase::Balance +
          +
        • + + +
        • +
          + #get_address + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #get_address_balance + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #get_address_balance_with_http_info + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #get_address_with_http_info + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #get_asset + Coinbase::Network +
          +
        • + + +
        • +
          + #get_current_user + Coinbase::Client::UsersApi +
          +
        • + + +
        • +
          + #get_current_user_with_http_info + Coinbase::Client::UsersApi +
          +
        • + + +
        • +
          + #get_server_signer + Coinbase::Client::ServerSignersApi +
          +
        • + + +
        • +
          + #get_server_signer_with_http_info + Coinbase::Client::ServerSignersApi +
          +
        • + + +
        • +
          + #get_trade + Coinbase::Client::TradesApi +
          +
        • + + +
        • +
          + #get_trade_with_http_info + Coinbase::Client::TradesApi +
          +
        • + + +
        • +
          + #get_transfer + Coinbase::Client::TransfersApi +
          +
        • + + +
        • +
          + #get_transfer_with_http_info + Coinbase::Client::TransfersApi +
          +
        • + + +
        • +
          + #get_wallet + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + #get_wallet_balance + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + #get_wallet_balance_with_http_info + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + #get_wallet_with_http_info + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + #has_more + Coinbase::Client::AddressList +
          +
        • + + +
        • +
          + #has_more + Coinbase::Client::TradeList +
          +
        • + + +
        • +
          + #has_more + Coinbase::Client::ServerSignerEventList +
          +
        • + + +
        • +
          + #has_more + Coinbase::Client::TransferList +
          +
        • + + +
        • +
          + #has_more + Coinbase::Client::AddressBalanceList +
          +
        • + + +
        • +
          + #has_more + Coinbase::Client::WalletList +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::CreateTradeRequest +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::TradeList +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::ServerSignerEvent +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::AddressBalanceList +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::ServerSignerEventList +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::Error +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::CreateWalletRequestWallet +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::ServerSigner +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::CreateAddressRequest +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::SeedCreationEvent +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::CreateTransferRequest +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::WalletList +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::Transaction +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::Asset +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::CreateServerSignerRequest +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::AddressList +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::Transfer +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::User +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::BroadcastTradeRequest +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::CreateWalletRequest +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::Balance +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::TransferList +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::Wallet +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::SignatureCreationEvent +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::FaucetTransaction +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::Address +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::BroadcastTransferRequest +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::SeedCreationEventResult +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::SignatureCreationEventResult +
          +
        • + + +
        • +
          + #hash + Coinbase::Client::Trade +
          +
        • + + +
        • +
          + #host + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + #http_code + Coinbase::APIError +
          +
        • + + +
        • +
          + #id + Coinbase::Client::Wallet +
          +
        • + + +
        • +
          + #id + Coinbase::Transfer +
          +
        • + + +
        • +
          + #id + Coinbase::User +
          +
        • + + +
        • +
          + #id + Coinbase::Wallet +
          +
        • + + +
        • +
          + #id + Coinbase::Client::User +
          +
        • + + +
        • +
          + #id + Coinbase::Address +
          +
        • + + +
        • +
          + import + Coinbase::Wallet +
          +
        • + + +
        • +
          + #import_wallet + Coinbase::User +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::TradeList +
          +
        • + + +
        • +
          + #initialize + Coinbase::Configuration +
          +
        • + + +
        • +
          + #initialize + Coinbase::User +
          +
        • + + +
        • +
          + #initialize + Coinbase::Asset +
          +
        • + + +
        • +
          + #initialize + Coinbase::APIError +
          +
        • + + +
        • +
          + #initialize + Coinbase::Wallet +
          +
        • + + +
        • +
          + #initialize + Coinbase::Wallet::Data +
          +
        • + + +
        • +
          + #initialize + Coinbase::Address +
          +
        • + + +
        • +
          + #initialize + Coinbase::Balance +
          +
        • + + +
        • +
          + #initialize + Coinbase::Network +
          +
        • + + +
        • +
          + #initialize + Coinbase::Transfer +
          +
        • + + +
        • +
          + #initialize + Coinbase::Authenticator +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::ApiError +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::User +
          +
        • + + +
        • +
          + #initialize + Coinbase::FaucetTransaction +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Asset +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Error +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Trade +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::UsersApi +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Wallet::EnumAttributeValidator +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Wallet +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::TradesApi +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Address +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Balance +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Transfer::EnumAttributeValidator +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Transfer +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::TransfersApi +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Transaction::EnumAttributeValidator +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::Transaction +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::WalletList +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::AddressList +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::ServerSigner +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::TransferList +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::ServerSignersApi +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::FaucetTransaction +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::SeedCreationEvent +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::ServerSignerEvent +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::AddressBalanceList +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::CreateTradeRequest +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::CreateWalletRequest +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::CreateAddressRequest +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::BroadcastTradeRequest +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::CreateTransferRequest +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::ServerSignerEventList +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::SignatureCreationEvent::EnumAttributeValidator +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::SignatureCreationEvent +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::BroadcastTransferRequest +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::SeedCreationEventResult +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::CreateServerSignerRequest +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::CreateWalletRequestWallet +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::SignatureCreationEventResult::EnumAttributeValidator +
          +
        • + + +
        • +
          + #initialize + Coinbase::Client::SignatureCreationEventResult +
          +
        • + + +
        • +
          + #inject_format + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + #inspect + Coinbase::Transfer +
          +
        • + + +
        • +
          + #inspect + Coinbase::Address +
          +
        • + + +
        • +
          + #inspect + Coinbase::FaucetTransaction +
          +
        • + + +
        • +
          + #inspect + Coinbase::User +
          +
        • + + +
        • +
          + #inspect + Coinbase::BalanceMap +
          +
        • + + +
        • +
          + #inspect + Coinbase::Wallet +
          +
        • + + +
        • +
          + #inspect + Coinbase::Asset +
          +
        • + + +
        • +
          + #inspect + Coinbase::APIError +
          +
        • + + +
        • +
          + #inspect + Coinbase::Balance +
          +
        • + + +
        • +
          + #json_mime? + Coinbase::Client::ApiClient +
          +
        • + + +
        • +
          + #key= + Coinbase::Address +
          +
        • + + +
        • +
          + #list_address_balances + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #list_address_balances_with_http_info + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #list_addresses + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #list_addresses_with_http_info + Coinbase::Client::AddressesApi +
          +
        • + + +
        • +
          + #list_assets + Coinbase::Network +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::ServerSignerEvent +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::Transfer +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::SeedCreationEvent +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::WalletList +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::Wallet +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::BroadcastTransferRequest +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::TransferList +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::CreateTransferRequest +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::Error +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::User +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::CreateAddressRequest +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::TradeList +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::ServerSignerEventList +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::CreateWalletRequest +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::SignatureCreationEventResult +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::BroadcastTradeRequest +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::Trade +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::Asset +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::CreateTradeRequest +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::Transaction +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::AddressBalanceList +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::SignatureCreationEvent +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::AddressList +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::ServerSigner +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::CreateWalletRequestWallet +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::FaucetTransaction +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::SeedCreationEventResult +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::Address +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::Balance +
          +
        • + + +
        • +
          + #list_invalid_properties + Coinbase::Client::CreateServerSignerRequest +
          +
        • + + +
        • +
          + #list_server_signer_events + Coinbase::Client::ServerSignersApi +
          +
        • + + +
        • +
          + #list_server_signer_events_with_http_info + Coinbase::Client::ServerSignersApi +
          +
        • + + +
        • +
          + #list_server_signers + Coinbase::Client::ServerSignersApi +
          +
        • + + +
        • +
          + #list_server_signers_with_http_info + Coinbase::Client::ServerSignersApi +
          +
        • + + +
        • +
          + #list_trades + Coinbase::Client::TradesApi +
          +
        • + + +
        • +
          + #list_trades_with_http_info + Coinbase::Client::TradesApi +
          +
        • + + +
        • +
          + #list_transfers + Coinbase::Client::TransfersApi +
          +
        • + + +
        • +
          + #list_transfers_with_http_info + Coinbase::Client::TransfersApi +
          +
        • + + +
        • +
          + #list_wallet_balances + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + #list_wallet_balances_with_http_info + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + #list_wallets + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + #list_wallets_with_http_info + Coinbase::Client::WalletsApi +
          +
        • + + +
        • +
          + load_default_user + Coinbase +
          +
        • + + +
        • +
          + #load_seed + Coinbase::Wallet +
          +
        • + + +
        • +
          + #logger + Coinbase::Client::Configuration +
          +
        • + + +
        • +
          + #message + Coinbase::Client::Error +
          +
        • + + +
        • +
          + #message + Coinbase::Client::ApiError +
          +
        • + + +
        • +
          + #model + Coinbase::FaucetTransaction +
          +
        • + + +
        • +
          + #model + Coinbase::Wallet +
          +
        • + + +
        • +
          + #native_asset + Coinbase::Network +
          +
        • + + +
        • +
          + #network_id + Coinbase::Address +
          +
        • + + +
        • +
          + #network_id + Coinbase::Asset +
          +
        • + + +
        • +
          + #network_id + Coinbase::Transfer +
          +
        • + + +
        • +
          + #network_id + Coinbase::Client::CreateTransferRequest +
          +
        • + + +
        • +
          + #network_id + Coinbase::Client::Wallet +
          +
        • + + +
        • +
          + #network_id + Coinbase::Client::Asset +
          +
        • + + +
        • +
          + #network_id + Coinbase::Client::Address +
          +
        • + + +
        • +
          + #network_id + Coinbase::Client::CreateWalletRequestWallet
        • - from_error - Coinbase::APIError + #network_id + Coinbase::Wallet
        • - from_hash - Coinbase::Wallet::Data + #network_id + Coinbase::Client::Transfer
        • - #from_json - Coinbase::Configuration + #network_id + Coinbase::Client::Trade
        • - from_model - Coinbase::Balance + #next_page + Coinbase::Client::ServerSignerEventList
        • - from_model_and_asset_id - Coinbase::Balance + #next_page + Coinbase::Client::AddressBalanceList
        • - #get_address - Coinbase::Client::AddressesApi + #next_page + Coinbase::Client::TradeList
        • - #get_address_balance - Coinbase::Client::AddressesApi + #next_page + Coinbase::Client::TransferList
        • - #get_address_balance_with_http_info - Coinbase::Client::AddressesApi + #next_page + Coinbase::Client::AddressList
        • - #get_address_with_http_info - Coinbase::Client::AddressesApi + #next_page + Coinbase::Client::WalletList
        • - #get_asset - Coinbase::Network + #object_to_hash + Coinbase::Client::ApiClient
        • - #get_current_user - Coinbase::Client::UsersApi + #object_to_http_body + Coinbase::Client::ApiClient
        • - #get_current_user_with_http_info - Coinbase::Client::UsersApi + openapi_nullable + Coinbase::Client::Address
        • - #get_transfer - Coinbase::Client::TransfersApi + openapi_nullable + Coinbase::Client::CreateServerSignerRequest
        • - #get_transfer_with_http_info - Coinbase::Client::TransfersApi + openapi_nullable + Coinbase::Client::BroadcastTradeRequest
        • - #get_wallet - Coinbase::Client::WalletsApi + openapi_nullable + Coinbase::Client::Transfer
        • - #get_wallet_balance - Coinbase::Client::WalletsApi + openapi_nullable + Coinbase::Client::ServerSignerEvent
        • - #get_wallet_balance_with_http_info - Coinbase::Client::WalletsApi + openapi_nullable + Coinbase::Client::Error
        • - #get_wallet_with_http_info - Coinbase::Client::WalletsApi + openapi_nullable + Coinbase::Client::FaucetTransaction
        • - #has_more - Coinbase::Client::WalletList + openapi_nullable + Coinbase::Client::CreateWalletRequestWallet
        • - #has_more - Coinbase::Client::AddressBalanceList + openapi_nullable + Coinbase::Client::SignatureCreationEventResult
        • - #has_more - Coinbase::Client::AddressList + openapi_nullable + Coinbase::Client::SeedCreationEventResult
        • - #has_more - Coinbase::Client::TransferList + openapi_nullable + Coinbase::Client::CreateWalletRequest
        • - #hash - Coinbase::Client::CreateTransferRequest + openapi_nullable + Coinbase::Client::ServerSigner
        • - #hash - Coinbase::Client::FaucetTransaction + openapi_nullable + Coinbase::Client::Balance
        • - #hash - Coinbase::Client::WalletList + openapi_nullable + Coinbase::Client::TransferList
        • - #hash - Coinbase::Client::Error + openapi_nullable + Coinbase::Client::Trade
        • - #hash - Coinbase::Client::Transfer + openapi_nullable + Coinbase::Client::CreateTransferRequest
        • - #hash - Coinbase::Client::BroadcastTransferRequest + openapi_nullable + Coinbase::Client::Transaction
        • - #hash - Coinbase::Client::AddressBalanceList + openapi_nullable + Coinbase::Client::CreateTradeRequest
        • - #hash - Coinbase::Client::Asset + openapi_nullable + Coinbase::Client::ServerSignerEventList
        • - #hash - Coinbase::Client::CreateAddressRequest + openapi_nullable + Coinbase::Client::AddressBalanceList
        • - #hash - Coinbase::Client::CreateWalletRequest + openapi_nullable + Coinbase::Client::SignatureCreationEvent
        • - #hash - Coinbase::Client::User + openapi_nullable + Coinbase::Client::Asset
        • - #hash - Coinbase::Client::Address + openapi_nullable + Coinbase::Client::TradeList
        • - #hash - Coinbase::Client::AddressList + openapi_nullable + Coinbase::Client::Wallet
        • - #hash - Coinbase::Client::TransferList + openapi_nullable + Coinbase::Client::User
        • - #hash - Coinbase::Client::Balance + openapi_nullable + Coinbase::Client::SeedCreationEvent
        • - #hash - Coinbase::Client::Wallet + openapi_nullable + Coinbase::Client::AddressList
        • - #host - Coinbase::Client::Configuration + openapi_nullable + Coinbase::Client::WalletList
        • - #http_code - Coinbase::APIError + openapi_nullable + Coinbase::Client::BroadcastTransferRequest
        • - #id - Coinbase::Address + openapi_nullable + Coinbase::Client::CreateAddressRequest
        • - #id - Coinbase::Wallet + openapi_one_of + Coinbase::Client::ServerSignerEventEvent
        • - #id - Coinbase::User + openapi_types + Coinbase::Client::WalletList
        • - #id - Coinbase::Transfer + openapi_types + Coinbase::Client::TransferList
        • - #id - Coinbase::Client::Wallet + openapi_types + Coinbase::Client::CreateServerSignerRequest
        • - #id - Coinbase::Client::User + openapi_types + Coinbase::Client::Balance
        • - import - Coinbase::Wallet + openapi_types + Coinbase::Client::Address
        • - #import_wallet - Coinbase::User + openapi_types + Coinbase::Client::CreateWalletRequestWallet
        • - #initialize - Coinbase::Client::Error + openapi_types + Coinbase::Client::FaucetTransaction
        • - #initialize - Coinbase::Configuration + openapi_types + Coinbase::Client::SeedCreationEventResult
        • - #initialize - Coinbase::Address + openapi_types + Coinbase::Client::ServerSigner
        • - #initialize - Coinbase::APIError + openapi_types + Coinbase::Client::SeedCreationEvent
        • - #initialize - Coinbase::Client::UsersApi + openapi_types + Coinbase::Client::Wallet
        • - #initialize - Coinbase::Client::CreateAddressRequest + openapi_types + Coinbase::Client::BroadcastTransferRequest
        • - #initialize - Coinbase::Client::CreateWalletRequest + openapi_types + Coinbase::Client::Transfer
        • - #initialize - Coinbase::Client::Asset + openapi_types + Coinbase::Client::ServerSignerEvent
        • - #initialize - Coinbase::Client::AddressBalanceList + openapi_types + Coinbase::Client::Transaction
        • - #initialize - Coinbase::Client::Configuration + openapi_types + Coinbase::Client::TradeList
        • - #initialize - Coinbase::FaucetTransaction + openapi_types + Coinbase::Client::AddressBalanceList
        • - #initialize - Coinbase::Wallet + openapi_types + Coinbase::Client::SignatureCreationEvent
        • - #initialize - Coinbase::Client::User + openapi_types + Coinbase::Client::AddressList
        • - #initialize - Coinbase::User + openapi_types + Coinbase::Client::CreateTradeRequest
        • - #initialize - Coinbase::Wallet::Data + openapi_types + Coinbase::Client::SignatureCreationEventResult
        • - #initialize - Coinbase::Client::BroadcastTransferRequest + openapi_types + Coinbase::Client::Error
        • - #initialize - Coinbase::Client::Wallet + openapi_types + Coinbase::Client::Asset
        • - #initialize - Coinbase::Client::FaucetTransaction + openapi_types + Coinbase::Client::Trade
        • - #initialize - Coinbase::Client::CreateTransferRequest + openapi_types + Coinbase::Client::CreateWalletRequest
        • - #initialize - Coinbase::Client::ApiClient + openapi_types + Coinbase::Client::BroadcastTradeRequest
        • - #initialize - Coinbase::Client::Address + openapi_types + Coinbase::Client::ServerSignerEventList
        • - #initialize - Coinbase::Client::ApiError + openapi_types + Coinbase::Client::CreateAddressRequest
        • - #initialize - Coinbase::Authenticator + openapi_types + Coinbase::Client::User
        • - #initialize - Coinbase::Client::Balance + openapi_types + Coinbase::Client::CreateTransferRequest
        • - #initialize - Coinbase::Client::TransferList + #operation_server_settings + Coinbase::Client::Configuration
        • - #initialize - Coinbase::Client::WalletsApi + #params_encoder + Coinbase::Client::Configuration
        • - #initialize - Coinbase::Transfer + #password + Coinbase::Client::Configuration
        • - #initialize - Coinbase::Network + primary_denomination + Coinbase::Asset
        • - #initialize - Coinbase::Balance + #proxy + Coinbase::Client::Configuration
        • - #initialize - Coinbase::Client::Transfer::EnumAttributeValidator + #public_key + Coinbase::Client::Address
        • - #initialize - Coinbase::Client::Transfer + #public_key + Coinbase::Client::CreateAddressRequest
        • -
          - #initialize - Coinbase::Asset +
          + #reload + Coinbase::Transfer
        • - #initialize - Coinbase::Client::AddressList + #request + Coinbase::Client::Configuration
        • - #initialize + #request_faucet_funds Coinbase::Client::AddressesApi
        • @@ -2542,79 +5182,79 @@

          Method List

        • - #initialize - Coinbase::Client::TransfersApi + #request_faucet_funds_with_http_info + Coinbase::Client::AddressesApi
        • - #initialize - Coinbase::Client::WalletList + #response + Coinbase::Client::Configuration
        • - #inject_format - Coinbase::Client::Configuration + #response_body + Coinbase::Client::ApiError
        • - #inspect - Coinbase::Balance + #response_headers + Coinbase::Client::ApiError
        • - #inspect - Coinbase::BalanceMap + #return_binary_data + Coinbase::Client::Configuration
        • - #inspect - Coinbase::APIError + #sanitize_filename + Coinbase::Client::ApiClient
        • - #inspect - Coinbase::Asset + #save_seed! + Coinbase::Wallet
        • - #inspect - Coinbase::User + #scheme + Coinbase::Client::Configuration
        • - #inspect - Coinbase::Transfer + #seed + Coinbase::Wallet::Data
        • - #inspect + #seed= Coinbase::Wallet
        • @@ -2622,23 +5262,23 @@

          Method List

        • - #inspect - Coinbase::Address + #seed_id + Coinbase::Client::SeedCreationEventResult
        • - #inspect - Coinbase::FaucetTransaction + #seed_id + Coinbase::Client::SignatureCreationEvent
        • - #json_mime? + #select_header_accept Coinbase::Client::ApiClient
        • @@ -2646,327 +5286,327 @@

          Method List

        • - #key= - Coinbase::Address + #select_header_content_type + Coinbase::Client::ApiClient
        • - #list_address_balances - Coinbase::Client::AddressesApi + #server_index + Coinbase::Client::Configuration
        • - #list_address_balances_with_http_info - Coinbase::Client::AddressesApi + #server_operation_index + Coinbase::Client::Configuration
        • - #list_addresses - Coinbase::Client::AddressesApi + #server_operation_variables + Coinbase::Client::Configuration
        • - #list_addresses_with_http_info - Coinbase::Client::AddressesApi + #server_settings + Coinbase::Client::Configuration
        • - #list_assets - Coinbase::Network + #server_signer_id + Coinbase::Client::ServerSigner
        • - #list_invalid_properties - Coinbase::Client::Address + #server_signer_id + Coinbase::Client::CreateServerSignerRequest
        • - #list_invalid_properties - Coinbase::Client::FaucetTransaction + #server_signer_id + Coinbase::Client::ServerSignerEvent
        • - #list_invalid_properties - Coinbase::Client::Wallet + #server_signer_status + Coinbase::Wallet
        • - #list_invalid_properties - Coinbase::Client::WalletList + #server_signer_status + Coinbase::Client::Wallet
        • - #list_invalid_properties - Coinbase::Client::User + #server_url + Coinbase::Client::Configuration
        • - #list_invalid_properties - Coinbase::Client::Transfer + #server_variables + Coinbase::Client::Configuration
        • - #list_invalid_properties - Coinbase::Client::AddressList + #set_faraday_middleware + Coinbase::Client::Configuration
        • - #list_invalid_properties - Coinbase::Client::AddressBalanceList + #signature + Coinbase::Client::SignatureCreationEventResult
        • - #list_invalid_properties - Coinbase::Client::Error + #signed_payload + Coinbase::Client::Transfer
        • - #list_invalid_properties - Coinbase::Client::Asset + #signed_payload + Coinbase::Transfer
        • - #list_invalid_properties - Coinbase::Client::CreateAddressRequest + #signed_payload + Coinbase::Client::Transaction
        • - #list_invalid_properties - Coinbase::Client::CreateWalletRequest + #signed_payload + Coinbase::Client::BroadcastTradeRequest
        • - #list_invalid_properties - Coinbase::Client::CreateTransferRequest + #signed_payload + Coinbase::Client::BroadcastTransferRequest
        • - #list_invalid_properties - Coinbase::Client::TransferList + #signing_payload + Coinbase::Client::SignatureCreationEvent
        • - #list_invalid_properties - Coinbase::Client::Balance + #ssl_ca_file + Coinbase::Client::Configuration
        • - #list_invalid_properties - Coinbase::Client::BroadcastTransferRequest + #ssl_client_cert + Coinbase::Client::Configuration
        • - #list_transfers - Coinbase::Client::TransfersApi + #ssl_client_key + Coinbase::Client::Configuration
        • - #list_transfers_with_http_info - Coinbase::Client::TransfersApi + #ssl_options + Coinbase::Client::ApiClient
        • - #list_wallet_balances - Coinbase::Client::WalletsApi + #ssl_verify + Coinbase::Client::Configuration
        • - #list_wallet_balances_with_http_info - Coinbase::Client::WalletsApi + #ssl_verify_mode + Coinbase::Client::Configuration
        • - #list_wallets - Coinbase::Client::WalletsApi + #status + Coinbase::Transfer
        • - #list_wallets_with_http_info - Coinbase::Client::WalletsApi + #status + Coinbase::Client::Transaction
        • - load_default_user - Coinbase + #status + Coinbase::Client::Transfer
        • - #load_wallets_from_local - Coinbase::User + #submit_server_signer_seed_event_result + Coinbase::Client::ServerSignersApi
        • - #logger - Coinbase::Client::Configuration + #submit_server_signer_seed_event_result_with_http_info + Coinbase::Client::ServerSignersApi
        • - #message - Coinbase::Client::Error + #submit_server_signer_signature_event_result + Coinbase::Client::ServerSignersApi
        • - #message - Coinbase::Client::ApiError + #submit_server_signer_signature_event_result_with_http_info + Coinbase::Client::ServerSignersApi
        • - #model - Coinbase::Wallet + supported? + Coinbase::Asset
        • - #model - Coinbase::FaucetTransaction + #temp_folder_path + Coinbase::Client::Configuration
        • - #native_asset - Coinbase::Network + #terminal_state? + Coinbase::Transfer
        • - #network_id - Coinbase::Transfer + #timeout + Coinbase::Client::Configuration
        • - #network_id - Coinbase::Client::Asset + #to_amount + Coinbase::Client::Trade
        • - #network_id - Coinbase::Address + #to_asset + Coinbase::Client::Trade
        • - #network_id - Coinbase::Client::CreateTransferRequest + #to_asset_id + Coinbase::Client::CreateTradeRequest
        • - #network_id + to_atomic_amount Coinbase::Asset
        • @@ -2974,23 +5614,23 @@

          Method List

        • - #network_id - Coinbase::Client::Address + #to_body + Coinbase::Client::Wallet
        • - #network_id - Coinbase::Client::Wallet + #to_body + Coinbase::Client::WalletList
        • - #network_id + #to_body Coinbase::Client::Transfer
        • @@ -2998,295 +5638,295 @@

          Method List

        • - #network_id - Coinbase::Wallet + #to_body + Coinbase::Client::AddressList
        • - #next_page - Coinbase::Client::AddressList + #to_body + Coinbase::Client::ServerSigner
        • - #next_page - Coinbase::Client::AddressBalanceList + #to_body + Coinbase::Client::Balance
        • - #next_page - Coinbase::Client::WalletList + #to_body + Coinbase::Client::TransferList
        • - #next_page - Coinbase::Client::TransferList + #to_body + Coinbase::Client::Address
        • - #object_to_hash - Coinbase::Client::ApiClient + #to_body + Coinbase::Client::FaucetTransaction
        • - #object_to_http_body - Coinbase::Client::ApiClient + #to_body + Coinbase::Client::SeedCreationEvent
        • - openapi_nullable - Coinbase::Client::BroadcastTransferRequest + #to_body + Coinbase::Client::ServerSignerEvent
        • - openapi_nullable - Coinbase::Client::TransferList + #to_body + Coinbase::Client::AddressBalanceList
        • - openapi_nullable - Coinbase::Client::AddressList + #to_body + Coinbase::Client::Trade
        • - openapi_nullable - Coinbase::Client::User + #to_body + Coinbase::Client::CreateTradeRequest
        • - openapi_nullable - Coinbase::Client::Transfer + #to_body + Coinbase::Client::CreateWalletRequest
        • - openapi_nullable - Coinbase::Client::CreateAddressRequest + #to_body + Coinbase::Client::Error
        • - openapi_nullable - Coinbase::Client::WalletList + #to_body + Coinbase::Client::CreateAddressRequest
        • - openapi_nullable - Coinbase::Client::Wallet + #to_body + Coinbase::Client::Asset
        • - openapi_nullable - Coinbase::Client::Asset + #to_body + Coinbase::Client::BroadcastTradeRequest
        • - openapi_nullable - Coinbase::Client::Balance + #to_body + Coinbase::Client::User
        • - openapi_nullable - Coinbase::Client::Address + #to_body + Coinbase::Client::CreateTransferRequest
        • - openapi_nullable - Coinbase::Client::CreateWalletRequest + #to_body + Coinbase::Client::ServerSignerEventList
        • - openapi_nullable - Coinbase::Client::CreateTransferRequest + #to_body + Coinbase::Client::SignatureCreationEvent
        • - openapi_nullable - Coinbase::Client::AddressBalanceList + #to_body + Coinbase::Client::BroadcastTransferRequest
        • - openapi_nullable - Coinbase::Client::Error + #to_body + Coinbase::Client::SeedCreationEventResult
        • - openapi_nullable - Coinbase::Client::FaucetTransaction + #to_body + Coinbase::Client::CreateServerSignerRequest
        • - openapi_types - Coinbase::Client::TransferList + #to_body + Coinbase::Client::SignatureCreationEventResult
        • - openapi_types - Coinbase::Client::User + #to_body + Coinbase::Client::CreateWalletRequestWallet
        • - openapi_types - Coinbase::Client::BroadcastTransferRequest + #to_body + Coinbase::Client::TradeList
        • - openapi_types - Coinbase::Client::Asset + #to_body + Coinbase::Client::Transaction
        • - openapi_types - Coinbase::Client::Error + #to_hash + Coinbase::Client::ServerSignerEventList
        • - openapi_types - Coinbase::Client::Wallet + #to_hash + Coinbase::Client::WalletList
        • - openapi_types - Coinbase::Client::Address + #to_hash + Coinbase::Client::Transfer
        • - openapi_types - Coinbase::Client::Balance + #to_hash + Coinbase::Client::BroadcastTransferRequest
        • - openapi_types - Coinbase::Client::Transfer + #to_hash + Coinbase::Client::Asset
        • - openapi_types - Coinbase::Client::WalletList + #to_hash + Coinbase::Client::Trade
        • - openapi_types - Coinbase::Client::AddressList + #to_hash + Coinbase::Client::User
        • - openapi_types - Coinbase::Client::FaucetTransaction + #to_hash + Coinbase::Client::CreateAddressRequest
        • - openapi_types - Coinbase::Client::AddressBalanceList + #to_hash + Coinbase::Client::BroadcastTradeRequest
        • - openapi_types + #to_hash Coinbase::Client::CreateWalletRequest
        • @@ -3294,423 +5934,423 @@

          Method List

        • - openapi_types - Coinbase::Client::CreateAddressRequest + #to_hash + Coinbase::Client::AddressBalanceList
        • - openapi_types - Coinbase::Client::CreateTransferRequest + #to_hash + Coinbase::Client::SeedCreationEvent
        • - #operation_server_settings - Coinbase::Client::Configuration + #to_hash + Coinbase::Client::CreateTransferRequest
        • - #params_encoder - Coinbase::Client::Configuration + #to_hash + Coinbase::Client::CreateTradeRequest
        • - #password - Coinbase::Client::Configuration + #to_hash + Coinbase::Client::TransferList
        • - primary_denomination - Coinbase::Asset + #to_hash + Coinbase::Client::Error
        • - #proxy - Coinbase::Client::Configuration + #to_hash + Coinbase::Client::SignatureCreationEventResult
        • - #public_key - Coinbase::Client::CreateAddressRequest + #to_hash + Coinbase::Client::SignatureCreationEvent
        • - #public_key - Coinbase::Client::Address + #to_hash + Coinbase::Client::Transaction
        • - #request - Coinbase::Client::Configuration + #to_hash + Coinbase::Client::Wallet
        • - #request_faucet_funds - Coinbase::Client::AddressesApi + #to_hash + Coinbase::Client::ServerSignerEvent
        • - #request_faucet_funds_with_http_info - Coinbase::Client::AddressesApi + #to_hash + Coinbase::Client::Balance
        • - #response - Coinbase::Client::Configuration + #to_hash + Coinbase::Client::CreateServerSignerRequest
        • - #response_body - Coinbase::Client::ApiError + #to_hash + Coinbase::Wallet::Data
        • - #response_headers - Coinbase::Client::ApiError + #to_hash + Coinbase::Client::ServerSigner
        • - #return_binary_data - Coinbase::Client::Configuration + #to_hash + Coinbase::Client::TradeList
        • - #sanitize_filename - Coinbase::Client::ApiClient + #to_hash + Coinbase::Client::CreateWalletRequestWallet
        • - #save_wallet_locally! - Coinbase::User + #to_hash + Coinbase::Client::AddressList
        • - #scheme - Coinbase::Client::Configuration + #to_hash + Coinbase::Client::SeedCreationEventResult
        • - #seed - Coinbase::Wallet::Data + #to_hash + Coinbase::Client::FaucetTransaction
        • - #seed= - Coinbase::Wallet + #to_hash + Coinbase::Client::Address
        • - #select_header_accept - Coinbase::Client::ApiClient + #to_s + Coinbase::Client::Transfer
        • - #select_header_content_type - Coinbase::Client::ApiClient + #to_s + Coinbase::Client::Balance
        • - #server_index - Coinbase::Client::Configuration + #to_s + Coinbase::Wallet
        • - #server_operation_index - Coinbase::Client::Configuration + #to_s + Coinbase::Client::CreateServerSignerRequest
        • - #server_operation_variables - Coinbase::Client::Configuration + #to_s + Coinbase::Client::WalletList
        • - #server_settings - Coinbase::Client::Configuration + #to_s + Coinbase::Client::ServerSigner
        • - #server_url - Coinbase::Client::Configuration + #to_s + Coinbase::Client::CreateTradeRequest
        • - #server_variables - Coinbase::Client::Configuration + #to_s + Coinbase::APIError
        • - #set_faraday_middleware - Coinbase::Client::Configuration + #to_s + Coinbase::Client::ServerSignerEventList
        • - #signed_payload - Coinbase::Client::BroadcastTransferRequest + #to_s + Coinbase::Asset
        • - #signed_payload - Coinbase::Transfer + #to_s + Coinbase::Client::CreateWalletRequestWallet
        • - #signed_payload - Coinbase::Client::Transfer + #to_s + Coinbase::Client::AddressList
        • - #ssl_ca_file - Coinbase::Client::Configuration + #to_s + Coinbase::Client::CreateTransferRequest
        • - #ssl_client_cert - Coinbase::Client::Configuration + #to_s + Coinbase::Client::Trade
        • - #ssl_client_key - Coinbase::Client::Configuration + #to_s + Coinbase::Client::Asset
        • - #ssl_options - Coinbase::Client::ApiClient + #to_s + Coinbase::Client::ApiError
        • - #ssl_verify - Coinbase::Client::Configuration + #to_s + Coinbase::Client::Transaction
        • - #ssl_verify_mode - Coinbase::Client::Configuration + #to_s + Coinbase::BalanceMap
        • - #status - Coinbase::Transfer + #to_s + Coinbase::Client::AddressBalanceList
        • - #status - Coinbase::Client::Transfer + #to_s + Coinbase::User
        • - supported? - Coinbase::Asset + #to_s + Coinbase::Client::Error
        • - #temp_folder_path - Coinbase::Client::Configuration + #to_s + Coinbase::Transfer
        • - #timeout - Coinbase::Client::Configuration + #to_s + Coinbase::FaucetTransaction
        • - to_atomic_amount - Coinbase::Asset + #to_s + Coinbase::Client::ServerSignerEvent
        • - #to_body - Coinbase::Client::FaucetTransaction + #to_s + Coinbase::Client::SignatureCreationEvent
        • - #to_body - Coinbase::Client::CreateWalletRequest + #to_s + Coinbase::Client::SeedCreationEvent
        • - #to_body - Coinbase::Client::Address + #to_s + Coinbase::Client::CreateWalletRequest
        • - #to_body - Coinbase::Client::CreateTransferRequest + #to_s + Coinbase::Client::TradeList
        • - #to_body - Coinbase::Client::Transfer + #to_s + Coinbase::Client::BroadcastTradeRequest
        • - #to_body - Coinbase::Client::TransferList + #to_s + Coinbase::Client::BroadcastTransferRequest
        • - #to_body - Coinbase::Client::Balance + #to_s + Coinbase::Client::FaucetTransaction
        • - #to_body + #to_s Coinbase::Client::Wallet
        • @@ -3718,95 +6358,95 @@

          Method List

        • - #to_body - Coinbase::Client::CreateAddressRequest + #to_s + Coinbase::Balance
        • - #to_body - Coinbase::Client::User + #to_s + Coinbase::Address
        • - #to_body - Coinbase::Client::AddressList + #to_s + Coinbase::Client::SeedCreationEventResult
        • - #to_body - Coinbase::Client::WalletList + #to_s + Coinbase::Client::User
        • - #to_body - Coinbase::Client::Error + #to_s + Coinbase::Client::Address
        • - #to_body - Coinbase::Client::Asset + #to_s + Coinbase::Client::TransferList
        • - #to_body - Coinbase::Client::BroadcastTransferRequest + #to_s + Coinbase::Client::SignatureCreationEventResult
        • - #to_body - Coinbase::Client::AddressBalanceList + #to_s + Coinbase::Client::CreateAddressRequest
        • - #to_hash - Coinbase::Client::Error + to_sym + Coinbase
        • - #to_hash - Coinbase::Client::WalletList + #total_count + Coinbase::Client::TradeList
        • - #to_hash - Coinbase::Client::Transfer + #total_count + Coinbase::Client::ServerSignerEventList
        • - #to_hash + #total_count Coinbase::Client::AddressList
        • @@ -3814,688 +6454,688 @@

          Method List

        • - #to_hash - Coinbase::Wallet::Data + #total_count + Coinbase::Client::WalletList
        • - #to_hash - Coinbase::Client::Wallet + #total_count + Coinbase::Client::AddressBalanceList
        • - #to_hash - Coinbase::Client::CreateAddressRequest + #total_count + Coinbase::Client::TransferList
        • - #to_hash - Coinbase::Client::CreateWalletRequest + #trade_id + Coinbase::Client::Trade
        • - #to_hash - Coinbase::Client::AddressBalanceList + #transaction + Coinbase::Client::Trade
        • - #to_hash - Coinbase::Client::CreateTransferRequest + #transaction + Coinbase::Transfer
        • - #to_hash - Coinbase::Client::Balance + #transaction_hash + Coinbase::Client::FaucetTransaction
        • - #to_hash - Coinbase::Client::BroadcastTransferRequest + #transaction_hash + Coinbase::FaucetTransaction
        • - #to_hash - Coinbase::Client::TransferList + #transaction_hash + Coinbase::Client::Transfer
        • - #to_hash - Coinbase::Client::FaucetTransaction + #transaction_hash + Coinbase::Client::Transaction
        • - #to_hash - Coinbase::Client::User + #transaction_hash + Coinbase::Transfer
        • - #to_hash - Coinbase::Client::Asset + #transaction_id + Coinbase::Client::SignatureCreationEvent
        • - #to_hash - Coinbase::Client::Address + #transaction_id + Coinbase::Client::SignatureCreationEventResult
        • - #to_s - Coinbase::Client::TransferList + #transaction_link + Coinbase::Transfer
        • - #to_s - Coinbase::Address + #transaction_link + Coinbase::FaucetTransaction
        • - #to_s - Coinbase::Client::Transfer + #transaction_type + Coinbase::Client::SignatureCreationEventResult
        • - #to_s - Coinbase::User + #transaction_type + Coinbase::Client::SignatureCreationEvent
        • - #to_s - Coinbase::Client::AddressList + #transfer + Coinbase::Address
        • - #to_s - Coinbase::Client::Balance + #transfer + Coinbase::Wallet
        • - #to_s - Coinbase::Client::Address + #transfer_id + Coinbase::Client::Transfer
        • - #to_s - Coinbase::Asset + #transfers + Coinbase::Address
        • - #to_s - Coinbase::Client::Wallet + #transfers_api + Coinbase::Transfer
        • - #to_s - Coinbase::Client::FaucetTransaction + #unsigned_payload + Coinbase::Transfer
        • - #to_s - Coinbase::Client::BroadcastTransferRequest + #unsigned_payload + Coinbase::Client::Transaction
        • - #to_s - Coinbase::Client::AddressBalanceList + #unsigned_payload + Coinbase::Client::Transfer
        • - #to_s - Coinbase::Wallet + #update_params_for_auth! + Coinbase::Client::ApiClient
        • - #to_s - Coinbase::Client::Error + #use + Coinbase::Client::Configuration
        • - #to_s - Coinbase::Client::CreateWalletRequest + #use_server_signer + Coinbase::Client::CreateWalletRequestWallet
        • - #to_s - Coinbase::APIError + #use_server_signer + Coinbase::Configuration
        • - #to_s - Coinbase::Client::Asset + use_server_signer? + Coinbase
        • - #to_s - Coinbase::FaucetTransaction + #user_agent= + Coinbase::Client::ApiClient
        • - #to_s - Coinbase::Client::CreateAddressRequest + #username + Coinbase::Client::Configuration
        • - #to_s - Coinbase::Client::User + #valid? + Coinbase::Client::Transfer
        • - #to_s - Coinbase::Client::ApiError + #valid? + Coinbase::Client::CreateTransferRequest
        • - #to_s - Coinbase::BalanceMap + #valid? + Coinbase::Client::TradeList
        • - #to_s - Coinbase::Transfer + #valid? + Coinbase::Client::User
        • - #to_s - Coinbase::Client::CreateTransferRequest + #valid? + Coinbase::Client::Error
        • - #to_s - Coinbase::Balance + #valid? + Coinbase::Client::CreateAddressRequest
        • - #to_s - Coinbase::Client::WalletList + #valid? + Coinbase::Client::CreateWalletRequest
        • - to_sym - Coinbase + #valid? + Coinbase::Client::ServerSignerEventList
        • - #total_count - Coinbase::Client::WalletList + #valid? + Coinbase::Client::Trade
        • - #total_count - Coinbase::Client::AddressBalanceList + #valid? + Coinbase::Client::CreateTradeRequest
        • - #total_count - Coinbase::Client::TransferList + #valid? + Coinbase::Client::SignatureCreationEvent::EnumAttributeValidator
        • - #total_count - Coinbase::Client::AddressList + #valid? + Coinbase::Client::AddressBalanceList
        • - #transaction - Coinbase::Transfer + #valid? + Coinbase::Client::SignatureCreationEvent
        • - #transaction_hash - Coinbase::Client::FaucetTransaction + #valid? + Coinbase::Client::ServerSignerEvent
        • - #transaction_hash - Coinbase::Transfer + #valid? + Coinbase::Client::Wallet::EnumAttributeValidator
        • - #transaction_hash - Coinbase::Client::Transfer + #valid? + Coinbase::Client::SeedCreationEvent
        • - #transaction_hash - Coinbase::FaucetTransaction + #valid? + Coinbase::Client::SignatureCreationEventResult::EnumAttributeValidator
        • - #transaction_link - Coinbase::Transfer + #valid? + Coinbase::Client::BroadcastTransferRequest
        • - #transaction_link - Coinbase::FaucetTransaction + #valid? + Coinbase::Client::Wallet
        • - #transfer - Coinbase::Address + #valid? + Coinbase::Client::FaucetTransaction
        • - #transfer - Coinbase::Wallet + #valid? + Coinbase::Client::SeedCreationEventResult
        • - #transfer_id - Coinbase::Client::Transfer + #valid? + Coinbase::Client::Address
        • - #transfers - Coinbase::Address + #valid? + Coinbase::Client::Balance
        • - #unsigned_payload - Coinbase::Transfer + #valid? + Coinbase::Client::CreateServerSignerRequest
        • - #unsigned_payload - Coinbase::Client::Transfer + #valid? + Coinbase::Client::TransferList
        • - #update_params_for_auth! - Coinbase::Client::ApiClient + #valid? + Coinbase::Client::WalletList
        • - #use - Coinbase::Client::Configuration + #valid? + Coinbase::Client::ServerSigner
        • - #user_agent= - Coinbase::Client::ApiClient + #valid? + Coinbase::Client::CreateWalletRequestWallet
        • - #username - Coinbase::Client::Configuration + #valid? + Coinbase::Client::Transfer::EnumAttributeValidator
        • - #valid? - Coinbase::Client::Asset + #valid? + Coinbase::Client::Transaction::EnumAttributeValidator
        • - #valid? - Coinbase::Client::Wallet + #valid? + Coinbase::Client::SignatureCreationEventResult
        • - #valid? - Coinbase::Client::FaucetTransaction + #valid? + Coinbase::Client::AddressList
        • - #valid? - Coinbase::Client::User + #valid? + Coinbase::Client::Transaction
        • - #valid? - Coinbase::Client::Address + #valid? + Coinbase::Client::Asset
        • - #valid? - Coinbase::Client::Transfer::EnumAttributeValidator + #valid? + Coinbase::Client::BroadcastTradeRequest
        • - #valid? - Coinbase::Client::CreateTransferRequest + #wait! + Coinbase::Transfer
        • - #valid? - Coinbase::Client::TransferList + #wallet + Coinbase::Client::CreateWalletRequest
        • - #valid? - Coinbase::Client::BroadcastTransferRequest + #wallet + Coinbase::User
        • - #valid? - Coinbase::Client::AddressList + #wallet_id + Coinbase::Client::Address
        • - #valid? - Coinbase::Client::WalletList + #wallet_id + Coinbase::Client::SeedCreationEventResult
        • - #valid? - Coinbase::Client::Transfer + #wallet_id + Coinbase::Client::SeedCreationEvent
        • - #valid? - Coinbase::Client::Balance + #wallet_id + Coinbase::Transfer
        • - #valid? - Coinbase::Client::CreateWalletRequest + #wallet_id + Coinbase::Client::SignatureCreationEvent
        • - #valid? - Coinbase::Client::Error + #wallet_id + Coinbase::Wallet::Data
        • - #valid? - Coinbase::Client::AddressBalanceList + #wallet_id + Coinbase::Address
        • - #valid? - Coinbase::Client::CreateAddressRequest + #wallet_id + Coinbase::Client::Trade
        • - #wait! - Coinbase::Transfer + #wallet_id + Coinbase::Client::SignatureCreationEventResult
        • - #wallet - Coinbase::Client::CreateWalletRequest + #wallet_id + Coinbase::Client::Transfer
        • - #wallet_id - Coinbase::Transfer + #wallet_user_id + Coinbase::Client::SignatureCreationEvent
        • - #wallet_id - Coinbase::Client::Transfer + #wallet_user_id + Coinbase::Client::SignatureCreationEventResult
        • - #wallet_id - Coinbase::Address + #wallet_user_id + Coinbase::Client::SeedCreationEvent
        • - #wallet_id - Coinbase::Client::Address + #wallet_user_id + Coinbase::Client::SeedCreationEventResult
        • - #wallet_id - Coinbase::Wallet::Data + #wallets + Coinbase::User
        • - #wallets - Coinbase::User + #wallets + Coinbase::Client::ServerSigner
        • diff --git a/lib/coinbase.rb b/lib/coinbase.rb index 5031bd40..9db31c64 100644 --- a/lib/coinbase.rb +++ b/lib/coinbase.rb @@ -27,27 +27,33 @@ def self.configuration end # Configures the Coinbase SDK. + # @return [String] A string indicating successful configuration def self.configure yield(configuration) raise InvalidConfiguration, 'API key private key is not set' unless configuration.api_key_private_key raise InvalidConfiguration, 'API key name is not set' unless configuration.api_key_name + + 'Successfully configured Coinbase SDK' end # Configures the Coinbase SDK from the given CDP API Key JSON file. # @param file_path [String] (Optional) the path to the CDP API Key JSON file # file in the root directory by default. - def self.configure_from_json(file_path = 'coinbase_cloud_api_key.json') + # @return [String] A string indicating successful configuration + def self.configure_from_json(file_path = 'cdp_api_key.json') configuration.from_json(file_path) raise InvalidConfiguration, 'API key private key is not set' unless configuration.api_key_private_key raise InvalidConfiguration, 'API key name is not set' unless configuration.api_key_name + + 'Successfully configured Coinbase SDK' end # Configuration object for the Coinbase SDK. class Configuration attr_reader :base_sepolia_rpc_url, :base_sepolia_client - attr_accessor :api_url, :api_key_name, :api_key_private_key, :debug_api, :backup_file_path + attr_accessor :api_url, :api_key_name, :api_key_private_key, :debug_api, :use_server_signer # Initializes the configuration object. def initialize @@ -55,13 +61,13 @@ def initialize @base_sepolia_client = Jimson::Client.new(@base_sepolia_rpc_url) @api_url = 'https://api.cdp.coinbase.com' @debug_api = false - @backup_file_path = 'seeds.json' + @use_server_signer = false end # Sets configuration values based on the provided CDP API Key JSON file. # @param file_path [String] (Optional) the path to the CDP API Key JSON file # file in the root directory by default. - def from_json(file_path = 'coinbase_cloud_api_key.json') + def from_json(file_path = 'cdp_api_key.json') # Expand paths to respect shortcuts like ~. file_path = File.expand_path(file_path) @@ -117,4 +123,10 @@ def self.call_api rescue StandardError => e raise e end + + # Returns whether to use a server signer to manage private keys. + # @return [bool] whether to use a server signer to manage private keys. + def self.use_server_signer? + Coinbase.configuration.use_server_signer + end end diff --git a/lib/coinbase/address.rb b/lib/coinbase/address.rb index 86c718aa..1bcd2f35 100644 --- a/lib/coinbase/address.rb +++ b/lib/coinbase/address.rb @@ -71,59 +71,26 @@ def balance(asset_id) Coinbase::Balance.from_model_and_asset_id(response, asset_id).amount end - # Transfers the given amount of the given Asset to the given address. Only same-Network Transfers are supported. + # Transfers the given amount of the given Asset to the specified address or wallet. + # Only same-network Transfers are supported. # @param amount [Integer, Float, BigDecimal] The amount of the Asset to send. # @param asset_id [Symbol] The ID of the Asset to send. For Ether, :eth, :gwei, and :wei are supported. # @param destination [Wallet | Address | String] The destination of the transfer. If a Wallet, sends to the Wallet's # default address. If a String, interprets it as the address ID. # @return [String] The hash of the Transfer transaction. def transfer(amount, asset_id, destination) - raise 'Cannot transfer from address without private key loaded' if @key.nil? + destination_address, destination_network = destination_address_and_network(destination) - raise ArgumentError, "Unsupported asset: #{asset_id}" unless Coinbase::Asset.supported?(asset_id) - - if destination.is_a?(Wallet) - raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id + validate_can_transfer!(amount, asset_id, destination_network) - destination = destination.default_address.id - elsif destination.is_a?(Address) - raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id + transfer = create_transfer(amount, asset_id, destination_address) - destination = destination.id - end - - current_balance = balance(asset_id) - if current_balance < amount - raise ArgumentError, "Insufficient funds: #{amount} requested, but only #{current_balance} available" - end - - create_transfer_request = { - amount: Coinbase::Asset.to_atomic_amount(amount, asset_id).to_i.to_s, - network_id: network_id, - asset_id: Coinbase::Asset.primary_denomination(asset_id).to_s, - destination: destination - } - - transfer_model = Coinbase.call_api do - transfers_api.create_transfer(wallet_id, id, create_transfer_request) - end + # If a server signer is managing keys, it will sign and broadcast the underlying transfer transaction out of band. + return transfer if Coinbase.use_server_signer? - transfer = Coinbase::Transfer.new(transfer_model) + signed_payload = sign_transfer(transfer) - transaction = transfer.transaction - transaction.sign(@key) - - signed_payload = transaction.hex - - broadcast_transfer_request = { - signed_payload: signed_payload - } - - transfer_model = Coinbase.call_api do - transfers_api.broadcast_transfer(wallet_id, id, transfer.id, broadcast_transfer_request) - end - - Coinbase::Transfer.new(transfer_model) + broadcast_transfer(transfer, signed_payload) end # Returns whether the Address has a private key backing it to sign transactions. @@ -170,12 +137,13 @@ def transfers page = nil loop do - puts "fetch transfers page: #{page}" response = Coinbase.call_api do transfers_api.list_transfers(wallet_id, id, { limit: 100, page: page }) end - transfers.concat(response.data.map { |transfer| Coinbase::Transfer.new(transfer) }) if response.data + break if response.data.empty? + + transfers.concat(response.data.map { |transfer| Coinbase::Transfer.new(transfer) }) break unless response.has_more @@ -194,5 +162,56 @@ def addresses_api def transfers_api @transfers_api ||= Coinbase::Client::TransfersApi.new(Coinbase.configuration.api_client) end + + def destination_address_and_network(destination) + return [destination.default_address.id, destination.network_id] if destination.is_a?(Wallet) + return [destination.id, destination.network_id] if destination.is_a?(Address) + + [destination, network_id] + end + + def validate_can_transfer!(amount, asset_id, destination_network_id) + raise 'Cannot transfer from address without private key loaded' unless can_sign? || Coinbase.use_server_signer? + + raise ArgumentError, "Unsupported asset: #{asset_id}" unless Coinbase::Asset.supported?(asset_id) + + raise ArgumentError, 'Transfer must be on the same Network' unless destination_network_id == network_id + + current_balance = balance(asset_id) + + return unless current_balance < amount + + raise ArgumentError, "Insufficient funds: #{amount} requested, but only #{current_balance} available" + end + + def create_transfer(amount, asset_id, destination) + create_transfer_request = { + amount: Coinbase::Asset.to_atomic_amount(amount, asset_id).to_i.to_s, + network_id: network_id, + asset_id: Coinbase::Asset.primary_denomination(asset_id).to_s, + destination: destination + } + + transfer_model = Coinbase.call_api do + transfers_api.create_transfer(wallet_id, id, create_transfer_request) + end + + Coinbase::Transfer.new(transfer_model) + end + + def sign_transfer(transfer) + transaction = transfer.transaction + transaction.sign(@key) + + transaction.hex + end + + def broadcast_transfer(transfer, signed_payload) + transfer_model = Coinbase.call_api do + transfers_api.broadcast_transfer(wallet_id, id, transfer.id, { signed_payload: signed_payload }) + end + + Coinbase::Transfer.new(transfer_model) + end end end diff --git a/lib/coinbase/authenticator.rb b/lib/coinbase/authenticator.rb index 1eb90a6a..d4221686 100644 --- a/lib/coinbase/authenticator.rb +++ b/lib/coinbase/authenticator.rb @@ -38,7 +38,7 @@ def build_jwt(uri) claims = { sub: Coinbase.configuration.api_key_name, - iss: 'coinbase-cloud', + iss: 'cdp', aud: ['cdp_service'], nbf: Time.now.to_i, exp: Time.now.to_i + 60, # Expiration time: 1 minute from now. diff --git a/lib/coinbase/client.rb b/lib/coinbase/client.rb index 77db6167..a674082c 100644 --- a/lib/coinbase/client.rb +++ b/lib/coinbase/client.rb @@ -22,12 +22,28 @@ Coinbase::Client.autoload :AddressList, 'coinbase/client/models/address_list' Coinbase::Client.autoload :Asset, 'coinbase/client/models/asset' Coinbase::Client.autoload :Balance, 'coinbase/client/models/balance' +Coinbase::Client.autoload :BroadcastTradeRequest, 'coinbase/client/models/broadcast_trade_request' Coinbase::Client.autoload :BroadcastTransferRequest, 'coinbase/client/models/broadcast_transfer_request' Coinbase::Client.autoload :CreateAddressRequest, 'coinbase/client/models/create_address_request' +Coinbase::Client.autoload :CreateServerSignerRequest, 'coinbase/client/models/create_server_signer_request' +Coinbase::Client.autoload :CreateTradeRequest, 'coinbase/client/models/create_trade_request' 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 :Error, 'coinbase/client/models/error' Coinbase::Client.autoload :FaucetTransaction, 'coinbase/client/models/faucet_transaction' +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' +Coinbase::Client.autoload :ServerSignerEvent, 'coinbase/client/models/server_signer_event' +Coinbase::Client.autoload :ServerSignerEventEvent, 'coinbase/client/models/server_signer_event_event' +Coinbase::Client.autoload :ServerSignerEventList, 'coinbase/client/models/server_signer_event_list' +Coinbase::Client.autoload :SignatureCreationEvent, 'coinbase/client/models/signature_creation_event' +Coinbase::Client.autoload :SignatureCreationEventResult, 'coinbase/client/models/signature_creation_event_result' +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' +Coinbase::Client.autoload :TransactionType, 'coinbase/client/models/transaction_type' Coinbase::Client.autoload :Transfer, 'coinbase/client/models/transfer' Coinbase::Client.autoload :TransferList, 'coinbase/client/models/transfer_list' Coinbase::Client.autoload :User, 'coinbase/client/models/user' @@ -36,6 +52,8 @@ # APIs Coinbase::Client.autoload :AddressesApi, 'coinbase/client/api/addresses_api' +Coinbase::Client.autoload :ServerSignersApi, 'coinbase/client/api/server_signers_api' +Coinbase::Client.autoload :TradesApi, 'coinbase/client/api/trades_api' Coinbase::Client.autoload :TransfersApi, 'coinbase/client/api/transfers_api' Coinbase::Client.autoload :UsersApi, 'coinbase/client/api/users_api' Coinbase::Client.autoload :WalletsApi, 'coinbase/client/api/wallets_api' diff --git a/lib/coinbase/client/api/server_signers_api.rb b/lib/coinbase/client/api/server_signers_api.rb new file mode 100644 index 00000000..46c8fd7b --- /dev/null +++ b/lib/coinbase/client/api/server_signers_api.rb @@ -0,0 +1,419 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'cgi' + +module Coinbase::Client + class ServerSignersApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a new Server-Signer + # Create a new Server-Signer + # @param [Hash] opts the optional parameters + # @option opts [CreateServerSignerRequest] :create_server_signer_request + # @return [ServerSigner] + def create_server_signer(opts = {}) + data, _status_code, _headers = create_server_signer_with_http_info(opts) + data + end + + # Create a new Server-Signer + # Create a new Server-Signer + # @param [Hash] opts the optional parameters + # @option opts [CreateServerSignerRequest] :create_server_signer_request + # @return [Array<(ServerSigner, Integer, Hash)>] ServerSigner data, response status code and response headers + def create_server_signer_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServerSignersApi.create_server_signer ...' + end + # resource path + local_var_path = '/v1/server_signers' + + # 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']) + # 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[:'create_server_signer_request']) + + # return_type + return_type = opts[:debug_return_type] || 'ServerSigner' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"ServerSignersApi.create_server_signer", + :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: ServerSignersApi#create_server_signer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a server signer by ID + # Get a server signer by ID + # @param server_signer_id [String] The ID of the server signer to fetch + # @param [Hash] opts the optional parameters + # @return [ServerSigner] + def get_server_signer(server_signer_id, opts = {}) + data, _status_code, _headers = get_server_signer_with_http_info(server_signer_id, opts) + data + end + + # Get a server signer by ID + # Get a server signer by ID + # @param server_signer_id [String] The ID of the server signer to fetch + # @param [Hash] opts the optional parameters + # @return [Array<(ServerSigner, Integer, Hash)>] ServerSigner data, response status code and response headers + def get_server_signer_with_http_info(server_signer_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServerSignersApi.get_server_signer ...' + end + # verify the required parameter 'server_signer_id' is set + if @api_client.config.client_side_validation && server_signer_id.nil? + fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.get_server_signer" + end + # resource path + local_var_path = '/v1/server_signers/{server_signer_id}'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ServerSigner' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"ServerSignersApi.get_server_signer", + :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: ServerSignersApi#get_server_signer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List events for a server signer + # List events for a server signer + # @param server_signer_id [String] The ID of the server signer to fetch events for + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + # @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. + # @return [ServerSignerEventList] + def list_server_signer_events(server_signer_id, opts = {}) + data, _status_code, _headers = list_server_signer_events_with_http_info(server_signer_id, opts) + data + end + + # List events for a server signer + # List events for a server signer + # @param server_signer_id [String] The ID of the server signer to fetch events for + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + # @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. + # @return [Array<(ServerSignerEventList, Integer, Hash)>] ServerSignerEventList data, response status code and response headers + def list_server_signer_events_with_http_info(server_signer_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServerSignersApi.list_server_signer_events ...' + end + # verify the required parameter 'server_signer_id' is set + if @api_client.config.client_side_validation && server_signer_id.nil? + fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.list_server_signer_events" + end + if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000 + fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ServerSignersApi.list_server_signer_events, the character length must be smaller than or equal to 5000.' + end + + # resource path + local_var_path = '/v1/server_signers/{server_signer_id}/events'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ServerSignerEventList' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"ServerSignersApi.list_server_signer_events", + :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: ServerSignersApi#list_server_signer_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List server signers for the current project + # List server signers for the current project + # @param [Hash] opts the optional parameters + # @return [ServerSigner] + def list_server_signers(opts = {}) + data, _status_code, _headers = list_server_signers_with_http_info(opts) + data + end + + # List server signers for the current project + # List server signers for the current project + # @param [Hash] opts the optional parameters + # @return [Array<(ServerSigner, Integer, Hash)>] ServerSigner data, response status code and response headers + def list_server_signers_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServerSignersApi.list_server_signers ...' + end + # resource path + local_var_path = '/v1/server_signers' + + # 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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ServerSigner' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"ServerSignersApi.list_server_signers", + :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: ServerSignersApi#list_server_signers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Submit the result of a server signer event + # Submit the result of a server signer event + # @param server_signer_id [String] The ID of the server signer to submit the event result for + # @param [Hash] opts the optional parameters + # @option opts [SeedCreationEventResult] :seed_creation_event_result + # @return [SeedCreationEventResult] + def submit_server_signer_seed_event_result(server_signer_id, opts = {}) + data, _status_code, _headers = submit_server_signer_seed_event_result_with_http_info(server_signer_id, opts) + data + end + + # Submit the result of a server signer event + # Submit the result of a server signer event + # @param server_signer_id [String] The ID of the server signer to submit the event result for + # @param [Hash] opts the optional parameters + # @option opts [SeedCreationEventResult] :seed_creation_event_result + # @return [Array<(SeedCreationEventResult, Integer, Hash)>] SeedCreationEventResult data, response status code and response headers + def submit_server_signer_seed_event_result_with_http_info(server_signer_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServerSignersApi.submit_server_signer_seed_event_result ...' + end + # verify the required parameter 'server_signer_id' is set + if @api_client.config.client_side_validation && server_signer_id.nil? + fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.submit_server_signer_seed_event_result" + end + # resource path + local_var_path = '/v1/server_signers/{server_signer_id}/seed_event_result'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_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']) + # 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[:'seed_creation_event_result']) + + # return_type + return_type = opts[:debug_return_type] || 'SeedCreationEventResult' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"ServerSignersApi.submit_server_signer_seed_event_result", + :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: ServerSignersApi#submit_server_signer_seed_event_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Submit the result of a server signer event + # Submit the result of a server signer event + # @param server_signer_id [String] The ID of the server signer to submit the event result for + # @param [Hash] opts the optional parameters + # @option opts [SignatureCreationEventResult] :signature_creation_event_result + # @return [SignatureCreationEventResult] + def submit_server_signer_signature_event_result(server_signer_id, opts = {}) + data, _status_code, _headers = submit_server_signer_signature_event_result_with_http_info(server_signer_id, opts) + data + end + + # Submit the result of a server signer event + # Submit the result of a server signer event + # @param server_signer_id [String] The ID of the server signer to submit the event result for + # @param [Hash] opts the optional parameters + # @option opts [SignatureCreationEventResult] :signature_creation_event_result + # @return [Array<(SignatureCreationEventResult, Integer, Hash)>] SignatureCreationEventResult data, response status code and response headers + def submit_server_signer_signature_event_result_with_http_info(server_signer_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServerSignersApi.submit_server_signer_signature_event_result ...' + end + # verify the required parameter 'server_signer_id' is set + if @api_client.config.client_side_validation && server_signer_id.nil? + fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.submit_server_signer_signature_event_result" + end + # resource path + local_var_path = '/v1/server_signers/{server_signer_id}/signature_event_result'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_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']) + # 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[:'signature_creation_event_result']) + + # return_type + return_type = opts[:debug_return_type] || 'SignatureCreationEventResult' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"ServerSignersApi.submit_server_signer_signature_event_result", + :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: ServerSignersApi#submit_server_signer_signature_event_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/coinbase/client/api/trades_api.rb b/lib/coinbase/client/api/trades_api.rb new file mode 100644 index 00000000..58e8fdfc --- /dev/null +++ b/lib/coinbase/client/api/trades_api.rb @@ -0,0 +1,342 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'cgi' + +module Coinbase::Client + class TradesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Broadcast a trade + # Broadcast a trade + # @param wallet_id [String] The ID of the wallet the address belongs to + # @param address_id [String] The ID of the address the trade belongs to + # @param trade_id [String] The ID of the trade to broadcast + # @param broadcast_trade_request [BroadcastTradeRequest] + # @param [Hash] opts the optional parameters + # @return [Trade] + def broadcast_trade(wallet_id, address_id, trade_id, broadcast_trade_request, opts = {}) + data, _status_code, _headers = broadcast_trade_with_http_info(wallet_id, address_id, trade_id, broadcast_trade_request, opts) + data + end + + # Broadcast a trade + # Broadcast a trade + # @param wallet_id [String] The ID of the wallet the address belongs to + # @param address_id [String] The ID of the address the trade belongs to + # @param trade_id [String] The ID of the trade to broadcast + # @param broadcast_trade_request [BroadcastTradeRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(Trade, Integer, Hash)>] Trade data, response status code and response headers + def broadcast_trade_with_http_info(wallet_id, address_id, trade_id, broadcast_trade_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TradesApi.broadcast_trade ...' + 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 TradesApi.broadcast_trade" + 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 TradesApi.broadcast_trade" + end + # verify the required parameter 'trade_id' is set + if @api_client.config.client_side_validation && trade_id.nil? + fail ArgumentError, "Missing the required parameter 'trade_id' when calling TradesApi.broadcast_trade" + end + # verify the required parameter 'broadcast_trade_request' is set + if @api_client.config.client_side_validation && broadcast_trade_request.nil? + fail ArgumentError, "Missing the required parameter 'broadcast_trade_request' when calling TradesApi.broadcast_trade" + end + # resource path + local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/trades/{trade_id}/broadcast'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'trade_id' + '}', CGI.escape(trade_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']) + # 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(broadcast_trade_request) + + # return_type + return_type = opts[:debug_return_type] || 'Trade' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"TradesApi.broadcast_trade", + :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: TradesApi#broadcast_trade\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create a new trade for an address + # Create a new trade + # @param wallet_id [String] The ID of the wallet the source address belongs to + # @param address_id [String] The ID of the address to conduct the trade from + # @param create_trade_request [CreateTradeRequest] + # @param [Hash] opts the optional parameters + # @return [Trade] + def create_trade(wallet_id, address_id, create_trade_request, opts = {}) + data, _status_code, _headers = create_trade_with_http_info(wallet_id, address_id, create_trade_request, opts) + data + end + + # Create a new trade for an address + # Create a new trade + # @param wallet_id [String] The ID of the wallet the source address belongs to + # @param address_id [String] The ID of the address to conduct the trade from + # @param create_trade_request [CreateTradeRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(Trade, Integer, Hash)>] Trade data, response status code and response headers + def create_trade_with_http_info(wallet_id, address_id, create_trade_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TradesApi.create_trade ...' + 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 TradesApi.create_trade" + 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 TradesApi.create_trade" + end + # verify the required parameter 'create_trade_request' is set + if @api_client.config.client_side_validation && create_trade_request.nil? + fail ArgumentError, "Missing the required parameter 'create_trade_request' when calling TradesApi.create_trade" + end + # resource path + local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/trades'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_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']) + # 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(create_trade_request) + + # return_type + return_type = opts[:debug_return_type] || 'Trade' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"TradesApi.create_trade", + :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: TradesApi#create_trade\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a trade by ID + # Get a trade by ID + # @param wallet_id [String] The ID of the wallet the address belongs to + # @param address_id [String] The ID of the address the trade belongs to + # @param trade_id [String] The ID of the trade to fetch + # @param [Hash] opts the optional parameters + # @return [Trade] + def get_trade(wallet_id, address_id, trade_id, opts = {}) + data, _status_code, _headers = get_trade_with_http_info(wallet_id, address_id, trade_id, opts) + data + end + + # Get a trade by ID + # Get a trade by ID + # @param wallet_id [String] The ID of the wallet the address belongs to + # @param address_id [String] The ID of the address the trade belongs to + # @param trade_id [String] The ID of the trade to fetch + # @param [Hash] opts the optional parameters + # @return [Array<(Trade, Integer, Hash)>] Trade data, response status code and response headers + def get_trade_with_http_info(wallet_id, address_id, trade_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TradesApi.get_trade ...' + 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 TradesApi.get_trade" + 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 TradesApi.get_trade" + end + # verify the required parameter 'trade_id' is set + if @api_client.config.client_side_validation && trade_id.nil? + fail ArgumentError, "Missing the required parameter 'trade_id' when calling TradesApi.get_trade" + end + # resource path + local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/trades/{trade_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'trade_id' + '}', CGI.escape(trade_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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Trade' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"TradesApi.get_trade", + :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: TradesApi#get_trade\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List trades for an address. + # List trades for an address. + # @param wallet_id [String] The ID of the wallet the address belongs to + # @param address_id [String] The ID of the address to list trades for + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + # @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. + # @return [TradeList] + def list_trades(wallet_id, address_id, opts = {}) + data, _status_code, _headers = list_trades_with_http_info(wallet_id, address_id, opts) + data + end + + # List trades for an address. + # List trades for an address. + # @param wallet_id [String] The ID of the wallet the address belongs to + # @param address_id [String] The ID of the address to list trades for + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + # @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. + # @return [Array<(TradeList, Integer, Hash)>] TradeList data, response status code and response headers + def list_trades_with_http_info(wallet_id, address_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TradesApi.list_trades ...' + 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 TradesApi.list_trades" + 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 TradesApi.list_trades" + end + if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000 + fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TradesApi.list_trades, the character length must be smaller than or equal to 5000.' + end + + # resource path + local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/trades'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TradeList' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"TradesApi.list_trades", + :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: TradesApi#list_trades\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/coinbase/client/models/broadcast_trade_request.rb b/lib/coinbase/client/models/broadcast_trade_request.rb new file mode 100644 index 00000000..f6cd7e7f --- /dev/null +++ b/lib/coinbase/client/models/broadcast_trade_request.rb @@ -0,0 +1,222 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + class BroadcastTradeRequest + # The hex-encoded signed payload of the trade + attr_accessor :signed_payload + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'signed_payload' => :'signed_payload' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'signed_payload' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::BroadcastTradeRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::BroadcastTradeRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'signed_payload') + self.signed_payload = attributes[:'signed_payload'] + else + self.signed_payload = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @signed_payload.nil? + invalid_properties.push('invalid value for "signed_payload", signed_payload cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @signed_payload.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + signed_payload == o.signed_payload + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [signed_payload].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/create_address_request.rb b/lib/coinbase/client/models/create_address_request.rb index 97f67a83..003cde45 100644 --- a/lib/coinbase/client/models/create_address_request.rb +++ b/lib/coinbase/client/models/create_address_request.rb @@ -65,14 +65,10 @@ def initialize(attributes = {}) if attributes.key?(:'public_key') self.public_key = attributes[:'public_key'] - else - self.public_key = nil end if attributes.key?(:'attestation') self.attestation = attributes[:'attestation'] - else - self.attestation = nil end end @@ -81,14 +77,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @public_key.nil? - invalid_properties.push('invalid value for "public_key", public_key cannot be nil.') - end - - if @attestation.nil? - invalid_properties.push('invalid value for "attestation", attestation cannot be nil.') - end - invalid_properties end @@ -96,8 +84,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @public_key.nil? - return false if @attestation.nil? true end diff --git a/lib/coinbase/client/models/create_server_signer_request.rb b/lib/coinbase/client/models/create_server_signer_request.rb new file mode 100644 index 00000000..36c8f73c --- /dev/null +++ b/lib/coinbase/client/models/create_server_signer_request.rb @@ -0,0 +1,239 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + class CreateServerSignerRequest + # The ID of the server signer + attr_accessor :server_signer_id + + # The enrollment data of the server signer. This will be the base64 encoded server-signer-id. + attr_accessor :enrollment_data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'server_signer_id' => :'server_signer_id', + :'enrollment_data' => :'enrollment_data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'server_signer_id' => :'String', + :'enrollment_data' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::CreateServerSignerRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::CreateServerSignerRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'server_signer_id') + self.server_signer_id = attributes[:'server_signer_id'] + else + self.server_signer_id = nil + end + + if attributes.key?(:'enrollment_data') + self.enrollment_data = attributes[:'enrollment_data'] + else + self.enrollment_data = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @server_signer_id.nil? + invalid_properties.push('invalid value for "server_signer_id", server_signer_id cannot be nil.') + end + + if @enrollment_data.nil? + invalid_properties.push('invalid value for "enrollment_data", enrollment_data cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @server_signer_id.nil? + return false if @enrollment_data.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + server_signer_id == o.server_signer_id && + enrollment_data == o.enrollment_data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [server_signer_id, enrollment_data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/create_trade_request.rb b/lib/coinbase/client/models/create_trade_request.rb new file mode 100644 index 00000000..71e20dee --- /dev/null +++ b/lib/coinbase/client/models/create_trade_request.rb @@ -0,0 +1,256 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + class CreateTradeRequest + # The amount to trade + attr_accessor :amount + + # The ID of the asset to trade + attr_accessor :from_asset_id + + # The ID of the asset to receive from the trade + attr_accessor :to_asset_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'from_asset_id' => :'from_asset_id', + :'to_asset_id' => :'to_asset_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'String', + :'from_asset_id' => :'String', + :'to_asset_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::CreateTradeRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::CreateTradeRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + else + self.amount = nil + end + + if attributes.key?(:'from_asset_id') + self.from_asset_id = attributes[:'from_asset_id'] + else + self.from_asset_id = nil + end + + if attributes.key?(:'to_asset_id') + self.to_asset_id = attributes[:'to_asset_id'] + else + self.to_asset_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @from_asset_id.nil? + invalid_properties.push('invalid value for "from_asset_id", from_asset_id cannot be nil.') + end + + if @to_asset_id.nil? + invalid_properties.push('invalid value for "to_asset_id", to_asset_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @amount.nil? + return false if @from_asset_id.nil? + return false if @to_asset_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + from_asset_id == o.from_asset_id && + to_asset_id == o.to_asset_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, from_asset_id, to_asset_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/create_wallet_request.rb b/lib/coinbase/client/models/create_wallet_request.rb index 06c5f445..69f18f79 100644 --- a/lib/coinbase/client/models/create_wallet_request.rb +++ b/lib/coinbase/client/models/create_wallet_request.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'wallet' => :'Wallet' + :'wallet' => :'CreateWalletRequestWallet' } end diff --git a/lib/coinbase/client/models/create_wallet_request_wallet.rb b/lib/coinbase/client/models/create_wallet_request_wallet.rb new file mode 100644 index 00000000..ba108937 --- /dev/null +++ b/lib/coinbase/client/models/create_wallet_request_wallet.rb @@ -0,0 +1,233 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # Parameters for configuring a wallet + class CreateWalletRequestWallet + # The ID of the blockchain network + attr_accessor :network_id + + # Whether the wallet should use the project's server signer or if the addresses in the wallets will belong to a private key the developer manages. Defaults to false. + attr_accessor :use_server_signer + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'network_id' => :'network_id', + :'use_server_signer' => :'use_server_signer' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'network_id' => :'String', + :'use_server_signer' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::CreateWalletRequestWallet` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::CreateWalletRequestWallet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'network_id') + self.network_id = attributes[:'network_id'] + else + self.network_id = nil + end + + if attributes.key?(:'use_server_signer') + self.use_server_signer = attributes[:'use_server_signer'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @network_id.nil? + invalid_properties.push('invalid value for "network_id", network_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @network_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + network_id == o.network_id && + use_server_signer == o.use_server_signer + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [network_id, use_server_signer].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/seed_creation_event.rb b/lib/coinbase/client/models/seed_creation_event.rb new file mode 100644 index 00000000..5256ad53 --- /dev/null +++ b/lib/coinbase/client/models/seed_creation_event.rb @@ -0,0 +1,240 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # An event representing a seed creation. + class SeedCreationEvent + # The ID of the wallet that the server-signer should create the seed for + attr_accessor :wallet_id + + # The ID of the user that the wallet belongs to + attr_accessor :wallet_user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'wallet_id' => :'wallet_id', + :'wallet_user_id' => :'wallet_user_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'wallet_id' => :'String', + :'wallet_user_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::SeedCreationEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::SeedCreationEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'wallet_id') + self.wallet_id = attributes[:'wallet_id'] + else + self.wallet_id = nil + end + + if attributes.key?(:'wallet_user_id') + self.wallet_user_id = attributes[:'wallet_user_id'] + else + self.wallet_user_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @wallet_id.nil? + invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.') + end + + if @wallet_user_id.nil? + invalid_properties.push('invalid value for "wallet_user_id", wallet_user_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @wallet_id.nil? + return false if @wallet_user_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + wallet_id == o.wallet_id && + wallet_user_id == o.wallet_user_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [wallet_id, wallet_user_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/seed_creation_event_result.rb b/lib/coinbase/client/models/seed_creation_event_result.rb new file mode 100644 index 00000000..bd1bf136 --- /dev/null +++ b/lib/coinbase/client/models/seed_creation_event_result.rb @@ -0,0 +1,274 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # The result to a SeedCreationEvent. + class SeedCreationEventResult + # The ID of the wallet that the seed was created for + attr_accessor :wallet_id + + # The ID of the user that the wallet belongs to + attr_accessor :wallet_user_id + + # The extended public key for the first master key derived from seed. + attr_accessor :extended_public_key + + # The ID of the seed in Server-Signer used to generate the extended public key. + attr_accessor :seed_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'wallet_id' => :'wallet_id', + :'wallet_user_id' => :'wallet_user_id', + :'extended_public_key' => :'extended_public_key', + :'seed_id' => :'seed_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'wallet_id' => :'String', + :'wallet_user_id' => :'String', + :'extended_public_key' => :'String', + :'seed_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::SeedCreationEventResult` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::SeedCreationEventResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'wallet_id') + self.wallet_id = attributes[:'wallet_id'] + else + self.wallet_id = nil + end + + if attributes.key?(:'wallet_user_id') + self.wallet_user_id = attributes[:'wallet_user_id'] + else + self.wallet_user_id = nil + end + + if attributes.key?(:'extended_public_key') + self.extended_public_key = attributes[:'extended_public_key'] + else + self.extended_public_key = nil + end + + if attributes.key?(:'seed_id') + self.seed_id = attributes[:'seed_id'] + else + self.seed_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @wallet_id.nil? + invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.') + end + + if @wallet_user_id.nil? + invalid_properties.push('invalid value for "wallet_user_id", wallet_user_id cannot be nil.') + end + + if @extended_public_key.nil? + invalid_properties.push('invalid value for "extended_public_key", extended_public_key cannot be nil.') + end + + if @seed_id.nil? + invalid_properties.push('invalid value for "seed_id", seed_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @wallet_id.nil? + return false if @wallet_user_id.nil? + return false if @extended_public_key.nil? + return false if @seed_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + wallet_id == o.wallet_id && + wallet_user_id == o.wallet_user_id && + extended_public_key == o.extended_public_key && + seed_id == o.seed_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [wallet_id, wallet_user_id, extended_public_key, seed_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/server_signer.rb b/lib/coinbase/client/models/server_signer.rb new file mode 100644 index 00000000..3ebcff38 --- /dev/null +++ b/lib/coinbase/client/models/server_signer.rb @@ -0,0 +1,235 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # A Server-Signer assigned to sign transactions in a wallet. + class ServerSigner + # The ID of the server-signer + attr_accessor :server_signer_id + + # The IDs of the wallets that the server-signer can sign for + attr_accessor :wallets + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'server_signer_id' => :'server_signer_id', + :'wallets' => :'wallets' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'server_signer_id' => :'String', + :'wallets' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::ServerSigner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::ServerSigner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'server_signer_id') + self.server_signer_id = attributes[:'server_signer_id'] + else + self.server_signer_id = nil + end + + if attributes.key?(:'wallets') + if (value = attributes[:'wallets']).is_a?(Array) + self.wallets = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @server_signer_id.nil? + invalid_properties.push('invalid value for "server_signer_id", server_signer_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @server_signer_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + server_signer_id == o.server_signer_id && + wallets == o.wallets + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [server_signer_id, wallets].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/server_signer_event.rb b/lib/coinbase/client/models/server_signer_event.rb new file mode 100644 index 00000000..bd6a5306 --- /dev/null +++ b/lib/coinbase/client/models/server_signer_event.rb @@ -0,0 +1,239 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # An event that is waiting to be processed by a Server-Signer. + class ServerSignerEvent + # The ID of the server-signer that the event is for + attr_accessor :server_signer_id + + attr_accessor :event + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'server_signer_id' => :'server_signer_id', + :'event' => :'event' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'server_signer_id' => :'String', + :'event' => :'ServerSignerEventEvent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::ServerSignerEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::ServerSignerEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'server_signer_id') + self.server_signer_id = attributes[:'server_signer_id'] + else + self.server_signer_id = nil + end + + if attributes.key?(:'event') + self.event = attributes[:'event'] + else + self.event = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @server_signer_id.nil? + invalid_properties.push('invalid value for "server_signer_id", server_signer_id cannot be nil.') + end + + if @event.nil? + invalid_properties.push('invalid value for "event", event cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @server_signer_id.nil? + return false if @event.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + server_signer_id == o.server_signer_id && + event == o.event + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [server_signer_id, event].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/server_signer_event_event.rb b/lib/coinbase/client/models/server_signer_event_event.rb new file mode 100644 index 00000000..e9b194e7 --- /dev/null +++ b/lib/coinbase/client/models/server_signer_event_event.rb @@ -0,0 +1,105 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + module ServerSignerEventEvent + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'SeedCreationEvent', + :'SignatureCreationEvent' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = Coinbase::Client.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/coinbase/client/models/server_signer_event_list.rb b/lib/coinbase/client/models/server_signer_event_list.rb new file mode 100644 index 00000000..1dfe11bf --- /dev/null +++ b/lib/coinbase/client/models/server_signer_event_list.rb @@ -0,0 +1,275 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # + class ServerSignerEventList + attr_accessor :data + + # True if this list has another page of items after this one that can be fetched. + attr_accessor :has_more + + # The page token to be used to fetch the next page. + attr_accessor :next_page + + # The total number of events for the server signer. + attr_accessor :total_count + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'has_more' => :'has_more', + :'next_page' => :'next_page', + :'total_count' => :'total_count' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array', + :'has_more' => :'Boolean', + :'next_page' => :'String', + :'total_count' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::ServerSignerEventList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::ServerSignerEventList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + else + self.data = nil + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + else + self.has_more = nil + end + + if attributes.key?(:'next_page') + self.next_page = attributes[:'next_page'] + else + self.next_page = nil + end + + if attributes.key?(:'total_count') + self.total_count = attributes[:'total_count'] + else + self.total_count = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @data.nil? + invalid_properties.push('invalid value for "data", data cannot be nil.') + end + + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @next_page.nil? + invalid_properties.push('invalid value for "next_page", next_page cannot be nil.') + end + + if @total_count.nil? + invalid_properties.push('invalid value for "total_count", total_count cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @data.nil? + return false if @has_more.nil? + return false if @next_page.nil? + return false if @total_count.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + has_more == o.has_more && + next_page == o.next_page && + total_count == o.total_count + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, has_more, next_page, total_count].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/signature_creation_event.rb b/lib/coinbase/client/models/signature_creation_event.rb new file mode 100644 index 00000000..0efd71fd --- /dev/null +++ b/lib/coinbase/client/models/signature_creation_event.rb @@ -0,0 +1,363 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # An event representing a signature creation. + class SignatureCreationEvent + # The ID of the seed that the server-signer should create the signature for + attr_accessor :seed_id + + # The ID of the wallet the signature is for + attr_accessor :wallet_id + + # The ID of the user that the wallet belongs to + attr_accessor :wallet_user_id + + # The ID of the address the transfer belongs to + attr_accessor :address_id + + # The index of the address that the server-signer should sign with + attr_accessor :address_index + + # The payload that the server-signer should sign + attr_accessor :signing_payload + + attr_accessor :transaction_type + + # The ID of the transaction that the server-signer should sign + attr_accessor :transaction_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'seed_id' => :'seed_id', + :'wallet_id' => :'wallet_id', + :'wallet_user_id' => :'wallet_user_id', + :'address_id' => :'address_id', + :'address_index' => :'address_index', + :'signing_payload' => :'signing_payload', + :'transaction_type' => :'transaction_type', + :'transaction_id' => :'transaction_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'seed_id' => :'String', + :'wallet_id' => :'String', + :'wallet_user_id' => :'String', + :'address_id' => :'String', + :'address_index' => :'Integer', + :'signing_payload' => :'String', + :'transaction_type' => :'TransactionType', + :'transaction_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::SignatureCreationEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::SignatureCreationEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'seed_id') + self.seed_id = attributes[:'seed_id'] + else + self.seed_id = nil + end + + if attributes.key?(:'wallet_id') + self.wallet_id = attributes[:'wallet_id'] + else + self.wallet_id = nil + end + + if attributes.key?(:'wallet_user_id') + self.wallet_user_id = attributes[:'wallet_user_id'] + else + self.wallet_user_id = nil + end + + if attributes.key?(:'address_id') + self.address_id = attributes[:'address_id'] + else + self.address_id = nil + end + + if attributes.key?(:'address_index') + self.address_index = attributes[:'address_index'] + else + self.address_index = nil + end + + if attributes.key?(:'signing_payload') + self.signing_payload = attributes[:'signing_payload'] + else + self.signing_payload = nil + end + + if attributes.key?(:'transaction_type') + self.transaction_type = attributes[:'transaction_type'] + else + self.transaction_type = nil + end + + if attributes.key?(:'transaction_id') + self.transaction_id = attributes[:'transaction_id'] + else + self.transaction_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @seed_id.nil? + invalid_properties.push('invalid value for "seed_id", seed_id cannot be nil.') + end + + if @wallet_id.nil? + invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.') + end + + if @wallet_user_id.nil? + invalid_properties.push('invalid value for "wallet_user_id", wallet_user_id cannot be nil.') + end + + if @address_id.nil? + invalid_properties.push('invalid value for "address_id", address_id cannot be nil.') + end + + if @address_index.nil? + invalid_properties.push('invalid value for "address_index", address_index cannot be nil.') + end + + if @signing_payload.nil? + invalid_properties.push('invalid value for "signing_payload", signing_payload cannot be nil.') + end + + if @transaction_type.nil? + invalid_properties.push('invalid value for "transaction_type", transaction_type cannot be nil.') + end + + if @transaction_id.nil? + invalid_properties.push('invalid value for "transaction_id", transaction_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @seed_id.nil? + return false if @wallet_id.nil? + return false if @wallet_user_id.nil? + return false if @address_id.nil? + return false if @address_index.nil? + return false if @signing_payload.nil? + return false if @transaction_type.nil? + return false if @transaction_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + seed_id == o.seed_id && + wallet_id == o.wallet_id && + wallet_user_id == o.wallet_user_id && + address_id == o.address_id && + address_index == o.address_index && + signing_payload == o.signing_payload && + transaction_type == o.transaction_type && + transaction_id == o.transaction_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [seed_id, wallet_id, wallet_user_id, address_id, address_index, signing_payload, transaction_type, transaction_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/signature_creation_event_result.rb b/lib/coinbase/client/models/signature_creation_event_result.rb new file mode 100644 index 00000000..fb7bf63b --- /dev/null +++ b/lib/coinbase/client/models/signature_creation_event_result.rb @@ -0,0 +1,329 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # The result to a SignatureCreationEvent. + class SignatureCreationEventResult + # The ID of the wallet that the event was created for. + attr_accessor :wallet_id + + # The ID of the user that the wallet belongs to + attr_accessor :wallet_user_id + + # The ID of the address the transfer belongs to + attr_accessor :address_id + + attr_accessor :transaction_type + + # The ID of the transaction that the Server-Signer has signed for + attr_accessor :transaction_id + + # The signature created by the server-signer. + attr_accessor :signature + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'wallet_id' => :'wallet_id', + :'wallet_user_id' => :'wallet_user_id', + :'address_id' => :'address_id', + :'transaction_type' => :'transaction_type', + :'transaction_id' => :'transaction_id', + :'signature' => :'signature' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'wallet_id' => :'String', + :'wallet_user_id' => :'String', + :'address_id' => :'String', + :'transaction_type' => :'TransactionType', + :'transaction_id' => :'String', + :'signature' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::SignatureCreationEventResult` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::SignatureCreationEventResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'wallet_id') + self.wallet_id = attributes[:'wallet_id'] + else + self.wallet_id = nil + end + + if attributes.key?(:'wallet_user_id') + self.wallet_user_id = attributes[:'wallet_user_id'] + else + self.wallet_user_id = nil + end + + if attributes.key?(:'address_id') + self.address_id = attributes[:'address_id'] + else + self.address_id = nil + end + + if attributes.key?(:'transaction_type') + self.transaction_type = attributes[:'transaction_type'] + else + self.transaction_type = nil + end + + if attributes.key?(:'transaction_id') + self.transaction_id = attributes[:'transaction_id'] + else + self.transaction_id = nil + end + + if attributes.key?(:'signature') + self.signature = attributes[:'signature'] + else + self.signature = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @wallet_id.nil? + invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.') + end + + if @wallet_user_id.nil? + invalid_properties.push('invalid value for "wallet_user_id", wallet_user_id cannot be nil.') + end + + if @address_id.nil? + invalid_properties.push('invalid value for "address_id", address_id cannot be nil.') + end + + if @transaction_type.nil? + invalid_properties.push('invalid value for "transaction_type", transaction_type cannot be nil.') + end + + if @transaction_id.nil? + invalid_properties.push('invalid value for "transaction_id", transaction_id cannot be nil.') + end + + if @signature.nil? + invalid_properties.push('invalid value for "signature", signature cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @wallet_id.nil? + return false if @wallet_user_id.nil? + return false if @address_id.nil? + return false if @transaction_type.nil? + return false if @transaction_id.nil? + return false if @signature.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + wallet_id == o.wallet_id && + wallet_user_id == o.wallet_user_id && + address_id == o.address_id && + transaction_type == o.transaction_type && + transaction_id == o.transaction_id && + signature == o.signature + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [wallet_id, wallet_user_id, address_id, transaction_type, transaction_id, signature].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/trade.rb b/lib/coinbase/client/models/trade.rb new file mode 100644 index 00000000..1e11f89f --- /dev/null +++ b/lib/coinbase/client/models/trade.rb @@ -0,0 +1,356 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # A trade of an asset to another asset + class Trade + # The ID of the blockchain network + attr_accessor :network_id + + # The ID of the wallet that owns the from address + attr_accessor :wallet_id + + # The onchain address of the sender + attr_accessor :address_id + + # The ID of the trade + attr_accessor :trade_id + + # The amount of the from asset to be traded (in atomic units of the from asset) + attr_accessor :from_amount + + attr_accessor :from_asset + + # The amount of the to asset that will be received (in atomic units of the to asset) + attr_accessor :to_amount + + attr_accessor :to_asset + + attr_accessor :transaction + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'network_id' => :'network_id', + :'wallet_id' => :'wallet_id', + :'address_id' => :'address_id', + :'trade_id' => :'trade_id', + :'from_amount' => :'from_amount', + :'from_asset' => :'from_asset', + :'to_amount' => :'to_amount', + :'to_asset' => :'to_asset', + :'transaction' => :'transaction' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'network_id' => :'String', + :'wallet_id' => :'String', + :'address_id' => :'String', + :'trade_id' => :'String', + :'from_amount' => :'String', + :'from_asset' => :'Asset', + :'to_amount' => :'String', + :'to_asset' => :'Asset', + :'transaction' => :'Transaction' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::Trade` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::Trade`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'network_id') + self.network_id = attributes[:'network_id'] + else + self.network_id = nil + end + + if attributes.key?(:'wallet_id') + self.wallet_id = attributes[:'wallet_id'] + else + self.wallet_id = nil + end + + if attributes.key?(:'address_id') + self.address_id = attributes[:'address_id'] + else + self.address_id = nil + end + + if attributes.key?(:'trade_id') + self.trade_id = attributes[:'trade_id'] + else + self.trade_id = nil + end + + if attributes.key?(:'from_amount') + self.from_amount = attributes[:'from_amount'] + else + self.from_amount = nil + end + + if attributes.key?(:'from_asset') + self.from_asset = attributes[:'from_asset'] + else + self.from_asset = nil + end + + if attributes.key?(:'to_amount') + self.to_amount = attributes[:'to_amount'] + else + self.to_amount = nil + end + + if attributes.key?(:'to_asset') + self.to_asset = attributes[:'to_asset'] + else + self.to_asset = nil + end + + if attributes.key?(:'transaction') + self.transaction = attributes[:'transaction'] + else + self.transaction = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @network_id.nil? + invalid_properties.push('invalid value for "network_id", network_id cannot be nil.') + end + + if @wallet_id.nil? + invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.') + end + + if @address_id.nil? + invalid_properties.push('invalid value for "address_id", address_id cannot be nil.') + end + + if @trade_id.nil? + invalid_properties.push('invalid value for "trade_id", trade_id cannot be nil.') + end + + if @from_amount.nil? + invalid_properties.push('invalid value for "from_amount", from_amount cannot be nil.') + end + + if @from_asset.nil? + invalid_properties.push('invalid value for "from_asset", from_asset cannot be nil.') + end + + if @to_amount.nil? + invalid_properties.push('invalid value for "to_amount", to_amount cannot be nil.') + end + + if @to_asset.nil? + invalid_properties.push('invalid value for "to_asset", to_asset cannot be nil.') + end + + if @transaction.nil? + invalid_properties.push('invalid value for "transaction", transaction cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @network_id.nil? + return false if @wallet_id.nil? + return false if @address_id.nil? + return false if @trade_id.nil? + return false if @from_amount.nil? + return false if @from_asset.nil? + return false if @to_amount.nil? + return false if @to_asset.nil? + return false if @transaction.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + network_id == o.network_id && + wallet_id == o.wallet_id && + address_id == o.address_id && + trade_id == o.trade_id && + from_amount == o.from_amount && + from_asset == o.from_asset && + to_amount == o.to_amount && + to_asset == o.to_asset && + transaction == o.transaction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [network_id, wallet_id, address_id, trade_id, from_amount, from_asset, to_amount, to_asset, transaction].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/trade_list.rb b/lib/coinbase/client/models/trade_list.rb new file mode 100644 index 00000000..0c4d2cd2 --- /dev/null +++ b/lib/coinbase/client/models/trade_list.rb @@ -0,0 +1,275 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # + class TradeList + attr_accessor :data + + # True if this list has another page of items after this one that can be fetched. + attr_accessor :has_more + + # The page token to be used to fetch the next page. + attr_accessor :next_page + + # The total number of trades for the address in the wallet. + attr_accessor :total_count + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'has_more' => :'has_more', + :'next_page' => :'next_page', + :'total_count' => :'total_count' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array', + :'has_more' => :'Boolean', + :'next_page' => :'String', + :'total_count' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::TradeList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::TradeList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + else + self.data = nil + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + else + self.has_more = nil + end + + if attributes.key?(:'next_page') + self.next_page = attributes[:'next_page'] + else + self.next_page = nil + end + + if attributes.key?(:'total_count') + self.total_count = attributes[:'total_count'] + else + self.total_count = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @data.nil? + invalid_properties.push('invalid value for "data", data cannot be nil.') + end + + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @next_page.nil? + invalid_properties.push('invalid value for "next_page", next_page cannot be nil.') + end + + if @total_count.nil? + invalid_properties.push('invalid value for "total_count", total_count cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @data.nil? + return false if @has_more.nil? + return false if @next_page.nil? + return false if @total_count.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + has_more == o.has_more && + next_page == o.next_page && + total_count == o.total_count + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, has_more, next_page, total_count].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/transaction.rb b/lib/coinbase/client/models/transaction.rb new file mode 100644 index 00000000..89929af1 --- /dev/null +++ b/lib/coinbase/client/models/transaction.rb @@ -0,0 +1,294 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + # An onchain transaction. + class Transaction + # The unsigned payload of the transaction. This is the payload that needs to be signed by the sender. + attr_accessor :unsigned_payload + + # The signed payload of the transaction. This is the payload that has been signed by the sender. + attr_accessor :signed_payload + + # The hash of the transaction + attr_accessor :transaction_hash + + # The status of the transaction + attr_accessor :status + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'unsigned_payload' => :'unsigned_payload', + :'signed_payload' => :'signed_payload', + :'transaction_hash' => :'transaction_hash', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'unsigned_payload' => :'String', + :'signed_payload' => :'String', + :'transaction_hash' => :'String', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::Transaction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::Transaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'unsigned_payload') + self.unsigned_payload = attributes[:'unsigned_payload'] + else + self.unsigned_payload = nil + end + + if attributes.key?(:'signed_payload') + self.signed_payload = attributes[:'signed_payload'] + end + + if attributes.key?(:'transaction_hash') + self.transaction_hash = attributes[:'transaction_hash'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @unsigned_payload.nil? + invalid_properties.push('invalid value for "unsigned_payload", unsigned_payload cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @unsigned_payload.nil? + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["pending", "broadcast", "complete", "failed"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["pending", "broadcast", "complete", "failed"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + unsigned_payload == o.unsigned_payload && + signed_payload == o.signed_payload && + transaction_hash == o.transaction_hash && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [unsigned_payload, signed_payload, transaction_hash, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Coinbase::Client.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/coinbase/client/models/transaction_type.rb b/lib/coinbase/client/models/transaction_type.rb new file mode 100644 index 00000000..3a9321f5 --- /dev/null +++ b/lib/coinbase/client/models/transaction_type.rb @@ -0,0 +1,39 @@ +=begin +#Coinbase Platform API + +#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +The version of the OpenAPI document: 0.0.1-alpha +Contact: yuga.cohler@coinbase.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Coinbase::Client + class TransactionType + TRANSFER = "transfer".freeze + + def self.all_vars + @all_vars ||= [TRANSFER].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if TransactionType.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #TransactionType" + end + end +end diff --git a/lib/coinbase/client/models/wallet.rb b/lib/coinbase/client/models/wallet.rb index 49221f07..89b9163d 100644 --- a/lib/coinbase/client/models/wallet.rb +++ b/lib/coinbase/client/models/wallet.rb @@ -23,12 +23,38 @@ class Wallet attr_accessor :default_address + # The status of the Server-Signer for the wallet if present. + attr_accessor :server_signer_status + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id', :'network_id' => :'network_id', - :'default_address' => :'default_address' + :'default_address' => :'default_address', + :'server_signer_status' => :'server_signer_status' } end @@ -42,7 +68,8 @@ def self.openapi_types { :'id' => :'String', :'network_id' => :'String', - :'default_address' => :'Address' + :'default_address' => :'Address', + :'server_signer_status' => :'String' } end @@ -69,6 +96,8 @@ def initialize(attributes = {}) if attributes.key?(:'id') self.id = attributes[:'id'] + else + self.id = nil end if attributes.key?(:'network_id') @@ -80,6 +109,10 @@ def initialize(attributes = {}) if attributes.key?(:'default_address') self.default_address = attributes[:'default_address'] end + + if attributes.key?(:'server_signer_status') + self.server_signer_status = attributes[:'server_signer_status'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -87,6 +120,10 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + if @network_id.nil? invalid_properties.push('invalid value for "network_id", network_id cannot be nil.') end @@ -98,10 +135,23 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? return false if @network_id.nil? + server_signer_status_validator = EnumAttributeValidator.new('String', ["pending_seed_creation", "active_seed"]) + return false unless server_signer_status_validator.valid?(@server_signer_status) true end + # Custom attribute writer method checking allowed values (enum). + # @param [Object] server_signer_status Object to be assigned + def server_signer_status=(server_signer_status) + validator = EnumAttributeValidator.new('String', ["pending_seed_creation", "active_seed"]) + unless validator.valid?(server_signer_status) + fail ArgumentError, "invalid value for \"server_signer_status\", must be one of #{validator.allowable_values}." + end + @server_signer_status = server_signer_status + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -109,7 +159,8 @@ def ==(o) self.class == o.class && id == o.id && network_id == o.network_id && - default_address == o.default_address + default_address == o.default_address && + server_signer_status == o.server_signer_status end # @see the `==` method @@ -121,7 +172,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, network_id, default_address].hash + [id, network_id, default_address, server_signer_status].hash end # Builds the object from hash diff --git a/lib/coinbase/transfer.rb b/lib/coinbase/transfer.rb index cdfef0c0..7765e0e4 100644 --- a/lib/coinbase/transfer.rb +++ b/lib/coinbase/transfer.rb @@ -134,27 +134,17 @@ def transaction # Returns the status of the Transfer. # @return [Symbol] The status def status - # Check if the transfer has been signed yet. - return Status::PENDING if transaction_hash.nil? - - onchain_transaction = Coinbase.configuration.base_sepolia_client.eth_getTransactionByHash(transaction_hash) - - if onchain_transaction.nil? - # If the transaction has not been broadcast, it is still pending. - Status::PENDING - elsif onchain_transaction['blockHash'].nil? - # If the transaction has been broadcast but hasn't been included in a block, it is - # broadcast. - Status::BROADCAST - else - transaction_receipt = Coinbase.configuration.base_sepolia_client.eth_getTransactionReceipt(transaction_hash) + @model.status + end - if transaction_receipt['status'].to_i(16) == 1 - Status::COMPLETE - else - Status::FAILED - end + # Reload reloads the Transfer model with the latest version from the server side. + # @return [Transfer] The most recent version of Transfer from the server. + def reload + @model = Coinbase.call_api do + transfers_api.get_transfer(wallet_id, from_address_id, id) end + + self end # Waits until the Transfer is completed or failed by polling the Network at the given interval. Raises a @@ -162,11 +152,13 @@ def status # @param interval_seconds [Integer] The interval at which to poll the Network, in seconds # @param timeout_seconds [Integer] The maximum amount of time to wait for the Transfer to complete, in seconds # @return [Transfer] The completed Transfer object - def wait!(interval_seconds = 0.2, timeout_seconds = 10) + def wait!(interval_seconds = 0.2, timeout_seconds = 20) start_time = Time.now loop do - return self if status == Status::COMPLETE || status == Status::FAILED + reload + + return self if terminal_state? raise Timeout::Error, 'Transfer timed out' if Time.now - start_time > timeout_seconds @@ -190,5 +182,13 @@ def to_s def inspect to_s end + + def transfers_api + @transfers_api ||= Coinbase::Client::TransfersApi.new(Coinbase.configuration.api_client) + end + + def terminal_state? + status == Status::COMPLETE.to_s || status == Status::FAILED.to_s + end end end diff --git a/lib/coinbase/user.rb b/lib/coinbase/user.rb index 64317af3..40f99248 100644 --- a/lib/coinbase/user.rb +++ b/lib/coinbase/user.rb @@ -40,7 +40,8 @@ def import_wallet(data) # Lists the Wallets belonging to the User. # @param page_size [Integer] (Optional) the number of Wallets to return per page. Defaults to 10 # @param next_page_token [String] (Optional) the token for the next page of Wallets - # @return [Coinbase::Wallet] the Wallets belonging to the User + # @return [Array] the Wallets belonging to the User and the pagination token, if + # any. def wallets(page_size: 10, next_page_token: nil) opts = { limit: page_size @@ -63,85 +64,26 @@ def wallets(page_size: 10, next_page_token: nil) address_model_map[wallet_model.id] = addresses_list.data end - wallet_list.data.map do |wallet_model| + wallets = wallet_list.data.map do |wallet_model| Wallet.new(wallet_model, seed: '', address_models: address_model_map[wallet_model.id]) end + + [wallets, wallet_list.next_page] end - # Saves a wallet to local file system. Wallet saved this way can be re-instantiated with load_wallets_from_local - # function, provided the backup_file is available. This is an insecure method of storing wallet seeds and should - # only be used for development purposes. If you call save_wallet_locally! twice with wallets containing the same - # wallet_id, the backup will be overwritten during the second attempt. - # The default backup_file is `seeds.json` in the root folder. It can be configured by changing - # Coinbase.configuration.backup_file_path. - # - # @param wallet [Coinbase::Wallet] The wallet model to save. - # @param encrypt [bool] (Optional) Boolean representing whether the backup persisted to local file system should be - # encrypted or not. Data is unencrypted by default. - # @return [Coinbase::Wallet] the saved wallet. - def save_wallet_locally!(wallet, encrypt: false) - existing_seeds_in_store = existing_seeds - data = wallet.export - seed_to_store = data.seed - auth_tag = '' - iv = '' - if encrypt - shared_secret = store_encryption_key - cipher = OpenSSL::Cipher.new('aes-256-gcm').encrypt - cipher.key = OpenSSL::Digest.digest('SHA256', shared_secret) - iv = cipher.random_iv - cipher.iv = iv - cipher.auth_data = '' - encrypted_data = cipher.update(data.seed) + cipher.final - auth_tag = cipher.auth_tag.unpack1('H*') - iv = iv.unpack1('H*') - seed_to_store = encrypted_data.unpack1('H*') + # Returns the Wallet with the given ID. + # @param wallet_id [String] the ID of the Wallet + # @return [Coinbase::Wallet] the unhydrated Wallet + def wallet(wallet_id) + wallet_model = Coinbase.call_api do + wallets_api.get_wallet(wallet_id) end - existing_seeds_in_store[data.wallet_id] = { - seed: seed_to_store, - encrypted: encrypt, - auth_tag: auth_tag, - iv: iv - } - - File.open(Coinbase.configuration.backup_file_path, 'w') do |file| - file.write(JSON.pretty_generate(existing_seeds_in_store)) + addresses_list = Coinbase.call_api do + addresses_api.list_addresses(wallet_model.id, { limit: Coinbase::Wallet::MAX_ADDRESSES }) end - wallet - end - # Loads all wallets belonging to the User with backup persisted to the local file system. - # @return [MapCoinbase::Wallet] the map of wallet_ids to the wallets. - def load_wallets_from_local - existing_seeds_in_store = existing_seeds - raise ArgumentError, 'Backup file not found' if existing_seeds_in_store == {} - - wallets = {} - existing_seeds_in_store.each do |wallet_id, seed_data| - seed = seed_data['seed'] - raise ArgumentError, 'Malformed backup data' if seed.nil? || seed == '' - - if seed_data['encrypted'] - shared_secret = store_encryption_key - raise ArgumentError, 'Malformed encrypted seed data' if seed_data['iv'] == '' || - seed_data['auth_tag'] == '' - - cipher = OpenSSL::Cipher.new('aes-256-gcm').decrypt - cipher.key = OpenSSL::Digest.digest('SHA256', shared_secret) - iv = [seed_data['iv']].pack('H*') - cipher.iv = iv - auth_tag = [seed_data['auth_tag']].pack('H*') - cipher.auth_tag = auth_tag - cipher.auth_data = '' - hex_decoded_data = [seed_data['seed']].pack('H*') - seed = cipher.update(hex_decoded_data) + cipher.final - end - - data = Coinbase::Wallet::Data.new(wallet_id: wallet_id, seed: seed) - wallets[wallet_id] = import_wallet(data) - end - wallets + Wallet.new(wallet_model, seed: '', address_models: addresses_list.data) end # Returns a string representation of the User. @@ -165,22 +107,5 @@ def addresses_api def wallets_api @wallets_api ||= Coinbase::Client::WalletsApi.new(Coinbase.configuration.api_client) end - - def existing_seeds - existing_seed_data = '{}' - file_path = Coinbase.configuration.backup_file_path - existing_seed_data = File.read(file_path) if File.exist?(file_path) - output = JSON.parse(existing_seed_data) - - raise ArgumentError, 'Malformed backup data' unless output.is_a?(Hash) - - output - end - - def store_encryption_key - pk = OpenSSL::PKey.read(Coinbase.configuration.api_key_private_key) - public_key = pk.public_key # use own public key to generate the shared secret. - pk.dh_compute_key(public_key) - end end end diff --git a/lib/coinbase/wallet.rb b/lib/coinbase/wallet.rb index bbab7627..0fabdda6 100644 --- a/lib/coinbase/wallet.rb +++ b/lib/coinbase/wallet.rb @@ -17,6 +17,17 @@ class Wallet # The maximum number of addresses in a Wallet. MAX_ADDRESSES = 20 + # A representation of ServerSigner status in a Wallet. + module ServerSignerStatus + # The Wallet is awaiting seed creation by the ServerSigner. At this point, + # the Wallet cannot create addresses or sign transactions. + PENDING = 'pending_seed_creation' + + # The Wallet has an associated seed created by the ServerSigner. It is ready + # to create addresses and sign transactions. + ACTIVE = 'active_seed' + end + class << self # Imports a Wallet from previously exported wallet data. # @param data [Coinbase::Wallet::Data] the Wallet data to import @@ -37,13 +48,18 @@ def import(data) # Creates a new Wallet on the specified Network and generate a default address for it. # @param network_id [String] (Optional) the ID of the blockchain network. Defaults to 'base-sepolia'. + # @param interval_seconds [Integer] The interval at which to poll the CDPService for the Wallet to + # have an active seed, if using a ServerSigner, in seconds + # @param timeout_seconds [Integer] The maximum amount of time to wait for the ServerSigner to + # create a seed for the Wallet, in seconds # @return [Coinbase::Wallet] the new Wallet - def create(network_id: 'base-sepolia') + def create(network_id: 'base-sepolia', interval_seconds: 0.2, timeout_seconds: 20) model = Coinbase.call_api do wallets_api.create_wallet( create_wallet_request: { wallet: { - network_id: network_id + network_id: network_id, + use_server_signer: Coinbase.use_server_signer? } } ) @@ -51,13 +67,42 @@ def create(network_id: 'base-sepolia') wallet = new(model) - wallet.create_address + # When used with a ServerSigner, the Signer must first register + # with the Wallet before addresses can be created. + wait_for_signer(wallet.id, interval_seconds, timeout_seconds) if Coinbase.use_server_signer? + wallet.create_address wallet end private + # Wait_for_signer waits until the ServerSigner has created a seed for the Wallet. + # Timeout::Error if the ServerSigner takes longer than the given timeout to create the seed. + # @param wallet_id [string] The ID of the Wallet that is awaiting seed creation. + # @param interval_seconds [Integer] The interval at which to poll the CDPService, in seconds + # @param timeout_seconds [Integer] The maximum amount of time to wait for the Signer to create a seed, in seconds + # @return [Wallet] The completed Wallet object that is ready to create addresses. + def wait_for_signer(wallet_id, interval_seconds, timeout_seconds) + start_time = Time.now + + loop do + model = Coinbase.call_api do + wallets_api.get_wallet(wallet_id) + end + + return self if model.server_signer_status == ServerSignerStatus::ACTIVE + + if Time.now - start_time > timeout_seconds + raise Timeout::Error, 'Wallet creation timed out. Check status of your Server-Signer' + end + + self.sleep interval_seconds + end + + self + end + # TODO: Memoize these objects in a thread-safe way at the top-level. def addresses_api Coinbase::Client::AddressesApi.new(Coinbase.configuration.api_client) @@ -78,12 +123,15 @@ def wallets_api # with the Wallet. If not provided, the Wallet will derive the first default address. # @param client [Jimson::Client] (Optional) The JSON RPC client to use for interacting with the Network def initialize(model, seed: nil, address_models: []) - validate_seed_and_address_models(seed, address_models) + validate_seed_and_address_models(seed, address_models) unless Coinbase.use_server_signer? @model = model - @master = master_node(seed) @addresses = [] - @private_key_index = 0 + + unless Coinbase.use_server_signer? + @master = master_node(seed) + @private_key_index = 0 + end derive_addresses(address_models) end @@ -100,6 +148,12 @@ def network_id Coinbase.to_sym(@model.network_id) end + # Returns the ServerSigner Status of the Wallet. + # @return [Symbol] The ServerSigner Status + def server_signer_status + Coinbase.to_sym(@model.server_signer_status) + end + # Sets the seed of the Wallet. This seed is used to derive keys and sign transactions. # @param seed [String] The seed to set. Expects a 32-byte hexadecimal with no 0x prefix. def seed=(seed) @@ -121,16 +175,19 @@ def seed=(seed) # Creates a new Address in the Wallet. # @return [Address] The new Address def create_address - key = derive_key - attestation = create_attestation(key) - public_key = key.public_key.compressed.unpack1('H*') + opts = { create_address_request: {} } - opts = { - create_address_request: { - public_key: public_key, - attestation: attestation + unless Coinbase.use_server_signer? + key = derive_key + + opts = { + create_address_request: { + public_key: key.public_key.compressed.unpack1('H*'), + attestation: create_attestation(key) + } } - } + end + address_model = Coinbase.call_api do addresses_api.create_address(id, opts) end @@ -177,30 +234,23 @@ def balance(asset_id) Coinbase::Balance.from_model_and_asset_id(response, asset_id).amount end - # Transfers the given amount of the given Asset to the given address. Only same-Network Transfers are supported. - # Currently only the default_address is used to source the Transfer. + # Transfers the given amount of the given Asset to the specified address or wallet. + # Only same-network Transfers are supported. Currently only the default_address is used to source the Transfer. # @param amount [Integer, Float, BigDecimal] The amount of the Asset to send # @param asset_id [Symbol] The ID of the Asset to send # @param destination [Wallet | Address | String] The destination of the transfer. If a Wallet, sends to the Wallet's # default address. If a String, interprets it as the address ID. # @return [Transfer] The hash of the Transfer transaction. def transfer(amount, asset_id, destination) - if destination.is_a?(Wallet) - raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id - - destination = destination.default_address.id - elsif destination.is_a?(Address) - raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id - - destination = destination.id - end - default_address.transfer(amount, asset_id, destination) end # Exports the Wallet's data to a Data object. # @return [Data] The Wallet data def export + # TODO: Improve this check by relying on the backend data to decide whether a wallet is server-signer backed. + raise 'Cannot export data for Server-Signer backed Wallet' if Coinbase.use_server_signer? + raise 'Cannot export Wallet without loaded seed' if @master.nil? Data.new(wallet_id: id, seed: @master.seed_hex) @@ -223,6 +273,87 @@ def can_sign? !@master.nil? end + # Saves the seed of the Wallet to the given file. Wallets whose seeds are saved this way can be + # rehydrated using load_seed. A single file can be used for multiple Wallet seeds. + # This is an insecure method of storing Wallet seeds and should only be used for development purposes. + # + # @param file_path [String] The path of the file to save the seed to + # @param encrypt [bool] (Optional) Whether the seed information persisted to the local file system should be + # encrypted or not. Data is unencrypted by default. + # @return [String] A string indicating the success of the operation + def save_seed!(file_path, encrypt: false) + raise 'Wallet does not have seed loaded' if @master.nil? + + existing_seeds_in_store = existing_seeds(file_path) + + seed_to_store = @master.seed_hex + auth_tag = '' + iv = '' + if encrypt + cipher = OpenSSL::Cipher.new('aes-256-gcm').encrypt + cipher.key = OpenSSL::Digest.digest('SHA256', encryption_key) + iv = cipher.random_iv + cipher.iv = iv + cipher.auth_data = '' + encrypted_data = cipher.update(@master.seed_hex) + cipher.final + auth_tag = cipher.auth_tag.unpack1('H*') + iv = iv.unpack1('H*') + seed_to_store = encrypted_data.unpack1('H*') + end + + existing_seeds_in_store[id] = { + seed: seed_to_store, + encrypted: encrypt, + auth_tag: auth_tag, + iv: iv + } + + File.open(file_path, 'w') do |file| + file.write(JSON.pretty_generate(existing_seeds_in_store)) + end + + "Successfully saved seed for wallet #{id} to #{file_path}." + end + + # Loads the seed of the Wallet from the given file. + # @param file_path [String] The path of the file to load the seed from + # @return [String] A string indicating the success of the operation + def load_seed(file_path) + raise 'Wallet already has seed loaded' unless @master.nil? + + existing_seeds_in_store = existing_seeds(file_path) + + raise ArgumentError, "File #{file_path} does not contain seed data" if existing_seeds_in_store == {} + + if existing_seeds_in_store[id].nil? + raise ArgumentError, "File #{file_path} does not contain seed data for wallet #{id}" + end + + seed_data = existing_seeds_in_store[id] + local_seed = seed_data['seed'] + + raise ArgumentError, 'Seed data is malformed' if local_seed.nil? || local_seed == '' + + if seed_data['encrypted'] + raise ArgumentError, 'Encrypted seed data is malformed' if seed_data['iv'] == '' || + seed_data['auth_tag'] == '' + + cipher = OpenSSL::Cipher.new('aes-256-gcm').decrypt + cipher.key = OpenSSL::Digest.digest('SHA256', encryption_key) + iv = [seed_data['iv']].pack('H*') + cipher.iv = iv + auth_tag = [seed_data['auth_tag']].pack('H*') + cipher.auth_tag = auth_tag + cipher.auth_data = '' + hex_decoded_data = [seed_data['seed']].pack('H*') + local_seed = cipher.update(hex_decoded_data) + cipher.final + end + + self.seed = local_seed + + "Successfully loaded seed for wallet #{id} from #{file_path}." + end + # Returns a String representation of the Wallet. # @return [String] a String representation of the Wallet def to_s @@ -390,6 +521,25 @@ def validate_seed_and_address_models(seed, address_models) raise ArgumentError, 'Seed must be empty if address_models are not provided' end + # Loads the Hash of Wallet seeds from the given file. + # @param file_path [String] The path of the file to load the seed from + # @return [Hash] The Hash of from Wallet IDs to seed data + def existing_seeds(file_path) + existing_seed_data = '{}' + existing_seed_data = File.read(file_path) if File.exist?(file_path) + existing_seeds = JSON.parse(existing_seed_data) + raise ArgumentError, "#{file_path} is malformed, must be a valid JSON object" unless existing_seeds.is_a?(Hash) + + existing_seeds + end + + # Returns the shared secret to use for encrypting the seed. + def encryption_key + pk = OpenSSL::PKey.read(Coinbase.configuration.api_key_private_key) + public_key = pk.public_key # use own public key to generate the shared secret. + pk.dh_compute_key(public_key) + end + def addresses_api @addresses_api ||= Coinbase::Client::AddressesApi.new(Coinbase.configuration.api_client) end diff --git a/spec/e2e/end_to_end.rb b/spec/e2e/end_to_end.rb index 99ffdc55..1093d9c8 100644 --- a/spec/e2e/end_to_end.rb +++ b/spec/e2e/end_to_end.rb @@ -52,7 +52,7 @@ a1 = addresses[0] a2 = addresses[1] t = a1.transfer(1, :gwei, a2).wait! - expect(t.status).to eq(:complete) + expect(t.status).to eq('complete') puts "Transferred 1 Gwei from #{a1} to #{a2}" puts 'Fetching updated balances...' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9b773f11..a57f4cbd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,12 @@ # frozen_string_literal: true +require 'simplecov' + +SimpleCov.start do + enable_coverage :branch + primary_coverage :branch + add_filter '/spec/' + add_filter '/lib/coinbase/client/' +end + require_relative '../lib/coinbase' diff --git a/spec/unit/coinbase/address_spec.rb b/spec/unit/coinbase/address_spec.rb index 80e5ab39..7ebf3de4 100644 --- a/spec/unit/coinbase/address_spec.rb +++ b/spec/unit/coinbase/address_spec.rb @@ -7,12 +7,21 @@ let(:address_id) { key.address.to_s } let(:wallet_id) { SecureRandom.uuid } let(:model) do - Coinbase::Client::Address.new({ - 'network_id' => 'base-sepolia', - 'address_id' => address_id, - 'wallet_id' => wallet_id, - 'public_key' => key.public_key.compressed.unpack1('H*') - }) + Coinbase::Client::Address.new( + network_id: 'base-sepolia', + address_id: address_id, + wallet_id: wallet_id, + public_key: key.public_key.compressed.unpack1('H*') + ) + end + let(:eth_asset) do + Coinbase::Client::Asset.new(network_id: 'base-sepolia', asset_id: 'eth', decimals: 18) + end + let(:usdc_asset) do + Coinbase::Client::Asset.new(network_id: 'base-sepolia', asset_id: 'usdc', decimals: 6) + end + let(:weth_asset) do + Coinbase::Client::Asset.new(network_id: 'base-sepolia', asset_id: 'weth', decimals: 18) end let(:addresses_api) { double('Coinbase::Client::AddressesApi') } let(:transfers_api) { double('Coinbase::Client::TransfersApi') } @@ -55,37 +64,10 @@ describe '#balances' do let(:response) do Coinbase::Client::AddressBalanceList.new( - 'data' => [ - Coinbase::Client::Balance.new( - { - 'amount' => '1000000000000000000', - 'asset' => Coinbase::Client::Asset.new({ - 'network_id': 'base-sepolia', - 'asset_id': 'eth', - 'decimals': 18 - }) - } - ), - Coinbase::Client::Balance.new( - { - 'amount' => '5000000000', - 'asset' => Coinbase::Client::Asset.new({ - 'network_id': 'base-sepolia', - 'asset_id': 'usdc', - 'decimals': 6 - }) - } - ), - Coinbase::Client::Balance.new( - { - 'amount' => '3000000000000000000', - 'asset' => Coinbase::Client::Asset.new({ - 'network_id': 'base-sepolia', - 'asset_id': 'weth', - 'decimals': 6 - }) - } - ) + data: [ + Coinbase::Client::Balance.new(amount: '1000000000000000000', asset: eth_asset), + Coinbase::Client::Balance.new(amount: '5000000000', asset: usdc_asset), + Coinbase::Client::Balance.new(amount: '3000000000000000000', asset: weth_asset) ] ) end @@ -118,16 +100,7 @@ describe '#balance' do let(:response) do - Coinbase::Client::Balance.new( - { - 'amount' => '1000000000000000000', - 'asset' => Coinbase::Client::Asset.new({ - 'network_id': 'base-sepolia', - 'asset_id': 'eth', - 'decimals': 18 - }) - } - ) + Coinbase::Client::Balance.new(amount: '1000000000000000000', asset: eth_asset) end it 'returns the correct ETH balance' do @@ -165,28 +138,10 @@ describe '#transfer' do let(:eth_balance_response) do - Coinbase::Client::Balance.new( - { - 'amount' => '1000000000000000000', - 'asset' => Coinbase::Client::Asset.new({ - 'network_id': 'base-sepolia', - 'asset_id': 'eth', - 'decimals': 18 - }) - } - ) + Coinbase::Client::Balance.new(amount: '1000000000000000000', asset: eth_asset) end let(:usdc_balance_response) do - Coinbase::Client::Balance.new( - { - 'amount' => '10000000000', - 'asset' => Coinbase::Client::Asset.new({ - 'network_id': 'base-sepolia', - 'asset_id': 'usdc', - 'decimals': 6 - }) - } - ) + Coinbase::Client::Balance.new(amount: '10000000000', asset: usdc_asset) end let(:transfer_id) { SecureRandom.uuid } let(:to_key) { Eth::Key.new } @@ -198,145 +153,219 @@ { signed_payload: raw_signed_transaction } end let(:transaction) { double('Transaction', sign: transaction_hash, hex: raw_signed_transaction) } - let(:transfer) do - double('Transfer', transaction: transaction, id: transfer_id) - end + let(:created_transfer) { double('Transfer', transaction: transaction, id: transfer_id) } + let(:transfer_model) { instance_double('Coinbase::Client::Transfer', status: 'pending') } + let(:broadcasted_transfer_model) { instance_double('Coinbase::Client::Transfer', status: 'broadcast') } + let(:broadcasted_transfer) { double('Transfer', transaction: transaction, id: transfer_id) } + let(:transfer_asset_id) { 'eth' } + let(:balance_response) { eth_balance_response } + let(:destination) { to_address_id } - before do - allow(Coinbase::Transfer).to receive(:new).and_return(transfer) - end + subject(:transfer) { address.transfer(amount, asset_id, destination) } - # TODO: Add test case for when the destination is a Wallet. - - context 'when the destination is a valid Address' do + context 'when the transfer is successful' do let(:asset_id) { :wei } let(:amount) { 500_000_000_000_000_000 } - let(:destination) { described_class.new(model, to_key) } + let(:transfer_amount) { 500_000_000_000_000_000 } let(:create_transfer_request) do - { amount: amount.to_s, network_id: network_id, asset_id: 'eth', destination: destination.id } + { amount: transfer_amount.to_s, network_id: network_id, asset_id: transfer_asset_id, + destination: to_address_id } end - it 'creates a Transfer' do - expect(addresses_api) + before do + allow(addresses_api) .to receive(:get_address_balance) - .with(wallet_id, address_id, 'eth') - .and_return(eth_balance_response) - expect(transfers_api) + .with(wallet_id, address_id, transfer_asset_id) + .and_return(balance_response) + + allow(transfers_api) .to receive(:create_transfer) .with(wallet_id, address_id, create_transfer_request) - expect(transfers_api) + .and_return(transfer_model) + + allow(Coinbase::Transfer).to receive(:new).with(transfer_model).and_return(created_transfer) + + allow(transfers_api) .to receive(:broadcast_transfer) .with(wallet_id, address_id, transfer_id, broadcast_transfer_request) - expect(address.transfer(amount, asset_id, destination)).to eq(transfer) - end - end + .and_return(broadcasted_transfer_model) - context 'when the destination is a valid Address and asset is USDC' do - let(:asset_id) { :usdc } - let(:usdc_amount) { 5 } - let(:usdc_atomic_amount) { 5_000_000 } - let(:destination) { described_class.new(model, to_key) } - let(:create_transfer_request) do - { - amount: usdc_atomic_amount.to_s, - network_id: network_id, - asset_id: 'usdc', - destination: destination.id - } + allow(Coinbase::Transfer).to receive(:new).with(broadcasted_transfer_model).and_return(broadcasted_transfer) + + transfer end - it 'creates a Transfer' do - expect(addresses_api) - .to receive(:get_address_balance) - .with(wallet_id, address_id, 'usdc') - .and_return(usdc_balance_response) + it 'creates the transfer' do expect(transfers_api) - .to receive(:create_transfer) + .to have_received(:create_transfer) .with(wallet_id, address_id, create_transfer_request) - expect(transfers_api) - .to receive(:broadcast_transfer) - .with(wallet_id, address_id, transfer_id, broadcast_transfer_request) + end - expect(address.transfer(usdc_amount, asset_id, destination)).to eq(transfer) + it 'returns the broadcasted transfer' do + expect(transfer).to eq(broadcasted_transfer) end - end - context 'when the destination is a valid Address ID' do - let(:asset_id) { :wei } - let(:amount) { 500_000_000_000_000_000 } - let(:destination) { to_address_id } - let(:create_transfer_request) do - { amount: amount.to_s, network_id: network_id, asset_id: 'eth', destination: to_address_id } + it 'signs the transaction with the key' do + expect(transaction).to have_received(:sign).with(key) end - it 'creates a Transfer' do - expect(addresses_api) - .to receive(:get_address_balance) - .with(wallet_id, address_id, 'eth') - .and_return(eth_balance_response) - expect(transfers_api) - .to receive(:create_transfer) - .with(wallet_id, address_id, create_transfer_request) - expect(transfers_api) - .to receive(:broadcast_transfer) - .with(wallet_id, address_id, transfer_id, broadcast_transfer_request) - expect(address.transfer(amount, asset_id, destination)).to eq(transfer) + + context 'when the asset is Gwei' do + let(:asset_id) { :gwei } + let(:amount) { 500_000_000 } + + it 'returns the broadcast transfer' do + expect(transfer).to eq(broadcasted_transfer) + end + + it 'signs the transaction with the address key' do + expect(transaction).to have_received(:sign).with(key) + end end - end - context 'when the destination is a valid Address ID and asset is Gwei' do - let(:asset_id) { :gwei } - let(:amount) { 500_000_000 } - let(:wei_amount) { 500_000_000_000_000_000 } - let(:destination) { to_address_id } - let(:create_transfer_request) do - { amount: wei_amount.to_s, network_id: network_id, asset_id: 'eth', destination: to_address_id } + context 'when the asset is ETH' do + let(:asset_id) { :eth } + let(:amount) { 0.5 } + let(:transfer_amount) { 500_000_000_000_000_000 } + + it 'returns the broadcast transfer' do + expect(transfer).to eq(broadcasted_transfer) + end + + it 'signs the transaction with the address key' do + expect(transaction).to have_received(:sign).with(key) + end end - it 'creates a Transfer' do - expect(addresses_api) - .to receive(:get_address_balance) - .with(wallet_id, address_id, 'eth') - .and_return(eth_balance_response) - expect(transfers_api) - .to receive(:create_transfer) - .with(wallet_id, address_id, create_transfer_request) - expect(transfers_api) - .to receive(:broadcast_transfer) - .with(wallet_id, address_id, transfer_id, broadcast_transfer_request) - expect(address.transfer(amount, asset_id, destination)).to eq(transfer) + + context 'when the asset is USDC' do + let(:asset_id) { :usdc } + let(:transfer_asset_id) { 'usdc' } + let(:amount) { 5 } + let(:transfer_amount) { 5_000_000 } + let(:balance_response) { usdc_balance_response } + + it 'creates a Transfer' do + expect(transfer).to eq(broadcasted_transfer) + end + end + + context 'when the destination is a Wallet' do + let(:default_address_model) do + Coinbase::Client::Address.new( + network_id: 'base-sepolia', + address_id: to_address_id, + wallet_id: wallet_id, + public_key: to_key.public_key.compressed.unpack1('H*') + ) + end + let(:destination) do + Coinbase::Wallet.new( + Coinbase::Client::Wallet.new(id: wallet_id, network_id: 'base-sepolia', + default_address: default_address_model), + seed: '', + address_models: [default_address_model] + ) + end + + it 'returns the broadcasted transfer' do + expect(transfer).to eq(broadcasted_transfer) + end + + it 'signs the transaction with the address key' do + expect(transaction).to have_received(:sign).with(key) + end + end + + context 'when the destination is a Address' do + let(:asset_id) { :wei } + let(:amount) { 500_000_000_000_000_000 } + let(:transfer_amount) { amount } + let(:balance_response) { eth_balance_response } + let(:to_model) do + Coinbase::Client::Address.new( + network_id: 'base-sepolia', + address_id: to_address_id, + wallet_id: wallet_id, + public_key: to_key.public_key.compressed.unpack1('H*') + ) + end + let(:destination) { described_class.new(to_model, to_key) } + let(:destination_address) { destination.id } + + it 'returns the broadcasted transfer' do + expect(transfer).to eq(broadcasted_transfer) + end + + it 'signs the transaction with the address key' do + expect(transaction).to have_received(:sign).with(key) + end end end - context 'when the asset is unsupported' do + context 'when the destination Address is on a different network' do + let(:to_model) do + Coinbase::Client::Address.new( + network_id: 'ethereum-sepolia', + address_id: to_address_id, + wallet_id: wallet_id, + public_key: to_key.public_key.compressed.unpack1('H*') + ) + end let(:amount) { 500_000_000_000_000_000 } + let(:asset_id) { :wei } + let(:destination) { described_class.new(to_model, to_key) } + it 'raises an ArgumentError' do - expect { address.transfer(amount, :uni, to_address_id) }.to raise_error(ArgumentError, 'Unsupported asset: uni') + expect do + address.transfer(amount, asset_id, destination) + end.to raise_error(ArgumentError, 'Transfer must be on the same Network') end end - # TODO: Add test case for when the destination is a Wallet. + context 'when the destination Wallet is on a different network' do + let(:default_address_model) do + Coinbase::Client::Address.new( + network_id: 'base-sepolia', + address_id: to_address_id, + wallet_id: wallet_id, + public_key: to_key.public_key.compressed.unpack1('H*') + ) + end + let(:destination) do + Coinbase::Wallet.new( + Coinbase::Client::Wallet.new(id: wallet_id, network_id: 'base-mainnet', + default_address: default_address_model), + seed: '', + address_models: [default_address_model] + ) + end - context 'when the destination Address is on a different network' do - let(:asset_id) { :wei } let(:amount) { 500_000_000_000_000_000 } - let(:new_model) do - Coinbase::Client::Address.new({ - 'network_id' => 'base-mainnet', - 'address_id' => address_id, - 'wallet_id' => wallet_id, - 'public_key' => key.public_key.compressed.unpack1('H*') - }) - end + let(:asset_id) { :wei } it 'raises an ArgumentError' do expect do - address.transfer(amount, asset_id, Coinbase::Address.new(new_model, to_key)) + address.transfer(amount, asset_id, destination) end.to raise_error(ArgumentError, 'Transfer must be on the same Network') end end + context 'when the asset is unsupported' do + let(:amount) { 500_000_000_000_000_000 } + let(:transfer_amount) { amount } + let(:asset_id) { :uni } + + it 'raises an ArgumentError' do + expect do + address.transfer(amount, asset_id, destination) + end.to raise_error(ArgumentError, 'Unsupported asset: uni') + end + end + context 'when the balance is insufficient' do let(:asset_id) { :wei } let(:excessive_amount) { 9_000_000_000_000_000_000_000 } + let(:excessive_amount) { 9_000_000_000_000_000_000_000 } + before do expect(addresses_api) .to receive(:get_address_balance) @@ -360,6 +389,41 @@ end.to raise_error('Cannot transfer from address without private key loaded') end end + + context 'when using server signer' do + let(:configuration) { double('Coinbase::Configuration', use_server_signer: true, api_client: nil) } + let(:asset_id) { :wei } + let(:amount) { 500_000_000_000_000_000 } + let(:destination) { described_class.new(model, to_key) } + let(:create_transfer_request) do + { amount: amount.to_s, network_id: network_id, asset_id: 'eth', destination: destination.id } + end + + before do + allow(Coinbase).to receive(:configuration).and_return(configuration) + allow(addresses_api) + .to receive(:get_address_balance) + .with(wallet_id, address_id, transfer_asset_id) + .and_return(balance_response) + + allow(transfers_api) + .to receive(:create_transfer) + .with(wallet_id, address_id, create_transfer_request) + .and_return(transfer_model) + allow(Coinbase::Transfer).to receive(:new).with(transfer_model).and_return(created_transfer) + end + + it 'creates a transfer without broadcast' do + expect(addresses_api) + .to receive(:get_address_balance) + .with(wallet_id, address_id, 'eth') + .and_return(eth_balance_response) + expect(transfers_api) + .to receive(:create_transfer) + .with(wallet_id, address_id, create_transfer_request) + expect(address.transfer(amount, asset_id, destination)).to eq(transfer) + end + end end describe '#can_sign?' do @@ -460,9 +524,9 @@ Array.new(page_size) { SecureRandom.uuid } end let(:data) do - transfer_ids.map { |id| Coinbase::Client::Transfer.new({ 'transfer_id': id, 'network_id': 'base-sepolia' }) } + transfer_ids.map { |id| Coinbase::Client::Transfer.new(transfer_id: id, network_id: 'base-sepolia') } end - let(:transfers_list) { Coinbase::Client::TransferList.new({ 'data' => data }) } + let(:transfers_list) { Coinbase::Client::TransferList.new(data: data) } let(:expected_transfers) do data.map { |transfer_model| Coinbase::Transfer.new(transfer_model) } end @@ -482,14 +546,27 @@ expect(address.transfers).to eq(expected_transfers) end + context 'with no transfers' do + let(:data) { [] } + + it 'returns an empty list' do + expect(transfers_api) + .to receive(:list_transfers) + .with(wallet_id, address_id, { limit: 100, page: nil }) + .and_return(transfers_list) + + expect(address.transfers).to be_empty + end + end + context 'with multiple pages' do let(:page_size) { 150 } let(:next_page) { 'page_token_2' } let(:transfers_list_page1) do - Coinbase::Client::TransferList.new({ 'data' => data.take(100), 'has_more' => true, 'next_page' => next_page }) + Coinbase::Client::TransferList.new(data: data.take(100), has_more: true, next_page: next_page) end let(:transfers_list_page2) do - Coinbase::Client::TransferList.new({ 'data' => data.drop(100), 'has_more' => false, 'next_page' => nil }) + Coinbase::Client::TransferList.new(data: data.drop(100), has_more: false, next_page: nil) end it 'lists all of the transfers' do diff --git a/spec/unit/coinbase/transfer_spec.rb b/spec/unit/coinbase/transfer_spec.rb index 01e9f52a..12e570f5 100644 --- a/spec/unit/coinbase/transfer_spec.rb +++ b/spec/unit/coinbase/transfer_spec.rb @@ -55,19 +55,47 @@ }) end let(:broadcast_model) do - Coinbase::Client::Transfer.new({ - 'network_id' => network_id, - 'wallet_id' => wallet_id, - 'address_id' => from_address_id, - 'destination' => to_address_id, - 'asset_id' => 'eth', - 'amount' => amount.to_s, - 'transfer_id' => transfer_id, - 'status' => 'pending', - 'unsigned_payload' => unsigned_payload, - 'signed_payload' => signed_payload, - 'transaction_hash' => transaction_hash - }) + Coinbase::Client::Transfer.new( + 'network_id': network_id, + 'wallet_id': wallet_id, + 'address_id': from_address_id, + 'destination': to_address_id, + 'asset_id': 'eth', + 'amount': amount.to_s, + 'transfer_id': transfer_id, + 'status': 'pending', + 'unsigned_payload': unsigned_payload, + 'signed_payload': signed_payload, + 'transaction_hash': transaction_hash + ) + end + let(:complete_broadcast_model) do + Coinbase::Client::Transfer.new( + 'network_id': network_id, + 'wallet_id': wallet_id, + 'address_id': from_address_id, + 'destination': to_address_id, + 'asset_id': 'eth', + 'amount': amount.to_s, + 'transfer_id': transfer_id, + 'status': 'complete', + 'unsigned_payload': unsigned_payload, + 'signed_payload': signed_payload, + 'transaction_hash': transaction_hash + ) + end + let(:failed_broadcast_model) do + Coinbase::Client::Transfer.new( + 'network_id': network_id, + 'wallet_id': wallet_id, + 'address_id': from_address_id, + 'destination': to_address_id, + 'asset_id': 'eth', + 'amount': amount.to_s, + 'transfer_id': transfer_id, + 'status': 'failed', + 'unsigned_payload': unsigned_payload + ) end let(:transfers_api) { double('Coinbase::Client::TransfersApi') } let(:client) { double('Jimson::Client') } @@ -223,101 +251,63 @@ end end - describe '#status' do + describe '#reload' do context 'when the transaction has not been created' do - it 'returns PENDING' do - expect(transfer.status).to eq(Coinbase::Transfer::Status::PENDING) - end - end - - context 'when the transaction has been created but not signed' do - it 'returns PENDING' do - transfer.transaction - expect(transfer.status).to eq(Coinbase::Transfer::Status::PENDING) - end - end - - context 'when the transaction has been signed but not broadcast' do before do - transfer.transaction.sign(from_key) + allow(transfers_api) + .to receive(:get_transfer) + .with(transfer.wallet_id, transfer.from_address_id, transfer.id) + .and_return(broadcast_model) end it 'returns PENDING' do - expect(transfer.status).to eq(Coinbase::Transfer::Status::PENDING) + expect(transfer).to be_a(Coinbase::Transfer) + expect(transfer.reload.status).to eq(Coinbase::Transfer::Status::PENDING.to_s) end end - context 'when the transaction has been broadcast but not included in a block' do + context 'when the transaction is complete' do let(:onchain_transaction) { { 'blockHash' => nil } } subject(:transfer) do - described_class.new(broadcast_model) + described_class.new(complete_broadcast_model) end before do transfer.transaction.sign(from_key) - allow(client) - .to receive(:eth_getTransactionByHash) - .with(transfer.transaction_hash) - .and_return(onchain_transaction) - end - - it 'returns BROADCAST' do - expect(transfer.status).to eq(Coinbase::Transfer::Status::BROADCAST) - end - end - - context 'when the transaction has confirmed' do - let(:onchain_transaction) { { 'blockHash' => '0xdeadbeef' } } - let(:transaction_receipt) { { 'status' => '0x1' } } - subject(:transfer) do - described_class.new(broadcast_model) - end - - before do - transfer.transaction.sign(from_key) - allow(client) - .to receive(:eth_getTransactionByHash) - .with(transfer.transaction_hash) - .and_return(onchain_transaction) - allow(client) - .to receive(:eth_getTransactionReceipt) - .with(transfer.transaction_hash) - .and_return(transaction_receipt) + allow(transfers_api) + .to receive(:get_transfer) + .with(transfer.wallet_id, transfer.from_address_id, transfer.id) + .and_return(complete_broadcast_model) end it 'returns COMPLETE' do - expect(transfer.status).to eq(Coinbase::Transfer::Status::COMPLETE) + expect(transfer).to be_a(Coinbase::Transfer) + expect(transfer.reload.status).to eq(Coinbase::Transfer::Status::COMPLETE.to_s) end end context 'when the transaction has failed' do - let(:onchain_transaction) { { 'blockHash' => '0xdeadbeef' } } - let(:transaction_receipt) { { 'status' => '0x0' } } subject(:transfer) do described_class.new(broadcast_model) end before do - transfer.transaction.sign(from_key) - allow(client) - .to receive(:eth_getTransactionByHash) - .with(transfer.transaction_hash) - .and_return(onchain_transaction) - allow(client) - .to receive(:eth_getTransactionReceipt) - .with(transfer.transaction_hash) - .and_return(transaction_receipt) + allow(transfers_api) + .to receive(:get_transfer) + .with(transfer.wallet_id, transfer.from_address_id, transfer.id) + .and_return(failed_broadcast_model) end it 'returns FAILED' do - expect(transfer.status).to eq(Coinbase::Transfer::Status::FAILED) + expect(transfer).to be_a(Coinbase::Transfer) + expect(transfer.reload.status).to eq(Coinbase::Transfer::Status::FAILED.to_s) end end end describe '#wait!' do subject(:transfer) do - described_class.new(broadcast_model) + described_class.new(complete_broadcast_model) end before do @@ -331,41 +321,29 @@ before do transfer.transaction.sign(from_key) - allow(client) - .to receive(:eth_getTransactionByHash) - .with(transfer.transaction_hash) - .and_return(onchain_transaction) - allow(client) - .to receive(:eth_getTransactionReceipt) - .with(transfer.transaction_hash) - .and_return(transaction_receipt) + allow(transfers_api) + .to receive(:get_transfer) + .with(transfer.wallet_id, transfer.from_address_id, transfer.id) + .and_return(broadcast_model, complete_broadcast_model) end it 'returns the completed Transfer' do - expect(transfer.wait!).to eq(transfer) - expect(transfer.status).to eq(Coinbase::Transfer::Status::COMPLETE) + expect(transfer.wait!(0.001, 0.1)).to eq(transfer) + expect(transfer.status).to eq(Coinbase::Transfer::Status::COMPLETE.to_s) end end context 'when the transfer is failed' do - let(:onchain_transaction) { { 'blockHash' => '0xdeadbeef' } } - let(:transaction_receipt) { { 'status' => '0x0' } } - before do - transfer.transaction.sign(from_key) - allow(client) - .to receive(:eth_getTransactionByHash) - .with(transfer.transaction_hash) - .and_return(onchain_transaction) - allow(client) - .to receive(:eth_getTransactionReceipt) - .with(transfer.transaction_hash) - .and_return(transaction_receipt) + allow(transfers_api) + .to receive(:get_transfer) + .with(transfer.wallet_id, transfer.from_address_id, transfer.id) + .and_return(failed_broadcast_model) end it 'returns the failed Transfer' do expect(transfer.wait!).to eq(transfer) - expect(transfer.status).to eq(Coinbase::Transfer::Status::FAILED) + expect(transfer.status).to eq(Coinbase::Transfer::Status::FAILED.to_s) end end @@ -374,14 +352,14 @@ before do transfer.transaction.sign(from_key) - allow(client) - .to receive(:eth_getTransactionByHash) - .with(transfer.transaction_hash) - .and_return(onchain_transaction) + allow(transfers_api) + .to receive(:get_transfer) + .with(transfer.wallet_id, transfer.from_address_id, transfer.id) + .and_return(broadcast_model) end it 'raises a Timeout::Error' do - expect { transfer.wait!(0.2, 0.00001) }.to raise_error(Timeout::Error, 'Transfer timed out') + expect { transfer.wait!(0.0001, 0.0005) }.to raise_error(Timeout::Error, 'Transfer timed out') end end end diff --git a/spec/unit/coinbase/user_spec.rb b/spec/unit/coinbase/user_spec.rb index 494c178f..3cd7516c 100644 --- a/spec/unit/coinbase/user_spec.rb +++ b/spec/unit/coinbase/user_spec.rb @@ -100,7 +100,13 @@ expect(wallets_api) .to receive(:list_wallets) .and_return( - Coinbase::Client::WalletList.new({ 'data' => [wallet_model1, wallet_model2], 'total_count' => 2 }) + Coinbase::Client::WalletList.new( + { + 'data' => [wallet_model1, wallet_model2], + 'next_page' => 'next_page_token', + 'total_count' => 2 + } + ) ) expect(addresses_api) .to receive(:list_addresses) @@ -117,262 +123,11 @@ end it 'returns all wallets' do - wallets = user.wallets + wallets, next_page_token = user.wallets expect(wallets.size).to eq(2) expect(wallets[0].id).to eq(wallet_model1.id) expect(wallets[1].id).to eq(wallet_model2.id) - end - end - - describe '#save_wallet_locally!' do - let(:seed) { '86fc9fba421dcc6ad42747f14132c3cd975bd9fb1454df84ce5ea554f2542fbe' } - let(:address_model) do - Coinbase::Client::Address.new({ - 'address_id': '0xfbd9D61057eC1debCeEE12C62812Fb3E1d025201', - 'wallet_id': wallet_id, - 'public_key': '0x1234567890', - 'network_id': 'base-sepolia' - }) - end - let(:wallet_id) { SecureRandom.uuid } - let(:network_id) { 'base-sepolia' } - let(:wallet_model) { Coinbase::Client::Wallet.new({ 'id': wallet_id, 'network_id': network_id }) } - let(:seed_wallet) do - Coinbase::Wallet.new(wallet_model, seed: seed, address_models: [address_model]) - end - let(:user) { described_class.new(model) } - let(:addresses_api) { double('Coinbase::Client::AddressesApi') } - - let(:initial_seed_data) { JSON.pretty_generate({}) } - let(:expected_seed_data) do - { - seed_wallet.id => { - seed: seed, - encrypted: false - } - } - end - - before do - @backup_file_path = Coinbase.configuration.backup_file_path - @api_key_private_key = Coinbase.configuration.api_key_private_key - Coinbase.configuration.backup_file_path = "#{SecureRandom.uuid}.json" - Coinbase.configuration.api_key_private_key = OpenSSL::PKey::EC.generate('prime256v1').to_pem - allow(Coinbase::Client::AddressesApi).to receive(:new).and_return(addresses_api) - File.open(Coinbase.configuration.backup_file_path, 'w') do |file| - file.write(initial_seed_data) - end - end - - after do - File.delete(Coinbase.configuration.backup_file_path) - Coinbase.configuration.backup_file_path = @backup_file_path - Coinbase.configuration.api_key_private_key = @api_key_private_key - end - - it 'saves the Wallet data when encryption is false' do - saved_wallet = user.save_wallet_locally!(seed_wallet) - # Verify that the file has new wallet. - stored_seed_data = File.read(Coinbase.configuration.backup_file_path) - wallets = JSON.parse(stored_seed_data) - data = wallets[seed_wallet.id] - expect(data).not_to be_empty - expect(data['encrypted']).to eq(false) - expect(data['iv']).to eq('') - expect(data['auth_tag']).to eq('') - expect(data['seed']).to eq(seed) - expect(saved_wallet).to eq(seed_wallet) - end - - it 'saves the Wallet data when encryption is true' do - saved_wallet = user.save_wallet_locally!(seed_wallet, encrypt: true) - # Verify that the file has new wallet. - stored_seed_data = File.read(Coinbase.configuration.backup_file_path) - wallets = JSON.parse(stored_seed_data) - data = wallets[seed_wallet.id] - expect(data).not_to be_empty - expect(data['encrypted']).to eq(true) - expect(data['iv']).not_to be_empty - expect(data['auth_tag']).not_to be_empty - expect(data['seed']).not_to eq(seed) - expect(saved_wallet).to eq(seed_wallet) - end - - it 'it creates a new file and saves the wallet when the file does not exist' do - File.delete(Coinbase.configuration.backup_file_path) - saved_wallet = user.save_wallet_locally!(seed_wallet) - stored_seed_data = File.read(Coinbase.configuration.backup_file_path) - wallets = JSON.parse(stored_seed_data) - data = wallets[seed_wallet.id] - expect(data).not_to be_empty - expect(data['encrypted']).to eq(false) - expect(saved_wallet).to eq(seed_wallet) - end - - it 'it throws an error when the existing file is malformed' do - File.open(Coinbase.configuration.backup_file_path, 'w') do |file| - file.write(JSON.pretty_generate({ - malformed: 'test' - }.to_json)) - end - expect do - user.save_wallet_locally!(seed_wallet) - end.to raise_error(ArgumentError, 'Malformed backup data') - end - end - - describe '#load_wallets_from_local' do - let(:seed) { '86fc9fba421dcc6ad42747f14132c3cd975bd9fb1454df84ce5ea554f2542fbe' } - let(:address_count) { 1 } - let(:wallet_id) { SecureRandom.uuid } - let(:address_model) do - Coinbase::Client::Address.new({ - 'address_id': '0xfbd9D61057eC1debCeEE12C62812Fb3E1d025201', - 'wallet_id': wallet_id, - 'public_key': '0x1234567890', - 'network_id': 'base-sepolia' - }) - end - let(:seed_wallet) do - Coinbase::Wallet.new(model, seed: seed, address_models: [address_model]) - end - let(:user) { described_class.new(model) } - let(:addresses_api) { double('Coinbase::Client::AddressesApi') } - let(:wallet_model_with_default_address) do - Coinbase::Client::Wallet.new( - { - 'id': wallet_id, - 'network_id': 'base-sepolia', - 'default_address': address_model - } - ) - end - let(:address_list_model) do - Coinbase::Client::AddressList.new({ 'data' => [address_model], 'total_count' => 1 }) - end - let(:initial_seed_data) do - { - wallet_id => { - seed: seed, - encrypted: false - } - } - end - let(:malformed_seed_data) do - { - wallet_id => 'test' - } - end - let(:seed_data_without_seed) do - { - wallet_id => { - seed: '', - encrypted: false - } - } - end - let(:seed_data_without_iv) do - { - wallet_id => { - seed: seed, - encrypted: true, - iv: '', - auth_tag: '0x111' - } - } - end - let(:seed_data_without_auth_tag) do - { - wallet_id => { - seed: seed, - encrypted: true, - iv: '0x111', - auth_tag: '' - } - } - end - - before do - @backup_file_path = Coinbase.configuration.backup_file_path - @api_key_private_key = Coinbase.configuration.api_key_private_key - Coinbase.configuration.backup_file_path = "#{SecureRandom.uuid}.json" - Coinbase.configuration.api_key_private_key = OpenSSL::PKey::EC.generate('prime256v1').to_pem - File.open(Coinbase.configuration.backup_file_path, 'w') do |file| - file.write(JSON.pretty_generate(initial_seed_data)) - end - end - after do - File.delete(Coinbase.configuration.backup_file_path) if File.exist?(Coinbase.configuration.backup_file_path) - Coinbase.configuration.backup_file_path = @backup_file_path - Coinbase.configuration.api_key_private_key = @api_key_private_key - end - - it 'loads the Wallet from backup' do - allow(Coinbase::Client::AddressesApi).to receive(:new).and_return(addresses_api) - allow(Coinbase::Client::WalletsApi).to receive(:new).and_return(wallets_api) - expect(wallets_api).to receive(:get_wallet).with(wallet_id).and_return(wallet_model_with_default_address) - expect(addresses_api) - .to receive(:list_addresses) - .with(wallet_id, { limit: Coinbase::Wallet::MAX_ADDRESSES }) - .and_return(address_list_model) - - wallets = user.load_wallets_from_local - wallet = wallets[wallet_id] - expect(wallet).not_to be_nil - expect(wallet.id).to eq(wallet_id) - expect(wallet.default_address.id).to eq(address_model.address_id) - end - - it 'throws an error when the backup file is absent' do - File.delete(Coinbase.configuration.backup_file_path) - expect do - user.load_wallets_from_local - end.to raise_error(ArgumentError, 'Backup file not found') - end - - it 'throws an error when the backup file is corrupted' do - File.open(Coinbase.configuration.backup_file_path, 'w') do |file| - file.write(JSON.pretty_generate(malformed_seed_data)) - end - expect do - user.load_wallets_from_local - end.to raise_error(ArgumentError, 'Malformed backup data') - end - - it 'throws an error when backup does not contain seed' do - # Delete the existing file and write a new malformed file. - File.delete(Coinbase.configuration.backup_file_path) if File.exist?(Coinbase.configuration.backup_file_path) - - File.open(Coinbase.configuration.backup_file_path, 'w') do |file| - file.write(JSON.pretty_generate(seed_data_without_seed)) - end - expect do - user.load_wallets_from_local - end.to raise_error(ArgumentError, 'Malformed backup data') - end - - it 'throws an error when backup does not contain iv' do - # Delete the existing file and write a new malformed file. - File.delete(Coinbase.configuration.backup_file_path) if File.exist?(Coinbase.configuration.backup_file_path) - - File.open(Coinbase.configuration.backup_file_path, 'w') do |file| - file.write(JSON.pretty_generate(seed_data_without_iv)) - end - expect do - user.load_wallets_from_local - end.to raise_error(ArgumentError, 'Malformed encrypted seed data') - end - - it 'throws an error when backup does not contain auth_tag' do - # Delete the existing file and write a new malformed file. - File.delete(Coinbase.configuration.backup_file_path) if File.exist?(Coinbase.configuration.backup_file_path) - - File.open(Coinbase.configuration.backup_file_path, 'w') do |file| - file.write(JSON.pretty_generate(seed_data_without_auth_tag)) - end - expect do - user.load_wallets_from_local - end.to raise_error(ArgumentError, 'Malformed encrypted seed data') + expect(next_page_token).to eq('next_page_token') end end diff --git a/spec/unit/coinbase/wallet_spec.rb b/spec/unit/coinbase/wallet_spec.rb index 97197dff..586f6122 100644 --- a/spec/unit/coinbase/wallet_spec.rb +++ b/spec/unit/coinbase/wallet_spec.rb @@ -7,31 +7,41 @@ let(:model) { Coinbase::Client::Wallet.new({ 'id': wallet_id, 'network_id': network_id }) } let(:address_model1) do Coinbase::Client::Address.new( - { - 'address_id': '0x919538116b4F25f1CE01429fd9Ed7964556bf565', - 'wallet_id': wallet_id, - 'public_key': '0292df2f2c31a5c4b0d4946e922cc3bd25ad7196ffeb049905b0952b9ac48ef25f', - 'network_id': network_id - } + 'address_id': '0x919538116b4F25f1CE01429fd9Ed7964556bf565', + 'wallet_id': wallet_id, + 'public_key': '0292df2f2c31a5c4b0d4946e922cc3bd25ad7196ffeb049905b0952b9ac48ef25f', + 'network_id': network_id ) end let(:address_model2) do Coinbase::Client::Address.new( - { - 'address_id': '0xf23692a9DE556Ee1711b172Bf744C5f33B13DC89', - 'wallet_id': wallet_id, - 'public_key': '034ecbfc86f7447c8bfd1a5f71b13600d767ccb58d290c7b146632090f3a05c66c', - 'network_id': network_id - } + 'address_id': '0xf23692a9DE556Ee1711b172Bf744C5f33B13DC89', + 'wallet_id': wallet_id, + 'public_key': '034ecbfc86f7447c8bfd1a5f71b13600d767ccb58d290c7b146632090f3a05c66c', + 'network_id': network_id ) end let(:model_with_default_address) do Coinbase::Client::Wallet.new( - { - 'id': wallet_id, - 'network_id': network_id, - 'default_address': address_model1 - } + 'id': wallet_id, + 'network_id': network_id, + 'default_address': address_model1 + ) + end + + let(:model_with_seed_pending) do + Coinbase::Client::Wallet.new( + 'id': wallet_id, + 'network_id': network_id, + 'server_signer_status': 'pending_seed_creation' + ) + end + let(:model_with_seed_active) do + Coinbase::Client::Wallet.new( + 'id': wallet_id, + 'network_id': network_id, + 'default_address': address_model1, + 'server_signer_status': 'active_seed' ) end let(:seed) { '000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f' } @@ -64,6 +74,7 @@ seed: seed ) end + let(:configuration) { double('Coinbase::Configuration', use_server_signer: use_server_signer, api_client: nil) } subject(:imported_wallet) { Coinbase::Wallet.import(exported_data) } before do @@ -72,33 +83,56 @@ .to receive(:list_addresses) .with(wallet_id, { limit: 20 }) .and_return(address_list_model) + allow(Coinbase).to receive(:configuration).and_return(configuration) end - it 'imports an exported wallet' do - expect(imported_wallet.id).to eq(wallet_id) - end + context 'when not using server signer' do + let(:use_server_signer) { false } + it 'imports an exported wallet' do + expect(imported_wallet.id).to eq(wallet_id) + end - it 'loads the wallet addresses' do - expect(imported_wallet.addresses.length).to eq(address_list_model.total_count) - end + it 'loads the wallet addresses' do + expect(imported_wallet.addresses.length).to eq(address_list_model.total_count) + end - it 'contains the same seed when re-exported' do - expect(imported_wallet.export.seed).to eq(exported_data.seed) + it 'contains the same seed when re-exported' do + expect(imported_wallet.export.seed).to eq(exported_data.seed) + end end context 'when there are no addresses' do + let(:use_server_signer) { false } let(:address_list_model) { Coinbase::Client::AddressList.new({ 'data' => [], 'total_count' => 0 }) } it 'loads the wallet addresses' do expect(imported_wallet.addresses.length).to eq(0) end end + + context 'when using a server signer' do + let(:use_server_signer) { true } + + it 'imports a wallet with id' do + expect(imported_wallet.id).to eq(wallet_id) + end + + it 'loads the wallet addresses' do + expect(imported_wallet.addresses.length).to eq(address_list_model.total_count) + end + + it 'cannot export the wallet' do + expect do + imported_wallet.export + end.to raise_error 'Cannot export data for Server-Signer backed Wallet' + end + end end describe '.create' do let(:wallet_id) { SecureRandom.uuid } let(:create_wallet_request) do - { wallet: { network_id: network_id } } + { wallet: { network_id: network_id, use_server_signer: use_server_signer } } end let(:request) { { create_wallet_request: create_wallet_request } } let(:wallet_model) { Coinbase::Client::Wallet.new({ 'id': wallet_id, 'network_id': network_id }) } @@ -112,40 +146,67 @@ } ) end + let(:configuration) { double('Coinbase::Configuration', use_server_signer: use_server_signer, api_client: nil) } subject(:created_wallet) { described_class.create } before do + allow(Coinbase).to receive(:configuration).and_return(configuration) allow(wallets_api).to receive(:create_wallet).with(request).and_return(wallet_model) + end - allow(addresses_api) - .to receive(:create_address) - .with( - wallet_id, - satisfy do |opts| - public_key_present = opts[:create_address_request][:public_key].is_a?(String) - attestation_present = opts[:create_address_request][:attestation].is_a?(String) - public_key_present && attestation_present - end - ).and_return(address_model1) + context 'when not using a server signer' do + let(:use_server_signer) { false } + before do + allow(addresses_api) + .to receive(:create_address) + .with( + wallet_id, + satisfy do |opts| + public_key_present = opts[:create_address_request][:public_key].is_a?(String) + attestation_present = opts[:create_address_request][:attestation].is_a?(String) + public_key_present && attestation_present + end + ).and_return(address_model1) - allow(wallets_api) - .to receive(:get_wallet) - .with(wallet_id) - .and_return(model_with_default_address) - end + allow(wallets_api) + .to receive(:get_wallet) + .with(wallet_id) + .and_return(model_with_default_address) + end - it 'creates a new wallet' do - expect(created_wallet).to be_a(Coinbase::Wallet) - end + it 'creates a new wallet' do + expect(created_wallet).to be_a(Coinbase::Wallet) + end - it 'creates a default address' do - expect(created_wallet.default_address).to be_a(Coinbase::Address) - expect(created_wallet.addresses.length).to eq(1) + it 'creates a default address' do + expect(created_wallet.default_address).to be_a(Coinbase::Address) + expect(created_wallet.addresses.length).to eq(1) + end end context 'when setting the network ID explicitly' do let(:network_id) { 'base-mainnet' } + let(:use_server_signer) { false } + + before do + allow(addresses_api) + .to receive(:create_address) + .with( + wallet_id, + satisfy do |req| + public_key = req[:create_address_request][:public_key] + attestation = req[:create_address_request][:attestation] + + public_key.is_a?(String) && attestation.is_a?(String) + end + ).and_return(address_model1) + + allow(wallets_api) + .to receive(:get_wallet) + .with(wallet_id) + .and_return(model_with_default_address) + end subject(:created_wallet) do described_class.create(network_id: network_id) @@ -159,6 +220,58 @@ expect(created_wallet.network_id).to eq(:base_mainnet) end end + + context 'when using a server signer' do + let(:use_server_signer) { true } + before do + allow(addresses_api) + .to receive(:create_address) + .with(wallet_id, { create_address_request: {} }) + .and_return(address_model1) + + allow(wallets_api) + .to receive(:get_wallet) + .with(wallet_id) + .and_return(model_with_seed_active) + end + + subject(:created_wallet) do + described_class.create(interval_seconds: 0.2, timeout_seconds: 0.00001) + end + + it 'creates a new wallet' do + expect(created_wallet).to be_a(Coinbase::Wallet) + end + + it 'creates a default address' do + expect(created_wallet.default_address).to be_a(Coinbase::Address) + expect(created_wallet.addresses.length).to eq(1) + end + + it 'sets the default network ID' do + expect(created_wallet.network_id).to eq(:base_sepolia) + end + end + + context 'when using a server signer is not active' do + let(:use_server_signer) { true } + before do + allow(wallets_api) + .to receive(:get_wallet) + .with(wallet_id) + .and_return(model_with_seed_pending) + end + + subject(:created_wallet) do + described_class.create(interval_seconds: 0.2, timeout_seconds: 0.00001) + end + + it 'raises a Timeout::Error' do + expect do + created_wallet + end.to raise_error(Timeout::Error, 'Wallet creation timed out. Check status of your Server-Signer') + end + end end describe '#initialize' do @@ -272,6 +385,8 @@ described_class.new(model, seed: seed) end + let(:configuration) { double('Coinbase::Configuration', use_server_signer: use_server_signer, api_client: nil) } + subject(:created_address) { wallet.create_address } before do @@ -328,6 +443,27 @@ expect(created_address).not_to eq(wallet.default_address) end end + + context 'when using a server signer' do + let(:configuration) { double('Coinbase::Configuration', use_server_signer: true, api_client: nil) } + let(:created_address_model) { address_model1 } + + subject(:created_address) { wallet.create_address } + + before do + allow(addresses_api) + .to receive(:create_address) + .with(wallet_id).and_return(created_address_model) + allow(wallets_api) + .to receive(:get_wallet) + .with(wallet_id) + .and_return(model_with_default_address) + end + + it 'creates a new address' do + expect(created_address).to be_a(Coinbase::Address) + end + end end describe '#default_address' do @@ -454,32 +590,30 @@ context 'when the destination is a Wallet' do let(:destination) { other_wallet } - let(:to_address_id) { destination.default_address.id } before do allow(wallet.default_address) .to receive(:transfer) - .with(amount, asset_id, to_address_id) + .with(amount, asset_id, destination) .and_return(transfer) end - it 'creates a transfer to the default address ID' do + it 'creates a transfer from the default address to the wallet' do expect(wallet.transfer(amount, asset_id, destination)).to eq(transfer) end end - context 'when the desination is an Address' do + context 'when the destination is an Address' do let(:destination) { other_wallet.default_address } - let(:to_address_id) { destination.id } before do allow(wallet.default_address) .to receive(:transfer) - .with(amount, asset_id, to_address_id) + .with(amount, asset_id, destination) .and_return(transfer) end - it 'creates a transfer to the address ID' do + it 'creates a transfer from the default address to the address' do expect(wallet.transfer(amount, asset_id, destination)).to eq(transfer) end end @@ -494,31 +628,52 @@ .and_return(transfer) end - it 'creates a transfer to the address ID' do + it 'creates a transfer from the default address to the address ID' do expect(wallet.transfer(amount, asset_id, destination)).to eq(transfer) end end end describe '#export' do - let(:seed_wallet) do - described_class.new(model, seed: seed, address_models: [address_model1, address_model2]) + let(:configuration) { double('Coinbase::Configuration', use_server_signer: use_server_signer, api_client: nil) } + before do + allow(Coinbase).to receive(:configuration).and_return(configuration) end - it 'exports the wallet data' do - wallet_data = seed_wallet.export - expect(wallet_data).to be_a(Coinbase::Wallet::Data) - expect(wallet_data.wallet_id).to eq(seed_wallet.id) - expect(wallet_data.seed).to eq(seed) + context 'when not using a server signer' do + let(:use_server_signer) { false } + let(:seed_wallet) do + described_class.new(model, seed: seed, address_models: [address_model1, address_model2]) + end + + it 'exports the wallet data' do + wallet_data = seed_wallet.export + expect(wallet_data).to be_a(Coinbase::Wallet::Data) + expect(wallet_data.wallet_id).to eq(seed_wallet.id) + expect(wallet_data.seed).to eq(seed) + end + + it 'allows for re-creation of a Wallet' do + wallet_data = seed_wallet.export + new_wallet = described_class + .new(model, seed: wallet_data.seed, address_models: [address_model1, address_model2]) + expect(new_wallet.addresses.length).to eq(2) + new_wallet.addresses.each_with_index do |address, i| + expect(address.id).to eq(seed_wallet.addresses[i].id) + end + end end - it 'allows for re-creation of a Wallet' do - wallet_data = seed_wallet.export - new_wallet = described_class - .new(model, seed: wallet_data.seed, address_models: [address_model1, address_model2]) - expect(new_wallet.addresses.length).to eq(2) - new_wallet.addresses.each_with_index do |address, i| - expect(address.id).to eq(seed_wallet.addresses[i].id) + context 'when using a server signer' do + let(:use_server_signer) { true } + let(:wallet_without_seed) do + described_class.new(model, seed: nil, address_models: [address_model1, address_model2]) + end + + it 'does not export seed data' do + expect do + wallet_without_seed.export + end.to raise_error 'Cannot export data for Server-Signer backed Wallet' end end end @@ -562,6 +717,180 @@ end end + describe '#save_seed!' do + let(:file_path) { "#{SecureRandom.uuid}.json" } + let(:initial_seed_data) { JSON.pretty_generate({}) } + let(:seed_wallet) do + described_class.new(model_with_default_address, seed: seed, address_models: [address_model1]) + end + + before do + @api_key_private_key = Coinbase.configuration.api_key_private_key + Coinbase.configuration.api_key_private_key = OpenSSL::PKey::EC.generate('prime256v1').to_pem + File.open(file_path, 'w') do |file| + file.write(initial_seed_data) + end + end + + after do + File.delete(file_path) + Coinbase.configuration.api_key_private_key = @api_key_private_key + end + + it 'saves the seed when encrypt is false' do + seed_wallet.save_seed!(file_path, encrypt: false) + + # Verify that the file has new wallet. + stored_seed_data = File.read(file_path) + wallets = JSON.parse(stored_seed_data) + data = wallets[seed_wallet.id] + expect(data).not_to be_empty + expect(data['encrypted']).to eq(false) + expect(data['iv']).to eq('') + expect(data['auth_tag']).to eq('') + expect(data['seed']).to eq(seed) + end + + it 'saves the seed when encryption is true' do + seed_wallet.save_seed!(file_path, encrypt: true) + + # Verify that the file has new wallet. + stored_seed_data = File.read(file_path) + wallets = JSON.parse(stored_seed_data) + data = wallets[seed_wallet.id] + expect(data).not_to be_empty + expect(data['encrypted']).to eq(true) + expect(data['iv']).not_to be_empty + expect(data['auth_tag']).not_to be_empty + expect(data['seed']).not_to eq(seed) + end + + it 'throws an error when the wallet is seedless' do + seedless_wallet = described_class.new(model_with_default_address, seed: '', address_models: [address_model1]) + expect do + seedless_wallet.save_seed!(file_path) + end.to raise_error 'Wallet does not have seed loaded' + end + + it 'throws an error when the file is malformed' do + File.open(file_path, 'w') do |file| + file.write(JSON.pretty_generate({ + malformed: 'test' + }.to_json)) + end + expect do + seed_wallet.save_seed!(file_path) + end.to raise_error(ArgumentError) + end + end + + describe '#load_seed' do + let(:file_path) { "#{SecureRandom.uuid}.json" } + let(:initial_seed_data) { JSON.pretty_generate({}) } + let(:address_list_model) do + Coinbase::Client::AddressList.new( + { + 'data' => [address_model1], + 'total_count' => 1 + } + ) + end + let(:seed_wallet) do + described_class.new(model_with_default_address, seed: seed, address_models: [address_model1]) + end + let(:seedless_wallet) do + described_class.new(model_with_default_address, seed: '', address_models: [address_model1]) + end + let(:initial_seed_data) do + { + wallet_id => { + seed: seed, + encrypted: false + } + } + end + let(:other_seed_data) do + { + SecureRandom.uuid => { + seed: 'other-seed', + encrypted: false + } + } + end + let(:malformed_seed_data) do + { + wallet_id => 'test' + } + end + + before do + @api_key_private_key = Coinbase.configuration.api_key_private_key + Coinbase.configuration.api_key_private_key = OpenSSL::PKey::EC.generate('prime256v1').to_pem + File.open(file_path, 'w') do |file| + file.write(JSON.pretty_generate(initial_seed_data)) + end + end + + after do + File.delete(file_path) if File.exist?(file_path) + Coinbase.configuration.api_key_private_key = @api_key_private_key + end + + it 'loads the seed from the file' do + seedless_wallet.load_seed(file_path) + expect(seedless_wallet.can_sign?).to be true + end + + it 'loads the encrypted seed from the file' do + seed_wallet.save_seed!(file_path, encrypt: true) + seedless_wallet.load_seed(file_path) + expect(seedless_wallet.can_sign?).to be true + end + + it 'loads the encrypted seed from file with multiple seeds' do + seed_wallet.save_seed!(file_path, encrypt: true) + + other_model = Coinbase::Client::Wallet.new({ 'id': SecureRandom.uuid, 'network_id': network_id }) + other_wallet = described_class.new(other_model) + other_wallet.save_seed!(file_path, encrypt: true) + + seedless_wallet.load_seed(file_path) + expect(seedless_wallet.can_sign?).to be true + end + + it 'throws an error when the wallet is already hydrated' do + expect do + seed_wallet.load_seed(file_path) + end.to raise_error('Wallet already has seed loaded') + end + + it 'throws an error when file contains different wallet data' do + File.open(file_path, 'w') do |file| + file.write(JSON.pretty_generate(other_seed_data)) + end + + expect do + seedless_wallet.load_seed(file_path) + end.to raise_error(ArgumentError, /does not contain seed data for wallet/) + end + + it 'throws an error when the file is absent' do + File.delete(file_path) + expect do + seedless_wallet.load_seed(file_path) + end.to raise_error(ArgumentError, /does not contain seed data/) + end + + it 'throws an error when the backup file is corrupted' do + File.open(file_path, 'w') do |file| + file.write(JSON.pretty_generate(malformed_seed_data)) + end + expect do + seedless_wallet.load_seed(file_path) + end.to raise_error(ArgumentError, 'Seed data is malformed') + end + end + describe '#inspect' do it 'includes wallet details' do expect(wallet.inspect).to include(wallet_id, Coinbase.to_sym(network_id).to_s)