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 wallet_getAddressBook JSON-RPC method #2253

Conversation

loredanacirstea
Copy link
Contributor

Add wallet_getAddressBook JSON-RPC method

@LefterisJP
Copy link
Contributor

Nice inititative! Would it also make sense to extend this to also include tokens watched (owned and cared for by the owner) for each address.

This is something that many apps including Rotki would very very much appreciate.

@loredanacirstea
Copy link
Contributor Author

@LefterisJP , this was exactly the plan! Glad to see it is needed.

@karalabe
Copy link
Member

The field filter seems weird on RPC. That's essentially what GraphQL is for and how it works. I'm not sure it's a good idea to start introducing GraphQL concepts into the RPC.

Also, @holiman has been working on Clef and it's external API to solve all the account management problems securely. I'd much rather standardize that than reinvent everything yet again. https://github.com/ethereum/go-ethereum/tree/master/cmd/clef

@loredanacirstea
Copy link
Contributor Author

@karalabe,
@holiman said that this EIP is a good start:
https://ethereum-magicians.org/t/eip-2253-add-wallet-getaddressbook-json-rpc-method/3592/16. In the discussion thread, it was clarified that you both misunderstood the purpose of this EIP initially. So, can you fix your above comment, so reviewers can merge this PR?

EIPS/eip-2253.md Outdated

