code: function parseArgs (f) {
    return function (args, opts, callback) {
      var credentials = auth(opts.req)
      var guid = credentials.name
      var walletOpts = { password: credentials.pass, apiCode: apiCode }
  
      if (!guid) throw 'Missing wallet guid'
      if (!walletOpts.password) throw 'Missing wallet password'
  
      if (args.length > f.$params.length) {
        throw 'Expected max of ' + f.$params.length + ' parameters, received ' + args.length
      }
  
      var params = f.$params
        .map(function (param, i) {
          return {
            name: param.split('?')[0],
            value: args[i],
            required: !~param.indexOf('?')
          }
        })
        .reduce(function (acc, param) {
          if (param.value == null && param.required) throw 'Missing parameter: ' + param.name
          acc[param.name] = param.value
          return acc
        }, {})
  
      var action = f.$nowallet
        ? Promise.resolve(f(params))
        : api.getWallet(guid, walletOpts).then(f.bind(f, params))
  
      action
        .then(callback.bind(null, null))
        .catch(callback)
    }
  }
docs: Helper functions