Class: ArkEcosystem::Crypto::Builder::DelegateRegistration

Inherits:
Transaction
  • Object
show all
Defined in:
lib/arkecosystem/crypto/builder/delegate_registration.rb

Overview

The builder for delegate registration transactions.

Instance Attribute Summary

Attributes inherited from Transaction

#amount, #asset, #fee, #id, #recipient_id, #sender_public_key, #sign_signature, #signature, #timestamp, #vendor_field

Instance Method Summary collapse

Methods inherited from Transaction

#initialize, #second_sign, #second_verify, #sign_and_create_id, #to_hash, #to_params, #verify

Constructor Details

This class inherits a constructor from ArkEcosystem::Crypto::Builder::Transaction

Instance Method Details

#set_username(username) ⇒ Object



12
13
14
15
# File 'lib/arkecosystem/crypto/builder/delegate_registration.rb', line 12

def set_username(username)
  @username = username
  self
end

#sign(secret) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/arkecosystem/crypto/builder/delegate_registration.rb', line 17

def sign(secret)
  @asset = {
    delegate: {
      username: @username,
      public_key: ArkEcosystem::Crypto::Identity::PublicKey.from_secret_as_hex(secret)
    }
  }
  sign_and_create_id(secret)
end

#typeObject



27
28
29
# File 'lib/arkecosystem/crypto/builder/delegate_registration.rb', line 27

def type
  ArkEcosystem::Crypto::Enums::Types::DELEGATE_REGISTRATION
end