**Arguments:**
- filter object, optional:
- `count` - type `uint256`, the number of address book records requested; optional - when missing, the entire address book is requested
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this. If there is a count at all, then it needs (?) to be an offset as well right? Otherwise you get this weird case where you can either get the (first?) ten, or the full thing, but not items 10 to 20.

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 was thinking of count not as a filter with limit, offset, but as how many addresses are expected by the dApp. The user would control which addresses are selected and the wallet would control what/how/how many addresses are presented for selection (based on the user's data).

E.g. maybe the dApp only requires one such address - not the entire address book. Or 3 addresses - a dApp that says: you can send our asset for free to 3 friends! -> the wallet shows that you can select up to three addresses, so you can select 1, 2 or 3 addresses. (In EIP-2256 I mention: the user can amend the request by lowering the number of owned assets returned to the dApp; I see I did not add this idea here)

This said, count clearly overlaps with the already known filter concepts. So, I am open to other names. Maybe:

  • replace filter object with options object
  • replace count with limit or maxNumber

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done:
s/filter/options/
s/count/limit/

I added the mention:
"It remains to be discussed if the request parameters need to specify optional and required fields or minimum and maximum number of items to be returned."

EIPS/eip-2253.md Outdated
"method": "wallet_getAddressBook",
"params": [
{
"count": 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an ambiguous IMO. What does "one entry" mean, the first one (according to what ordering?), or just some arbitrary entry?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Explained in https://github.com/ethereum/EIPs/pull/2253/files#r320375982 - I will amend the spec after I get your opinion on this.

EIPS/eip-2253.md Outdated

If an address book selection is requested, the user will have to select the items from the address book list.

The wallet will also show radio options for which `WalletAddressBookItem` optional fields the user wants to expose, if those fields were requested.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The wallet will also show radio options for which `WalletAddressBookItem` optional fields the user wants to expose, if those fields were requested.
The wallet _should_ also show radio options for which `WalletAddressBookItem` optional fields the user wants to expose, if those fields were requested.

EIPS/eip-2253.md Outdated

If the entire address book is requested, the total number of address book items will be shown. However, even in this case, the user should be able to make a selection and restrict exposed fields.

If an address book selection is requested, the user will have to select the items from the address book list.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to have a "reason" in the request? So that the backend can tell the user

A request has come in from xxx to see 1 account, with reason: "select a friend to invite"`
Approve?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was also proposed by @danfinlay :

One parameter that might go well with this (and any permission, actually) would be a justification field

At that point, my answer was:

I understand the justification field would be in the permissions proposal. In which case, I agree. If the wallet_getAddressBook is used by the dApp (outside the permissions system), it is probably triggered by a user’s action and the dApp UI should provide the justification.

But I rethought this and you both are right. Regardless of the dApp's UI, it is reassuring for the user to see that the reason/justification on the wallet matches what the dApp shows.

reason/justification/message seem good - not sure which has been more used in other EIPs, with the same meaning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

justification was added.

EIPS/eip-2253.md Outdated Show resolved Hide resolved
@Kaykutee
Copy link

Kaykutee commented Sep 5, 2019 via email

loredanacirstea added a commit to loredanacirstea/EIPs that referenced this pull request Sep 5, 2019
- add `justification` field in the request arguments, as suggested in ethereum#2256 (comment)
- replace `count` with `limit`, as `count` is more ambiguous (as revealed in ethereum#2253 (comment))
- add a `justification` field, as discussed in ethereum#2253 (comment)
- replace `count` with `limit`, as `count` does not have the intended meaning (ethereum#2253 (comment))
- other fixes
axic pushed a commit that referenced this pull request Sep 6, 2019
* Add ERC for wallet_getOwnedTokens JSON-RPC method

* Add EIP number & discussions URL to EIP-2256

* Fix wallet_getOwnedTokens input arguments

* Add chainId as argument to wallet_getOwnedTokens

As suggested in #2256 (comment)

* Rename EIP-2256 method to wallet_getOwnedAssets, align data struct with EIP-747

Based on the discussions up to and including this comment: https://ethereum-magicians.org/t/eip-2256-add-wallet-getownedassets-json-rpc-method/3600/15

- rename `wallet_getOwnedTokens` to `wallet_getOwnedAssets`
- use `options` in the response field, as EIP-747 proposes, to allow for different asset-specific information to be returned
- use `asset` instead of `token` where generalization is needed
- replace `interface` with `type`, to align with EIP-747
- add `types` as a filter field
- add `decimals` as an optional field in `options`

* Fix category for EIP-2256 - use Interface

As suggested in #2256 (comment)

* Add justification field for EIP-2256, s/count/limit

- add `justification` field in the request arguments, as suggested in #2256 (comment)
- replace `count` with `limit`, as `count` is more ambiguous (as revealed in #2253 (comment))
@loredanacirstea
Copy link
Contributor Author

@karalabe, can you clarify your position on this EIP, so it can be merged?

@loredanacirstea
Copy link
Contributor Author

I know that core devs have enough on their plate. But @karalabe, you made the effort to say “I'd much rather standardize that than reinvent everything yet again” on an EIP that proposes a new method. So, it should only be right to take the time again to correct your statement and say that it is indeed a new proposal.
I expect the filtering will be discussed more after the draft is merged.

Keep in mind my comment from the discussion thread.

@karalabe
Copy link
Member

karalabe commented Sep 7, 2019 via email

ysqi pushed a commit to lbc-team/EIPs that referenced this pull request Sep 8, 2019
* Add ERC for wallet_getOwnedTokens JSON-RPC method

* Add EIP number & discussions URL to EIP-2256

* Fix wallet_getOwnedTokens input arguments

* Add chainId as argument to wallet_getOwnedTokens

As suggested in ethereum/EIPs#2256 (comment)

* Rename EIP-2256 method to wallet_getOwnedAssets, align data struct with EIP-747

Based on the discussions up to and including this comment: https://ethereum-magicians.org/t/eip-2256-add-wallet-getownedassets-json-rpc-method/3600/15

- rename `wallet_getOwnedTokens` to `wallet_getOwnedAssets`
- use `options` in the response field, as EIP-747 proposes, to allow for different asset-specific information to be returned
- use `asset` instead of `token` where generalization is needed
- replace `interface` with `type`, to align with EIP-747
- add `types` as a filter field
- add `decimals` as an optional field in `options`

* Fix category for EIP-2256 - use Interface

As suggested in ethereum/EIPs#2256 (comment)

* Add justification field for EIP-2256, s/count/limit

- add `justification` field in the request arguments, as suggested in ethereum/EIPs#2256 (comment)
- replace `count` with `limit`, as `count` is more ambiguous (as revealed in ethereum/EIPs#2253 (comment))
ilanolkies pushed a commit to ilanolkies/EIPs that referenced this pull request Nov 12, 2019
* Add ERC for wallet_getOwnedTokens JSON-RPC method

* Add EIP number & discussions URL to EIP-2256

* Fix wallet_getOwnedTokens input arguments

* Add chainId as argument to wallet_getOwnedTokens

As suggested in ethereum#2256 (comment)

* Rename EIP-2256 method to wallet_getOwnedAssets, align data struct with EIP-747

Based on the discussions up to and including this comment: https://ethereum-magicians.org/t/eip-2256-add-wallet-getownedassets-json-rpc-method/3600/15

- rename `wallet_getOwnedTokens` to `wallet_getOwnedAssets`
- use `options` in the response field, as EIP-747 proposes, to allow for different asset-specific information to be returned
- use `asset` instead of `token` where generalization is needed
- replace `interface` with `type`, to align with EIP-747
- add `types` as a filter field
- add `decimals` as an optional field in `options`

* Fix category for EIP-2256 - use Interface

As suggested in ethereum#2256 (comment)

* Add justification field for EIP-2256, s/count/limit

- add `justification` field in the request arguments, as suggested in ethereum#2256 (comment)
- replace `count` with `limit`, as `count` is more ambiguous (as revealed in ethereum#2253 (comment))
MadeofTin pushed a commit to MadeofTin/EIPs that referenced this pull request Nov 13, 2019
* Add ERC for wallet_getOwnedTokens JSON-RPC method

* Add EIP number & discussions URL to EIP-2256

* Fix wallet_getOwnedTokens input arguments

* Add chainId as argument to wallet_getOwnedTokens

As suggested in ethereum#2256 (comment)

* Rename EIP-2256 method to wallet_getOwnedAssets, align data struct with EIP-747

Based on the discussions up to and including this comment: https://ethereum-magicians.org/t/eip-2256-add-wallet-getownedassets-json-rpc-method/3600/15

- rename `wallet_getOwnedTokens` to `wallet_getOwnedAssets`
- use `options` in the response field, as EIP-747 proposes, to allow for different asset-specific information to be returned
- use `asset` instead of `token` where generalization is needed
- replace `interface` with `type`, to align with EIP-747
- add `types` as a filter field
- add `decimals` as an optional field in `options`

* Fix category for EIP-2256 - use Interface

As suggested in ethereum#2256 (comment)

* Add justification field for EIP-2256, s/count/limit

- add `justification` field in the request arguments, as suggested in ethereum#2256 (comment)
- replace `count` with `limit`, as `count` is more ambiguous (as revealed in ethereum#2253 (comment))
BelfordZ pushed a commit to BelfordZ/EIPs that referenced this pull request Dec 13, 2019
* Add ERC for wallet_getOwnedTokens JSON-RPC method

* Add EIP number & discussions URL to EIP-2256

* Fix wallet_getOwnedTokens input arguments

* Add chainId as argument to wallet_getOwnedTokens

As suggested in ethereum#2256 (comment)

* Rename EIP-2256 method to wallet_getOwnedAssets, align data struct with EIP-747

Based on the discussions up to and including this comment: https://ethereum-magicians.org/t/eip-2256-add-wallet-getownedassets-json-rpc-method/3600/15

- rename `wallet_getOwnedTokens` to `wallet_getOwnedAssets`
- use `options` in the response field, as EIP-747 proposes, to allow for different asset-specific information to be returned
- use `asset` instead of `token` where generalization is needed
- replace `interface` with `type`, to align with EIP-747
- add `types` as a filter field
- add `decimals` as an optional field in `options`

* Fix category for EIP-2256 - use Interface

As suggested in ethereum#2256 (comment)

* Add justification field for EIP-2256, s/count/limit

- add `justification` field in the request arguments, as suggested in ethereum#2256 (comment)
- replace `count` with `limit`, as `count` is more ambiguous (as revealed in ethereum#2253 (comment))
@github-actions
Copy link

github-actions bot commented Sep 8, 2020

There has been no activity on this pull request for two months. It will be closed in a week if no further activity occurs. If you would like to move this EIP forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review.

@github-actions github-actions bot added the stale label Sep 8, 2020
@github-actions
Copy link

This pull request was closed due to inactivity. If you are still pursuing it, feel free to reopen it and respond to any feedback or request a review in a comment.

@github-actions github-actions bot closed this Sep 15, 2020
tkstanczak pushed a commit to tkstanczak/EIPs that referenced this pull request Nov 7, 2020
* Add ERC for wallet_getOwnedTokens JSON-RPC method

* Add EIP number & discussions URL to EIP-2256

* Fix wallet_getOwnedTokens input arguments

* Add chainId as argument to wallet_getOwnedTokens

As suggested in ethereum#2256 (comment)

* Rename EIP-2256 method to wallet_getOwnedAssets, align data struct with EIP-747

Based on the discussions up to and including this comment: https://ethereum-magicians.org/t/eip-2256-add-wallet-getownedassets-json-rpc-method/3600/15

- rename `wallet_getOwnedTokens` to `wallet_getOwnedAssets`
- use `options` in the response field, as EIP-747 proposes, to allow for different asset-specific information to be returned
- use `asset` instead of `token` where generalization is needed
- replace `interface` with `type`, to align with EIP-747
- add `types` as a filter field
- add `decimals` as an optional field in `options`

* Fix category for EIP-2256 - use Interface

As suggested in ethereum#2256 (comment)

* Add justification field for EIP-2256, s/count/limit

- add `justification` field in the request arguments, as suggested in ethereum#2256 (comment)
- replace `count` with `limit`, as `count` is more ambiguous (as revealed in ethereum#2253 (comment))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants