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

Fix/vote for delegate #57

Merged
merged 9 commits into from
May 30, 2024
Merged

Fix/vote for delegate #57

merged 9 commits into from
May 30, 2024

Conversation

martiliones
Copy link
Member

api.voteForDelegate()

  • fix: validation for public keys and delegate names
  • chore: better logging
  • chore: updated example

src/api/index.ts Outdated Show resolved Hide resolved
src/api/index.ts Outdated Show resolved Hide resolved
@bludnic
Copy link
Member

bludnic commented Apr 24, 2024

const result = await api.voteForDelegate('passphrase...', [
  '+U123456'
])

Actual:

Votes is +null

Screenshot 2024-04-24 3 52 34 PM

Expected:

Rejected if error if no public key

@bludnic
Copy link
Member

bludnic commented Apr 24, 2024

Can you add a validation to check that the user is actually a Delegate? @martiliones
Voting for a regular user may result in a waste of ADM tokens.

src/api/index.ts Show resolved Hide resolved
src/api/index.ts Show resolved Hide resolved
@adamant-al
Copy link
Member

Can you add a validation to check that the user is actually a Delegate? @martiliones Voting for a regular user may result in a waste of ADM tokens.

Do we want one more request?

@martiliones
Copy link
Member Author

martiliones commented Apr 24, 2024

Do we want one more request?

Well, it can be done using the single request by retrieving all the delegates, since the amount of them is limited to 101, then find the delegate by address there. It doesn't cost much performance for a node since it does exactly the same under the hood for /delegates/get

It would be nice if we had /delegates/get endpoint optimized for finding a single delegate with addition of address parameter

@adamant-al
Copy link
Member

It would be nice if we had /delegates/get endpoint optimized for finding a single delegate with addition of address parameter

You can create a Trello task for this and refer to the comment.

@martiliones martiliones requested a review from bludnic May 24, 2024 11:22
@martiliones martiliones merged commit 54e9d14 into dev May 30, 2024
@martiliones martiliones deleted the fix/voteForDelegate branch May 30, 2024 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants