Files

front_end.src
  • blockchain = include_lib("/lib/blockchain.so")
  • if not blockchain then exit("Error: Missing blockchain.so library in the /lib")
  • print("WARNING: you should have a coin registered and a sub wallet too before using this script ")
  • print("if you dont you can pass the params '--setup coin_name coin_user coin_pass wallet_id wallet_pin' to create a coin and a subwallet or just the subwallet if the coins exists"+char(10))
  • if params.len == 0 then exit("registration_order wallet_id wallet_pass your_coin_name your_coin_user your_coin_password")
  • if params[0] == "--setup" then
  • coin = blockchain.get_coin(params[1], params[2], params[3])
  • if typeof(coin) != "coin" then
  • blockchain.create_coin(params[1], params[2], params[3])
  • coin = blockchain.get_coin(params[1], params[2], params[3])
  • end if
  • sub_wallet = [str(floor(99999 * rnd())), str(floor(99999 * rnd()))]
  • out = coin.create_subwallet(params[4], params[5], sub_wallet[0], sub_wallet[1])
  • print("user: "+sub_wallet[0])
  • print("pass: "+sub_wallet[1])
  • print("create subwallet out: "+out)
  • exit()
  • end if
  • wallet = login_wallet(params[0], params[1])
  • if typeof(wallet) == "string" then exit(wallet)
  • my_coin = blockchain.get_coin([params[2], params[3], params[4]])
  • if typeof(my_coin) == "string" then exit(my_coin)
  • my_coin_name = params[2]
  • wallet.cancel_pending_trade(my_coin_name)
  • pin_as_amount = ("1" + str(wallet.get_pin)).to_int
  • exit(pin_as_amount)
  • wallet.buy_coin(my_coin_name, pin, 0)
  • print(a)