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 201 forks source link

Using walletconnectV2 to connect to the wallet, there is an 'n.send is not a function' error in the offline signature #530

Open brownSocial opened 1 year ago

brownSocial commented 1 year ago

const ethAdapter = new Web3Adapter({ web3: ethWeb, signerAddress: owner, }); const safeSdk = await Safe.create({ ethAdapter: ethAdapter, safeAddress, }) let senderSignature; try { senderSignature = await safeSdk?.signTransaction(safeTransaction); } catch (error: any) { }

dependencies: "@safe-global/api-kit": "^1.3.1", "@safe-global/protocol-kit": "^1.3.0", "@safe-global/safe-core-sdk-types": "^2.3.0", "@walletconnect/ethereum-provider": "^2.8.5", "web3": "^1.8.1",

Using walletconnectV2 to connect to the wallet, there is an 'n.send is not a function' error in the offline signature。

dasanra commented 1 year ago

With the information provided is not possible to debug.

Could you please share how ethWeb and owner were defined?

Thank you!

brownSocial commented 1 year ago

With the information provided is not possible to debug.

Could you please share how ethWeb and owner were defined?

Thank you!

ethWeb uses walletconnectV2 sdk @walletconnect/ethereum-provider

const provider = await EthereumProvider.init({
      projectId: DEFAULT_PROJECT_ID || '',
      chains: [chainId],
      optionalChains: ENV_ETH_CHAIN_IDS,
      showQrModal: true,
      methods: [
        'eth_sendTransaction',
        'eth_signTransaction',
        'eth_sign',
        'personal_sign',
        'eth_signTypedData',
        'wallet_addEthereumChain',
        'wallet_switchEthereumChain',
        'eth_signTypedData_v3',
      ],
      events: [
        'chainChanged',
        'accountsChanged',
        'display_uri',
        'connect',
        'session_update',
        'session_delete',
      ],
      rpcMap,
      metadata: {
        name: 'Vault',
        description: 'Vault',
        url: APP_URL,
        icons: [APP_URL + '/logo.png'],
      },
    });
const ethWeb : any = new Web3(provider);

Owner is the wallet address

brownSocial commented 1 year ago

The provider of walletconnectV2 has no send method, send is an obsolete method according to eip1193

yksnyn commented 3 months ago

warning "workspace-aggregator-0c13e9b3-e333-4b42-9687-a80fbb1d06a5 > @safe-global/auth-kit > @web3auth/safeauth-embed > @web3auth/ws-embed@0.0.0" has unmet peer dependency "@babel/runtime