Skip to content

Commit 283ac19

Browse files
committed
Merge pull request #90 from MetaMask/IndicateFauceting
Add mayBeFauceting boolean to account object
2 parents c4bf8fc + 2d6a82e commit 283ac19

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

app/scripts/lib/idStore.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const extend = require('xtend')
99
const createId = require('web3-provider-engine/util/random-id')
1010
const autoFaucet = require('./auto-faucet')
1111
const configManager = require('./config-manager-singleton')
12+
const DEFAULT_RPC = 'https://rawtestrpc.metamask.io/'
1213

1314

1415
module.exports = IdentityStore
@@ -211,12 +212,28 @@ IdentityStore.prototype._loadIdentities = function(){
211212
name: 'Wallet ' + (i+1),
212213
img: 'QmW6hcwYzXrNkuHrpvo58YeZvbZxUddv69ATSHY3BHpPdd',
213214
address: address,
215+
mayBeFauceting: this._mayBeFauceting(i),
214216
}
215217
this._currentState.identities[address] = identity
216218
})
217219
this._didUpdate()
218220
}
219221

222+
// mayBeFauceting
223+
// If on testnet, index 0 may be fauceting.
224+
// The UI will have to check the balance to know.
225+
// If there is no balance and it mayBeFauceting,
226+
// then it is in fact fauceting.
227+
IdentityStore.prototype._mayBeFauceting = function(i) {
228+
var config = configManager.getProvider()
229+
if (i === 0 &&
230+
config.type === 'rpc' &&
231+
config.rpcTarget === DEFAULT_RPC) {
232+
return true
233+
}
234+
return false
235+
}
236+
220237
//
221238
// keyStore managment - unlocking + deserialization
222239
//

0 commit comments

Comments
 (0)