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

MIP-1 proposed watch asset changes #138

Merged
merged 5 commits into from
Jun 27, 2023
Merged

Conversation

adonesky1
Copy link
Contributor

This PR implements the changes to wallet_watchAsset as proposed in MIP-1.

@adonesky1 adonesky1 requested a review from a team as a code owner April 19, 2023 20:20
@adonesky1 adonesky1 force-pushed the mip-1-proposed-watchAsset-changes branch from 3cce57d to 567a429 Compare April 19, 2023 20:33
@BelfordZ
Copy link
Contributor

Looks great! We will merge this once we have all the ducks in a row (mip + extension + mobile pr).

For now, could you add schema.title to the schemas you've added (only tokenId)? We should have titles on everything, and it seems that we never added titles for this method. No need to add titles everywhere, just adding them to the schemas you've added would be great.

@vandan
Copy link
Contributor

vandan commented May 5, 2023

Are there any errors we should document in the spec? (possibly including ones that were missed in the original wallet_watchAsset as well)

@vandan
Copy link
Contributor

vandan commented May 6, 2023

@BelfordZ how can we indicate that the stability index for this method is: Experimental (1)

Comment on lines +374 to +411
"code": -32602,
"message": "Must specify address, symbol, and decimals."
},
{
"code": -32602,
"message": "Invalid symbol: not a string."
},
{
"code": -32602,
"message": "Invalid symbol '${symbol}': longer than 11 characters."
},
{
"code": -32602,
"message": "Invalid decimals '${decimals}': must be 0 <= 36."
},
{
"code": -32602,
"message": "Invalid address '${address}'."
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BelfordZ @shane-t is there some way to indicate that these errors apply when param type = ERC20 and the others apply when param type = ERC721 or ERC1155

Copy link
Contributor

Choose a reason for hiding this comment

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

There's no way to link errors with the param types, other than just mentioning it in the description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shanejonas Do you think it makes sense to describe this in the root description field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ping here @shanejonas ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think its fine to have diff errors from diff params here, like decimals only applies to erc20 but we don't explicitly say that anywhere in the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but we don't explicitly say that anywhere in the error.

I can't tell, are you suggesting that we should say it explicitly in the error, or that its okay that we don't say it explicitly?

@shanejonas

@jiexi
Copy link
Contributor

jiexi commented Jun 16, 2023

No comments from me. Looks good!

@adonesky1 adonesky1 force-pushed the mip-1-proposed-watchAsset-changes branch from dc3dc3f to 6f76560 Compare June 20, 2023 15:55
openrpc.json Outdated
"ERC20"
]
}
"description": "Supports ERC-20, ERC-721, and ERC-1155 tokens.",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like we don't have a great handle across all our codebases on the use of the term token vs asset. Part of me feels like asset is less confusing when we're referring to both ERC20 tokens and ERC1155/ERC721 tokens since the latter are much more commonly referred to as NFTs and, as such, thought of as a separate category from (fungible) tokens. Anyone have thoughts on this and whether it makes sense to change the term token to asset here? cc @BelfordZ @vandan @shanejonas @jiexi

Copy link
Contributor

Choose a reason for hiding this comment

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

Token is in the name for these types so we could stick with the term even though our method name uses the more generic watchAsset ¯_(ツ)_/¯

Copy link
Contributor

@vandan vandan Jun 22, 2023

Choose a reason for hiding this comment

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

Can we update the method-level and type-level description to specify that ERC-721 & ERC-1155 support is only available in the Extension and considered stability level (1) "Experimental", which is subject to change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added here

@BelfordZ
Copy link
Contributor

LGTM, but lets also try to coordinate merging this + making a new release of metamask-docs w/ the release of extension

@adonesky1 adonesky1 merged commit d9e0d6d into main Jun 27, 2023
@adonesky1 adonesky1 deleted the mip-1-proposed-watchAsset-changes branch June 27, 2023 19:14
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