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 Asset Discovery #709

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

Conversation

lukaisailovic
Copy link

JSON-RPC method for wallets to share a user’s complete asset list with Dapps, including assets not easily discoverable through on-chain information alone.

@eip-review-bot
Copy link
Collaborator

eip-review-bot commented Nov 8, 2024

File ERCS/erc-7811.md

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

@eip-review-bot eip-review-bot changed the title Add ERC: Wallet Asset Discovery Add ERC: Wallet Asset Discovery ERC Nov 8, 2024
@github-actions github-actions bot added the w-ci label Nov 8, 2024
@lukaisailovic lukaisailovic changed the title Add ERC: Wallet Asset Discovery ERC Add ERC: Wallet Asset Discovery Nov 8, 2024
@eip-review-bot eip-review-bot changed the title Add ERC: Wallet Asset Discovery Add ERC: Wallet Asset Discovery ERC Nov 8, 2024
@eip-review-bot eip-review-bot changed the title Add ERC: Wallet Asset Discovery ERC Add ERC: Wallet Asset Discovery Nov 9, 2024
@github-actions github-actions bot removed the w-ci label Nov 9, 2024
Copy link

github-actions bot commented Nov 9, 2024

The commit 06feb19 (as a parent of b321265) contains errors.
Please inspect the Run Summary for details.

@github-actions github-actions bot added the w-ci label Nov 9, 2024
@github-actions github-actions bot removed the w-ci label Nov 9, 2024
Copy link

@WojasKrk WojasKrk left a comment

Choose a reason for hiding this comment

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

Dysk

};
```

`account` is a required field that indicates for which account assets are requested.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an account address or CAIP-10?

Copy link
Author

Choose a reason for hiding this comment

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

Its account address, however I named it account to keep the naming consistent with other calls.

type WalletGetAssetsResponse = Record<Hex, Asset[]>;
```

The key **SHOULD** be [EIP-155](./eip-155.md) chainId
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not MUST?

Copy link
Contributor

Choose a reason for hiding this comment

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

What about cross-chain assets? E.g. Solana? Maybe this should be a CAIP-2?

name: string;
symbol: string;
decimals: number;
[key: string]: any;
Copy link

Choose a reason for hiding this comment

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

What extra would go here? If this is different per wallet, might be a bit hard/unrealistic for applications to coerce. Can we keep it strict?

Copy link
Author

Choose a reason for hiding this comment

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

Good point, will update!

address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
balance: Hex;
type: "native";
metadata: any;
Copy link

Choose a reason for hiding this comment

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

should this be omitted for native?

Comment on lines +97 to +101
{
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
balance: "0xcaaea35047fe5702",
type: "native"
}
Copy link

@jxom jxom Nov 20, 2024

Choose a reason for hiding this comment

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

Wonder if we should have a rule that native asset must be the first item in the array. Would feel a bit weird to have a linear time complexity just to extract a native balances across chains (ie. there could be many many tokens on each chain).

Copy link
Contributor

Choose a reason for hiding this comment

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

Would this suggestion resolve your concern?


Asset fields:

`address` is the address of the asset as Hex. Native assets **MUST** use `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` address specified by [ERC-7528](./eip-7528.md)
Copy link

@jxom jxom Nov 20, 2024

Choose a reason for hiding this comment

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

Kind of odd. Why do we need to include a stub address for native?

Copy link
Author

Choose a reason for hiding this comment

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

I wanted to keep the type for any asset

type Asset = {
  address: Hex;
  balance: Hex;
  type: string;
  metadata: any;
};

I wanted to make the address mandatory, instead of address?: Hex;
What do you think is better for the client implementations?

Copy link
Contributor

Choose a reason for hiding this comment

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

address: Hex | "native";

?

Comment on lines +86 to +89
"0x1": [
{
address: "0x123",
balance: "0xcaaea35047fe5702",
Copy link
Contributor

@chris13524 chris13524 Nov 21, 2024

Choose a reason for hiding this comment

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

Suggest using address as the key to simplify lookups

Suggested change
"0x1": [
{
address: "0x123",
balance: "0xcaaea35047fe5702",
"0x1": {
"0x123": {
balance: "0xcaaea35047fe5702",

Copy link

Choose a reason for hiding this comment

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

ah yeah, then you could have native key too

Copy link
Author

Choose a reason for hiding this comment

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

This is an interesting point, would simplify lookups a lot for the clients!

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.

6 participants