A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ciphermask/test/lib/mock-simple-keychain.js

39 lines
708 B

var fakeWallet = {
privKey: '0x123456788890abcdef',
address: '0xfedcba0987654321',
}
const type = 'Simple Key Pair'
module.exports = class MockSimpleKeychain {
static type () { return type }
8 years ago
constructor (opts) {
this.type = type
this.opts = opts || {}
this.wallets = []
}
8 years ago
serialize () {
return [ fakeWallet.privKey ]
}
8 years ago
deserialize (data) {
if (!Array.isArray(data)) {
throw new Error('Simple keychain deserialize requires a privKey array.')
}
this.wallets = [ fakeWallet ]
}
8 years ago
addAccounts (n = 1) {
for (var i = 0; i < n; i++) {
this.wallets.push(fakeWallet)
}
}
8 years ago
getAccounts () {
return this.wallets.map(w => w.address)
}
}