safe-apps-sdk icon indicating copy to clipboard operation
safe-apps-sdk copied to clipboard

Feature request: expose the user (EOA) wallet provider

Open ubinatus opened this issue 1 year ago • 5 comments

Hello team. Was wondering if there is any intention on exposing the connected user EOA wallet on the @safe-global/safe-apps-sdk dependency so that we could interact with the EOA wallet (User, i.e. one of the owners of the multisig) and not the smart contract wallet (multisig).

I believe the use case for this would be for those Safe Apps that has an an internal authentication method (e.g. SIWE) for users through message signatures (personal_sign) but don't want to force the user to use the sdk.txs.signMessage(message) for obvious reasons: ~~i) don't care if EOA is actually a valid owner~~ and ii) takes time to wait for all owners to approve the message and execute the Gnosis Safe: Sign Message Library and you won't like to wait that whole process just for interacting with the DApp.

-> The way it can be currently handled (just for injected EOA)
    const w = window as any;
    const provider = new Web3Provider(w.ethereum); // `w.ethereum` is the injected provider from SafeApp
    const signer = provider.getSigner();
    const signature = await signer.signMessage(custom_siwe_message);
    // -> custom authentication logic using `signature` and the `signer` address

Tentative feature

    const provider = await appsSdk.eth.getUserProvider();
    const signer = provider.getSigner(); // or any provider-dependent method to retrieve the signer
    const signature = await signer.signMessage(custom_siwe_message); // or any provider-dependent method to retrieve the signer
    // -> custom authentication logic using `signature` and the `signer` address

In other words: "As SafeApp developer, I would like to also interact directly with the wallet provider of the connected user."

Would love your feedback on this 🥰. In case this is doable, I would be happy to create a PR for it.

ubinatus avatar Apr 05 '23 17:04 ubinatus