 check_account = (id, cb) ->
   remote.connect ->
     request = remote.requestAccountInfo(id)
-    request.callback (err, resp) ->
-      cb resp, err
-      remote.disconnect()
+    request.callback cb
     request.request()
 
 default_amt = Amount.from_human(tip_amount + "STR")
-tip_account = (id, amt, cb) ->
+tip_account = (address, amt, cb) ->
   if not cb and amt
     cb = amt
     amt = null
-  remote.set_secret(account_id, account_secret)
+  amt = amt && Amount.from_human(amt + "STR")
   remote.connect ->
+    remote.set_secret(stripler_id, stripler_secret)
     transaction = remote.transaction()
     transaction.payment(
-      from: account_id
-      to: id
+      from: stripler_id
+      to: address
       amount: amt or default_amt
     )
-    transaction.on 'error', cb
-    transaction.on 'success', cb
-    transaction.submit()
+    transaction.submit(cb)

Remote = require('stellar-lib').Remote
Amount = require('stellar-lib').Amount

account_id = process.env.STRIPLER_ACCOUNT_ID
account_secret = process.env.STRIPLER_ACCOUNT_SECRET
tip_amount = 1
last_tipped = null
rate_limit = 60 * 1000 # 60s

  trusted: true
  #trace: true
  servers: servers
)

module.exports = (robot) ->
