Skip to content

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

@Anton-Mushnin

Description

@Anton-Mushnin

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);
            }
        }

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