lib/reth/account_service.rb
def find(identifier)
      identifier = identifier.downcase

      if identifier =~ /\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/ # uuid
        return get_by_id(identifier)
      end

      begin
        address = Address.new(identifier).to_bytes
        raise AssertError unless address.size == 20
        return self[address]
      rescue
        # do nothing
      end

      index = identifier.to_i
      raise ValueError, 'Index must be 1 or greater' if index <= 0
      raise KeyError if index > @accounts.size
      @accounts[index-1]
    end
##
# Find an account by either its address, its id, or its index as string.
#
# Example identifiers:
#
# - '9c0e0240776cfbe6fa1eb37e57721e1a88a563d1' (address)
# - '0x9c0e0240776cfbe6fa1eb37e57721e1a88a563d1' (address with 0x prefix)
# - '01dd527b-f4a5-4b3c-9abb-6a8e7cd6722f' (UUID)
# - '3' (index)
#
# @param identifier [String] the accounts hex encoded, case insensitive
#   address (with optional 0x prefix), its UUID or its index (as string,
#   >= 1)
#
# @raise [ValueError] if the identifier could not be interpreted
# @raise [KeyError] if the identified account is not known to the account
#   service
#
Find an account by either its address, its id, or its index as string.
Example identifiers.


Find an account by either its address its id or its index as string . Example identifiers .
def find(identifier)
      identifier = identifier.downcase
      if identifier =~ /\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/ 
        return get_by_id(identifier)
      end
      begin
        address = Address.new(identifier).to_bytes
        raise AssertError unless address.size == 20
        return self[address]
      rescue
      end
      index = identifier.to_i
      raise ValueError, 'Index must be 1 or greater' if index <= 0
      raise KeyError if index > @accounts.size
      @accounts[index-1]
    end
def find ( identifier ) identifier = identifier . downcase if identifier =~ / \A [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} \z / return get_by_id ( identifier ) end begin address = Address . new ( identifier ) . to_bytes raise AssertError unless address . size == 20 return self [ address ] rescue end index = identifier . to_i raise ValueError , 'Index must be 1 or greater' if index <= 0 raise KeyError if index > @accounts . size @accounts [ index - 1 ] end
Find an account by either its address, its id, or its index as string.
Find an account by either its address its id or its index as string .
# uuid # do nothing
[ValueError] if the identifier could not be interpreted
[ ValueError ] if the identifier could not be interpreted
[KeyError] if the identified account is not known to the account service
[ KeyError ] if the identified account is not known to the account service
identifier
the accounts hex encoded, case insensitive address (with optional 0x prefix), its UUID or its index (as string, >= 1)
the accounts hex encoded case insensitive address ( with optional 0x prefix ) its UUID or its index ( as string > = 1 )