safe-global / safe-core-sdk

The Safe{Core} SDK allows builders to add account abstraction functionality into their apps.
https://docs.safe.global/sdk/overview
MIT License
253 stars 193 forks source link

Safe.create throws all sorts of errors if you provide contract address that is not a safe #72

Open mmv08 opened 2 years ago

mmv08 commented 2 years ago

Description

Safe user reported the following problem:

I try to Safe.create() to an existing contract that is NOT a safe, it throws all sorts of connection issues instead of a nice error > message. Basically I need a way of checking if an address is a safe. It works fine if the provided address is an EOA

Environment

Steps to reproduce

Call safe.create() with a contract address that is not a Safe

Expected result

A good error message and a method to check if an address is a safe

Additional context

[  Error: missing revert data in call exception (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":49,\"error\":{\"code\":-32000,\"message\":\"execution reverted\"}}"
,  "error":{"code":-32000},"requestBody":"{\"method\":\"eth_call\",\"params\":[{\"from\":\"0xb64ff7a4a33acdf48d97dab0d764afd0f6176882\",\"to\":\"0x9fde8abd74998779fe90383e74666ea7387d4bb1\",\"data\":\"0x2f54bf6e0000000
0  0000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882\"},\"latest\"],\"id\":49,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://rinkeby.infura.io/v3/"}, data="0x", code=
C  ALL_EXCEPTION, version=providers/5.4.3)

  - index.js:199 Logger.makeError
    [synthetix]/[@ethersproject]/logger/lib/index.js:199:21

  - index.js:208 Logger.throwError
    [synthetix]/[@ethersproject]/logger/lib/index.js:208:20

  - json-rpc-provider.js:76 checkError
    [synthetix]/[@ethersproject]/providers/lib/json-rpc-provider.js:76:16

  - json-rpc-provider.js:633 JsonRpcProvider.<anonymous>
    [synthetix]/[@ethersproject]/providers/lib/json-rpc-provider.js:633:47

  - json-rpc-provider.js:48 step
    [synthetix]/[@ethersproject]/providers/lib/json-rpc-provider.js:48:23

  - json-rpc-provider.js:29 Object.throw
    [synthetix]/[@ethersproject]/providers/lib/json-rpc-provider.js:29:53

  - json-rpc-provider.js:21 rejected
    [synthetix]/[@ethersproject]/providers/lib/json-rpc-provider.js:21:65

  - task_queues.js:95 processTicksAndRejections
    internal/process/task_queues.js:95:5
yagopv commented 1 year ago

Is this happening yet @germartinez ? The issue went through several status changes ...