Method: IOSTSdk::Main#new_account

Defined in:
lib/iost_sdk.rb

#new_account(name:, creator:, owner_key:, active_key:, initial_ram:, initial_gas_pledge:) ⇒ Object

Create an instance IOSTSdk::Models::Transaction to create a new account

Parameters:

  • name (String)

    the name of the account to be created

  • creator (String)

    the name of the account that’s creating a new account

  • owner_key (IOSTSdk::Crypto::KeyPair)

    the owner key of the new account

  • active_key (IOSTSdk::Crypto::KeyPair)

    the active key of the new account

  • initial_ram (Integer)

    the initial RAM of the new account

  • initial_gas_pledge (Integer)

    the initial gas pledge of the new account



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
# File 'lib/iost_sdk.rb', line 134

def (name:, creator:, owner_key:, active_key:, initial_ram:, initial_gas_pledge:)
  transaction = init_transaction
  transaction.add_action(
    contract_id: 'auth.iost',
    action_name: :signUp,
    action_data: [name, owner_key.id, active_key.id]
  )

  if initial_ram > 10
    transaction.add_action(
      contract_id: 'ram.iost',
      action_name: :buy,
      action_data: [creator, name, initial_ram]
    )
  end

  if initial_gas_pledge > 0
    transaction.add_action(
      contract_id: 'ram.iost',
      action_name: :buy,
      action_data: [creator, name, initial_gas_pledge.to_s]
    )
  end
  transaction.set_time_params(
    expiration: expiration,
    delay: delay,
    server_time_diff: server_time_diff
  )

  @transaction = transaction

  self
end