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

Add ERC-7846: Wallet Connection API #779

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

ilikesymmetry
Copy link

@ilikesymmetry ilikesymmetry commented Dec 17, 2024

This proposal defines a new RPC for wallet connection with an emphasis on extensibility. Builds on the notion of optional “capabilities” defined in ERC-5792 to add new functionality modularly. This proposal defines one capability to reduce separate interactions for connection and authentication, but otherwise seeks to leave capability definitions open-ended.

@eip-review-bot
Copy link
Collaborator

eip-review-bot commented Dec 17, 2024

File ERCS/erc-7846.md

Requires 1 more reviewers from @g11tech, @lightclient, @SamWilsn, @xinbenlv

@github-actions github-actions bot added the w-ci label Dec 17, 2024
Comment on lines 38 to 44
type WalletConnectResult = {
account: {
address: `0x${string}`; // connected account address
supportedChainsAndCapabilities: Record<`0x${string}`,any>; // chain-specific capabilities, mirrors ERC-5792 wallet_getCapabilities
},
capabilityResults: Record<string,any>; // results of this connection request's connection capabilities
}
Copy link

@jxom jxom Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speaking on behalf of the larger Wagmi consumers, I would really appreciate if this supported multiple Accounts.

Suggested change
type WalletConnectResult = {
account: {
address: `0x${string}`; // connected account address
supportedChainsAndCapabilities: Record<`0x${string}`,any>; // chain-specific capabilities, mirrors ERC-5792 wallet_getCapabilities
},
capabilityResults: Record<string,any>; // results of this connection request's connection capabilities
}
type WalletConnectResult = {
address: `0x${string}`; // connected account address
supportedChainsAndCapabilities: Record<`0x${string}`,any>; // chain-specific capabilities, mirrors ERC-5792 wallet_getCapabilities
capabilityResults: Record<string,any>; // results of this connection request's connection capabilities
}[]

While the point of "By constraining the account return to a single address, this ERC simplifies developer experience while still supporting richer capability results." is made, I don't really see how supporting multiple accounts with their capabilities really degrades developer experience as 99% of the time applications will be using developer tooling that abstracts over these JSON-RPC methods (ie. Wagmi Connectors, etc).

Even if no developer tooling existed, I still don't think DX would be degraded as applications could just use the first item in the array anyway, and ignore the others (this was Wagmi behavior pre-v1). In fact, user experience would be moreso degraded as users would have to "disconnect their current account, and then connect their other account" to achieve previous behavior.

I think capabilities per-account also makes sense, because you wouldn't really be able to specify fine-grained capabilities (per-account) in the request anyway, so it would always be implied that it is batched across all accounts (for example, a SIWE signature for each account).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough feedback! Will reply in your repost on the Eth Magicians forum.

type WalletConnectResult = {
account: {
address: `0x${string}`; // connected account address
supportedChainsAndCapabilities: Record<`0x${string}`,any>; // chain-specific capabilities, mirrors ERC-5792 wallet_getCapabilities
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
supportedChainsAndCapabilities: Record<`0x${string}`,any>; // chain-specific capabilities, mirrors ERC-5792 wallet_getCapabilities
chains: `0x${string}`[]; // supported chains

Should this just be an array of supported chains? Consumers can use wallet_getCapabilities to extract capabilities from a Wallet.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent was to remove the need to make a separate wallet_getCapabilities request. That may not be necessary at API layer though because SDKs could do this automatically for apps.

address: `0x${string}`; // connected account address
supportedChainsAndCapabilities: Record<`0x${string}`,any>; // chain-specific capabilities, mirrors ERC-5792 wallet_getCapabilities
},
capabilityResults: Record<string,any>; // results of this connection request's connection capabilities
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
capabilityResults: Record<string,any>; // results of this connection request's connection capabilities
capabilities: Record<string,any>; // results of this connection request's connection capabilities

capabilities for consistency? "result" seems implied as the consumer will be extracting it from a response anyway, and we don't call it capabilitiesRequest.

}

type SignInWithEthereumCapabilityResult = {
message: string, // formatted SIWE message
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
message: string, // formatted SIWE message

Do we need the message? I thought the wallet would be the one displaying the formatted message.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was thinking that the app needs to verify that the message the wallet prompted signing for matches their requested arguments. For instance a malicious wallet could attempt to reuse an old expiry/nonce if it had access to a previously signed SIWE message. The most succinct way to send back all fields and verify against the signature is to pass back the final message

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Makes sense!

@ilikesymmetry ilikesymmetry changed the title Add ERC: Wallet Connection API Add ERC-7846: Wallet Connection API Dec 20, 2024
@github-actions github-actions bot added w-ci and removed w-ci labels Dec 20, 2024
ERCS/erc-7846.md Outdated
}

type SignInWithEthereumCapabilityResult = {
message: string, // formatted SIWE message
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might also be nice to add a payload property so consumers don't have to parse the message string to figure out the inferred parameters (e.g. address, domain, etc)?

Suggested change
message: string, // formatted SIWE message
message: string, // formatted SIWE message
payload: {
address: `0x{string}`,
nonce: string,
...
},

Copy link

@jakeshelly jakeshelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need changes

Copy link

github-actions bot commented Jan 7, 2025

The commit abd1c9f (as a parent of 39612d2) contains errors.
Please inspect the Run Summary for details.

@pedrouid
Copy link
Contributor

pedrouid commented Jan 8, 2025

While I understand the motivation for creating EVM-specific standards for Wallets... there is nothing new or extra that ERC-7846 provides that isn't already covered by CAIP-222

https://chainagnostic.org/CAIPs/caip-222

Why restrict such an important pattern like "Connect + Sign" to only EVM wallets?

@johanneskares
Copy link

This proposal defines a new RPC for wallet connection with an emphasis on extensibility. Builds on the notion of optional “capabilities” defined in ERC-5792 to add new functionality modularly. This proposal defines one capability to reduce separate interactions for connection and authentication, but otherwise seeks to leave capability definitions open-ended.

one huge problem still:

For passkey wallets, e.g. Signing Up with Coinbase Smart Wallet, you would still need 2 interactions with this ERC. First TouchID to get the Ethereum Address, second one to sign the message. Sign In With Ethereum is not a good solution. The address should not be part of the signed message. It's implicit from the signature.

I'd suggest changing this ERC to allow signing an arbitrary message, makes it simpler and leaves the kind of signature to the dApp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants