Bring all funtions in database_api and wallet_api to a unified form #270

Closed
opened 2022-02-07 06:50:40 +00:00 by vampik · 17 comments
vampik commented 2022-02-07 06:50:40 +00:00 (Migrated from gitlab.com)

Some functions have different api.

For example:

fc::optional<son_object> get_son_by_account(account_id_type account) const;

fc::optional<witness_object> get_witness_by_account(const std::string account_id_or_name) const;

Some funtions doesn't have implementation in wallet_api or in database_api.

Need to bring them all to unified form.

Some functions have different api. For example: `fc::optional<son_object> get_son_by_account(account_id_type account) const;` `fc::optional<witness_object> get_witness_by_account(const std::string account_id_or_name) const;` Some funtions doesn't have implementation in wallet_api or in database_api. Need to bring them all to unified form.
vampik commented 2022-02-07 06:50:40 +00:00 (Migrated from gitlab.com)

assigned to @vampik

assigned to @vampik
vampik commented 2022-02-07 06:51:03 +00:00 (Migrated from gitlab.com)

changed time estimate to 16h

changed time estimate to 16h
vampik commented 2022-02-08 05:47:25 +00:00 (Migrated from gitlab.com)

mentioned in commit d74b9eeebf

mentioned in commit d74b9eeebf43a10f4cc4c1ed660e6dca5416696c
vampik commented 2022-02-08 05:47:25 +00:00 (Migrated from gitlab.com)

mentioned in commit 1eafca86a4

mentioned in commit 1eafca86a41042eb3febb5add98900f4ec6969b2
vampik commented 2022-02-08 05:47:25 +00:00 (Migrated from gitlab.com)

mentioned in commit b3ee4f5cd7

mentioned in commit b3ee4f5cd72bf6c849f0a10075de168a91fb6c22
vampik commented 2022-02-08 10:24:42 +00:00 (Migrated from gitlab.com)

mentioned in commit b24a6ac3e2

mentioned in commit b24a6ac3e268bed310a016a408db72da9aba8786
vampik commented 2022-02-08 10:24:42 +00:00 (Migrated from gitlab.com)

mentioned in commit 65df816af6

mentioned in commit 65df816af6a070b0784a0594fe1291b0bff2d94d
vampik commented 2022-02-08 10:38:18 +00:00 (Migrated from gitlab.com)

Added to database_api:

get_committee_member_count()

api_limit_lookup_son_accounts

get_worker_count()

lookup_worker_accounts()

list_workers()

get_witness_by_account_id()

get_committee_member_by_account_id()

get_workers_by_account_id()

Added to cli_wallet:

get_workers()

Added to database_api: `get_committee_member_count()` `api_limit_lookup_son_accounts` `get_worker_count()` `lookup_worker_accounts()` `list_workers()` `get_witness_by_account_id()` `get_committee_member_by_account_id()` `get_workers_by_account_id()` Added to cli_wallet: `get_workers()`
vampik commented 2022-02-08 10:39:04 +00:00 (Migrated from gitlab.com)

added 12h of time spent

added 12h of time spent
vampik commented 2022-02-08 10:43:25 +00:00 (Migrated from gitlab.com)

mentioned in merge request !61

mentioned in merge request !61
serkixenos commented 2022-02-10 15:12:48 +00:00 (Migrated from gitlab.com)

assigned to @prandnum

assigned to @prandnum
vampik commented 2022-02-10 15:36:35 +00:00 (Migrated from gitlab.com)

@prandnum

For new database_api functions, you can test:

curl --data '{"method": "call", "params": ["database", "get_committee_member_count", []], "jsonrpc": "2.0", "id": 1}' localhost:8090

curl --data '{"method": "call", "params": ["database", "get_worker_count", []], "jsonrpc": "2.0", "id": 1}' localhost:8090

Other functions have custom types as arguments, and I didn't get how to represent them as json object string.

@prandnum For new database_api functions, you can test: `curl --data '{"method": "call", "params": ["database", "get_committee_member_count", []], "jsonrpc": "2.0", "id": 1}' localhost:8090` `curl --data '{"method": "call", "params": ["database", "get_worker_count", []], "jsonrpc": "2.0", "id": 1}' localhost:8090` Other functions have custom types as arguments, and I didn't get how to represent them as json object string.
prandnum commented 2022-02-10 19:46:42 +00:00 (Migrated from gitlab.com)
curl --data '{"method": "call", "params": ["database", "get_votes", ["nathan"]], "jsonrpc": "2.0", "id": 1}' localhost:8090

{"id":1,"jsonrpc":"2.0","result":{}}

curl --data '{"method": "call", "params": ["database", "get_voters", ["1.6.1"]], "jsonrpc": "2.0", "id": 1}' localhost:8090

{"id":1,"jsonrpc":"2.0","result":{"voters_for_committee_member":{"vote_id":"0:11","voters":[]},"voters_for_witness":{"vote_id":"1:0","voters":[]}}}

unlocked >>> is_witness 1.6.1
is_witness 1.6.1
true
unlocked >>> get_witness 1.6.1
get_witness 1.6.1
{
  "id": "1.6.1",
  "witness_account": "1.2.7",
  "last_aslot": 304425,
  "signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
  "next_secret_hash": "7ab675e546330569b717ced6ebb5f0875ab2b547",
  "previous_secret": "a9915346bf4abf72000812953b1a8f26c1f43bdc",
  "vote_id": "1:0",
  "total_votes": 0,
  "url": "",
  "total_missed": 12,
  "last_confirmed_block_num": 51
}
unlocked >>> get_workers 1.6.1
get_workers 1.6.1
0 exception: unspecified
No account or worker named 1.6.1
    {"account":"1.6.1"}
    th_a  wallet.cpp:2000 get_workers

    {"owner_account":"1.6.1"}
    th_a  wallet.cpp:2004 get_workers
unlocked >>>

@vampik could you please let me know the required value for get_workers command.

                          witness_object get_witness(string owner_account)
                   vector<worker_object> get_workers(string owner_account)
``` curl --data '{"method": "call", "params": ["database", "get_votes", ["nathan"]], "jsonrpc": "2.0", "id": 1}' localhost:8090 {"id":1,"jsonrpc":"2.0","result":{}} curl --data '{"method": "call", "params": ["database", "get_voters", ["1.6.1"]], "jsonrpc": "2.0", "id": 1}' localhost:8090 {"id":1,"jsonrpc":"2.0","result":{"voters_for_committee_member":{"vote_id":"0:11","voters":[]},"voters_for_witness":{"vote_id":"1:0","voters":[]}}} ``` ``` unlocked >>> is_witness 1.6.1 is_witness 1.6.1 true unlocked >>> get_witness 1.6.1 get_witness 1.6.1 { "id": "1.6.1", "witness_account": "1.2.7", "last_aslot": 304425, "signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", "next_secret_hash": "7ab675e546330569b717ced6ebb5f0875ab2b547", "previous_secret": "a9915346bf4abf72000812953b1a8f26c1f43bdc", "vote_id": "1:0", "total_votes": 0, "url": "", "total_missed": 12, "last_confirmed_block_num": 51 } unlocked >>> get_workers 1.6.1 get_workers 1.6.1 0 exception: unspecified No account or worker named 1.6.1 {"account":"1.6.1"} th_a wallet.cpp:2000 get_workers {"owner_account":"1.6.1"} th_a wallet.cpp:2004 get_workers unlocked >>> ``` @vampik could you please let me know the required value for get_workers command. ``` witness_object get_witness(string owner_account) vector<worker_object> get_workers(string owner_account) ```
vampik commented 2022-02-11 04:48:10 +00:00 (Migrated from gitlab.com)

@prandnum

For now, we don't have workers in our chain. So when you pass any account to this function, you will have an error, that there are no workers for account. This functionality is for the future.

@prandnum For now, we don't have workers in our chain. So when you pass any account to this function, you will have an error, that there are no workers for account. This functionality is for the future.
prandnum commented 2022-02-11 15:36:42 +00:00 (Migrated from gitlab.com)

Thanks @vampik . closing the bug with the aove comment.

Thanks @vampik . closing the bug with the aove comment.
prandnum (Migrated from gitlab.com) closed this issue 2022-02-11 15:36:48 +00:00
vampik commented 2022-02-11 15:41:47 +00:00 (Migrated from gitlab.com)

mentioned in commit 339adbb054

mentioned in commit 339adbb0549b9135bdfe856ee83a737d1ec55eb6
serkixenos commented 2022-02-11 15:41:47 +00:00 (Migrated from gitlab.com)

mentioned in commit 8486b7a736

mentioned in commit 8486b7a7363cc324bc719d907f92dec6efdd70ac
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Peerplays_Blockchain/peerplays_migrated#270
No description provided.