mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
92971d3c87
* Update eslint-plugin-import version * Convert JS files to use ESM * Update ESLint rules to check imports * Fix test:unit:global command env * Cleanup mock-dev script
41 lines
714 B
JavaScript
41 lines
714 B
JavaScript
const fakeWallet = {
|
|
privKey: '0x123456788890abcdef',
|
|
address: '0xfedcba0987654321',
|
|
}
|
|
const type = 'Simple Key Pair'
|
|
|
|
export default class MockSimpleKeychain {
|
|
|
|
static type () {
|
|
return type
|
|
}
|
|
|
|
constructor (opts) {
|
|
this.type = type
|
|
this.opts = opts || {}
|
|
this.wallets = []
|
|
}
|
|
|
|
serialize () {
|
|
return [ fakeWallet.privKey ]
|
|
}
|
|
|
|
deserialize (data) {
|
|
if (!Array.isArray(data)) {
|
|
throw new Error('Simple keychain deserialize requires a privKey array.')
|
|
}
|
|
this.wallets = [ fakeWallet ]
|
|
}
|
|
|
|
addAccounts (n = 1) {
|
|
for (let i = 0; i < n; i++) {
|
|
this.wallets.push(fakeWallet)
|
|
}
|
|
}
|
|
|
|
getAccounts () {
|
|
return this.wallets.map(w => w.address)
|
|
}
|
|
|
|
}
|