Changes introduced in PR 60 have side effects due to the differences in how Metamask and Tally handle querying of ethereum data. Where new Eth(ethereum).getAccounts(); in
|
async function requiresAuthDialog(ethereum) { |
|
let [account, _] = await new Eth(ethereum).getAccounts(); |
|
|
|
return !account; |
|
} |
gives an error: code: 4100, message: 'The requested method and/or account has not been authorized by the user.' error. instead of an empty array.
The issue also arises in other sections of the eth.js file for multiple functions:
|
function withTrxWeb3(eth, fnTrxWeb3, fnEls) { |
|
if (eth.trxEth) { |
|
let res = fnTrxWeb3(eth.trxEth, eth.trxEth.trxPromise); |
|
eth.trxEth.trxPromise = res; |
|
return res; |
|
} else { |
|
return fnEls(); |
|
} |
|
} |
|
async function getNetworkId(eth) { |
|
return withTrxWeb3( |
|
eth, |
|
(trxEth) => trxEth.net.getId(), |
|
() => eth.defaultNetworkId |
|
); |
|
} |
|
async function getAccounts(eth) { |
|
return withTrxWeb3( |
|
eth, |
|
(trxEth) => trxEth.getAccounts(), |
|
() => (eth.showAccount ? [eth.showAccount] : []) |
|
); |
|
} |
A workaround needs to be put in place to address this. On the first pass, an attempt was made to capture with a try catch statement but this has consequences when sending transactions and handling state while using Tally.
Changes introduced in PR 60 have side effects due to the differences in how Metamask and Tally handle querying of ethereum data. Where
new Eth(ethereum).getAccounts();incompound-components/src/js/sharedEth/connectors.js
Lines 68 to 72 in 75fa6c7
gives an error:
code: 4100, message: 'The requested method and/or account has not been authorized by the user.' error.instead of an empty array.The issue also arises in other sections of the eth.js file for multiple functions:
compound-components/src/js/sharedEth/eth.js
Lines 374 to 382 in 75fa6c7
compound-components/src/js/sharedEth/eth.js
Lines 465 to 471 in 75fa6c7
compound-components/src/js/sharedEth/eth.js
Lines 485 to 491 in 75fa6c7
A workaround needs to be put in place to address this. On the first pass, an attempt was made to capture with a try catch statement but this has consequences when sending transactions and handling state while using Tally.