aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/auto-faucet.js
blob: 38d54ba5e6208f16625574992f23a33e4a581d86 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const uri = 'https://faucet.metamask.io/'
const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
const env = process.env.METAMASK_ENV

module.exports = function (address) {
  // Don't faucet in development or test
  if (METAMASK_DEBUG === true || env === 'test') return
  global.log.info('auto-fauceting:', address)
  const data = address
  const headers = new Headers()
  headers.append('Content-type', 'application/rawdata')
  fetch(uri, {
    method: 'POST',
    headers,
    body: data,
  })
  .catch((err) => {
    console.error(err)
  })
}