Skip to content

Tally Integration Error Handling #65

@0xzoz

Description

@0xzoz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions