|
|
|
@ -1,12 +1,11 @@ |
|
|
|
|
export default function getRestrictedMethods ({ getIdentities, getKeyringAccounts }) { |
|
|
|
|
return { |
|
|
|
|
'eth_accounts': { |
|
|
|
|
method: (_, res, __, end) => { |
|
|
|
|
getKeyringAccounts() |
|
|
|
|
.then((accounts) => { |
|
|
|
|
method: async (_, res, __, end) => { |
|
|
|
|
try { |
|
|
|
|
const accounts = await getKeyringAccounts() |
|
|
|
|
const identities = getIdentities() |
|
|
|
|
res.result = accounts |
|
|
|
|
.sort((firstAddress, secondAddress) => { |
|
|
|
|
res.result = accounts.sort((firstAddress, secondAddress) => { |
|
|
|
|
if (!identities[firstAddress]) { |
|
|
|
|
throw new Error(`Missing identity for address ${firstAddress}`) |
|
|
|
|
} else if (!identities[secondAddress]) { |
|
|
|
@ -22,13 +21,10 @@ export default function getRestrictedMethods ({ getIdentities, getKeyringAccount |
|
|
|
|
return identities[secondAddress].lastSelected - identities[firstAddress].lastSelected |
|
|
|
|
}) |
|
|
|
|
end() |
|
|
|
|
}) |
|
|
|
|
.catch( |
|
|
|
|
(err) => { |
|
|
|
|
} catch (err) { |
|
|
|
|
res.error = err |
|
|
|
|
end(err) |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|