Class: Coinbase::ServerSigner

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

Overview

A representation of a Server-Signer. Server-Signers are assigned to sign transactions for a Wallet.

Defined Under Namespace

Modules: Status

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ ServerSigner

Returns a new Server-Signer object. Do not use this method directly. Instead, use ServerSigner.default.



40
41
42
# File 'lib/coinbase/server_signer.rb', line 40

def initialize(model)
  @model = model
end

Class Method Details

.defaultCoinbase::ServerSigner

Returns the default ServerSigner for the CDP Project.

Returns:



22
23
24
25
26
27
28
29
30
# File 'lib/coinbase/server_signer.rb', line 22

def default
  response = Coinbase.call_api do
    server_signers_api.list_server_signers
  end

  raise 'No Server-Signer is associated with the project' if response.data.empty?

  new(response.data.first)
end

Instance Method Details

#idString

Returns the Server-Signer ID.

Returns:

  • (String)

    the Server-Signer ID



46
47
48
# File 'lib/coinbase/server_signer.rb', line 46

def id
  @model.server_signer_id
end

#inspectString

Same as to_s.

Returns:

  • (String)

    a string representation of the Server-Signer



64
65
66
# File 'lib/coinbase/server_signer.rb', line 64

def inspect
  to_s
end

#to_sString

Returns a string representation of the Server-Signer.

Returns:

  • (String)

    a string representation of the Server-Signer



58
59
60
# File 'lib/coinbase/server_signer.rb', line 58

def to_s
  "Coinbase::ServerSigner{server_signer_id: '#{id}', wallets: [#{wallets.join(', ')}]}"
end

#walletsArray<String>

Returns the IDs of the Wallet’s the Server-Signer can sign for.

Returns:

  • (Array<String>)

    the wallet IDs



52
53
54
# File 'lib/coinbase/server_signer.rb', line 52

def wallets
  @model.wallets
end