Class: Mobius::Cli::Create
Constant Summary collapse
- TEMPLATE =
File.join(File.dirname(__FILE__), "../../../template/dev-wallet.html.erb").freeze
Instance Method Summary collapse
- #account ⇒ Object
-
#dapp_account ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength.
- #dev_wallet ⇒ Object
Instance Method Details
#account ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/mobius/cli/create.rb', line 26 def account keypair = create_account say " * Public Key: #{keypair.address}" say " * Private Key: #{keypair.seed}" say " * XLM balance: #{Mobius::Client::Blockchain::Account.new(keypair).balance(:native)}" say "Done!" rescue StandardError => e say "[ERROR] #{e.}", :red end |
#dapp_account ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mobius/cli/create.rb', line 8 def dapp_account keypair = create_dapp_account say " * Public Key: #{keypair.address}" say " * Private Key: #{keypair.seed}" say " * MOBI balance: #{Mobius::Client::Blockchain::Account.new(keypair).balance}" if ["application"] app_keypair = Mobius::Client.to_keypair(["application"]) add_cosigner(keypair, app_keypair) end say "Done!" rescue StandardError => e say "[ERROR] #{e.}", :red end |
#dev_wallet ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/mobius/cli/create.rb', line 39 def dev_wallet app_keypair = create_dapp_account(0) normal_keypair = create_dapp_account(1000) add_cosigner(normal_keypair, app_keypair) zero_balance_keypair = create_dapp_account(0) = create_account vars = { app: app_keypair, normal: normal_keypair, zero_balance: zero_balance_keypair, unauthorized: } t = File.read(TEMPLATE) r = ERB.new(t).result(OpenStruct.new(vars).instance_eval { binding }) File.open("dev-wallet.html", "w+") { |f| f.puts r } say "dev-wallet.html created. Copy it to your public web server directory and do not forget to change the URL!" rescue StandardError => e say "[ERROR] #{e.}", :red end |