Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metamask extension throws an error in populateFunctionParams after an update #531

Open
Anton-Mushnin opened this issue Sep 21, 2024 · 0 comments

Comments

@Anton-Mushnin
Copy link

https://github.com/OffchainLabs/arbitrum-sdk/blame/792a7ee3ccf09842653bc49b771671706894cbb4/src/lib/message/ParentToChildMessageGasEstimator.ts#L327C7-L327C7

        catch (err) {
            // ethersjs currently doesnt throw for custom solidity errors, so we shouldn't end up here
            // however we try to catch and parse the error anyway in case ethersjs changes
            // behaviour and we dont pick up on it
            retryable = retryableData_1.RetryableDataTools.tryParseError(err);
            if (!(0, lib_1.isDefined)(retryable)) {
                throw new errors_1.ArbSdkError('No retryable data found in error', err);
            }
        }

Metamask extension throws an error in populateFunctionParams after a recent update, so we do end up here

original error is stored at
err.error.data.originalError.data

I was able to fix this issue in my setup by modifying the catch block as follows:

        catch (err) {
            // ethersjs currently doesnt throw for custom solidity errors, so we shouldn't end up here
            // however we try to catch and parse the error anyway in case ethersjs changes
            // behaviour and we dont pick up on it
            const res = err.error?.data?.originalError?.data ?? err
            retryable = retryableData_1.RetryableDataTools.tryParseError(res);
            if (!(0, lib_1.isDefined)(retryable)) {
                throw new errors_1.ArbSdkError('No retryable data found in error', err);
            }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant