2016-11-03 18:42:34 +01:00
|
|
|
const uri = 'https://faucet.metamask.io/'
|
|
|
|
const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
|
2016-11-03 19:22:10 +01:00
|
|
|
const env = process.env.METAMASK_ENV
|
2016-03-29 21:21:46 +02:00
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
module.exports = function (address) {
|
2017-04-05 03:23:46 +02:00
|
|
|
// Don't faucet in development or test
|
|
|
|
if (METAMASK_DEBUG || env === 'test') return
|
|
|
|
global.log.info('auto-fauceting:', address)
|
|
|
|
const data = address
|
|
|
|
const headers = new Headers()
|
2017-04-04 14:55:48 +02:00
|
|
|
headers.append('Content-type', 'application/rawdata')
|
|
|
|
fetch(uri, {
|
|
|
|
method: 'POST',
|
|
|
|
headers,
|
|
|
|
body: data,
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
console.error(err)
|
|
|
|
})
|
2016-03-29 21:21:46 +02:00
|
|
|
}
|