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: Wallet Signing API #874

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lukasrosario
Copy link
Contributor

  • adds new ERC defining a wallet signing API

@eip-review-bot
Copy link
Collaborator

eip-review-bot commented Jan 29, 2025

File ERCS/erc-draft-wallet-sign-api.md

Requires 1 more reviewers from @lightclient, @SamWilsn

version: string;
address?: `0x${string}`;
request: {
type: `0x${string}`; // 1-byte EIP-191 version
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should probably be version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ie

...
request: {
  version: `0x{string}`
  data: any;
}
...

Choose a reason for hiding this comment

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

taking the naming convention from 191 makes sense, but I think the confusion with the top-level version parameter is a net negative

Copy link

Choose a reason for hiding this comment

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

Yeah, version is kinda ambiguous because it also exists as a top-level property. Think type is fine IMHO. They are analogous to transaction types.

Comment on lines +64 to +67
type SignResult = {
signature: `0x${string}`;
capabilities?: Record<string, any>;
};
Copy link

@ilikesymmetry ilikesymmetry Jan 30, 2025

Choose a reason for hiding this comment

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

Should the user's account also be returned always too? If an app doesn't provide it on request, it probably needs it to verify the signature. Smart contract accounts likely also need chain-specificity (e.g. ERC-7739).

Suggested change
type SignResult = {
signature: `0x${string}`;
capabilities?: Record<string, any>;
};
type SignResult = {
account: {
chainId: `0x${string}`;
address: `0x${string}`;
};
signature: `0x${string}`;
capabilities?: Record<string, any>;
};

Copy link

Choose a reason for hiding this comment

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

Maybe just have address and chainId on top level?

Choose a reason for hiding this comment

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

The intent is for those to be optional though, allowing apps to request a signature without a previous connection step.

Choose a reason for hiding this comment

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

Maybe this and the optional arg should be CAIP-10. I don't like how the chainId of the CAIP-10 address could diverge from the chainId of the inner type (e.g. 712), but maybe that's just extra parsing on the side of the wallet.

Comment on lines +90 to +92
data: {
...TypedData // TypedData as defined by EIP-712
}

Choose a reason for hiding this comment

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

Think clarity improves if we just lay out this type completely

Suggested change
data: {
...TypedData // TypedData as defined by EIP-712
}
data: {
domain: {
chainId?: `0x${string}`;
name?: string;
version?: string;
verifyingContract?: `0x${string}`;
salt?: `0x${string}`;
};
types: Record<string, { name: string; type: string; }[]>;
primaryType: string;
message: Record<string, any>
}

requires: 191, 712, 5792
---

## Abstract

Choose a reason for hiding this comment

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

The abstract mentions the new JSON-RPC method, it doesn’t provide a high-level overview of how it works. For example:
What is the name of the new JSON-RPC method?
How does the interaction between the app and wallet work in practice?
What is the expected flow for requesting and receiving signatures?


The top-level `version` parameter is for specifying the version of `wallet_sign` should the top-level interface change.

The `request.type` parameter is for specifying the [EIP-191](./eip-191.md) `signed_data` `version` (e.g. `0x01` for structured data, `0x45` for `personal_sign` messaged). The `request.data` parameter is the corresponding data according to the `signed_data` `version`.

Choose a reason for hiding this comment

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

Suggested change
The `request.type` parameter is for specifying the [EIP-191](./eip-191.md) `signed_data` `version` (e.g. `0x01` for structured data, `0x45` for `personal_sign` messaged). The `request.data` parameter is the corresponding data according to the `signed_data` `version`.
The `request.type` parameter is for specifying the [EIP-191](./eip-191.md) `signed_data` `version` (e.g. `0x01` for structured data, `0x45` for `personal_sign` messages). The `request.data` parameter is the corresponding data according to the `signed_data` `version`.

Copy link

The commit d332df8 (as a parent of 7d682c6) contains errors.
Please inspect the Run Summary for details.

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.

5 participants