-
Notifications
You must be signed in to change notification settings - Fork 479
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
base: master
Are you sure you want to change the base?
Add ERC: Wallet Asset Discovery #709
Conversation
The commit 06feb19 (as a parent of b321265) contains errors. |
There was a problem hiding this 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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not MUST
?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
{ | ||
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | ||
balance: "0xcaaea35047fe5702", | ||
type: "native" | ||
} |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address: Hex | "native";
?
"0x1": [ | ||
{ | ||
address: "0x123", | ||
balance: "0xcaaea35047fe5702", |
There was a problem hiding this comment.
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
"0x1": [ | |
{ | |
address: "0x123", | |
balance: "0xcaaea35047fe5702", | |
"0x1": { | |
"0x123": { | |
balance: "0xcaaea35047fe5702", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
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.