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

Dev votes user #48

Merged
merged 6 commits into from
Apr 26, 2023
Merged

Dev votes user #48

merged 6 commits into from
Apr 26, 2023

Conversation

arkanoider
Copy link
Collaborator

Hi @grunch

this is really a draft, not compiling a still missing things. The idea is to send notification to buyer/seller after a successful trade is done. Here the line:

https://github.com/arkanoider/mostro/blob/699c4999c8c977edf80a10ecb99398413a694b46/src/app/release.rs#L108

Here the messages:
https://github.com/arkanoider/mostro/blob/699c4999c8c977edf80a10ecb99398413a694b46/src/util.rs#L331

I send the order as content so client can get the info they need and a new action vote.

When buyer/seller receive it they will send a new command vote with:

  • Id order
  • Npub of counterpart
  • Vote ( 1-5 )

Mostro will receive a new action vote and start updating process:

  • Make a request to relay of replacable events ( This lead to the issue to manage a not supporting NIP33 relay)
  • Get the data of the user
  • Calculate the new values
  • Update event

In my mind this is the starting point for the Action::Vote when mostro receive the message:

https://github.com/arkanoider/mostro/blob/699c4999c8c977edf80a10ecb99398413a694b46/src/app/vote_user.rs#L125

Still a bit messy...but you guys can give a look and tell me if you had any doubts!

Thanks for your patience!

@arkanoider
Copy link
Collaborator Author

Hi @grunch

i did some some work and I think via have a minimal functional starting point.

I added a vote command on CLI side and the needed struct in mostro-core.

Basically now after a successful trade bueyer and seller can vote each other the votes are marked in the db so they can just give one vote for a specific order id and counterpart.

To compile in a clean way we need to update mostro core and maybe bump version and as I told you I add a github dep in cargo.toml to avoid an error caused by bitcoin-hashes lib ( thanks to @yukibtc ).

Another point in my mind is that it could be nice to know if the relay we are working supports nip33...but maybe just getting the newer event is enogh.

Waiting for your comments and ready to help for merging and compiling.

@@ -0,0 +1,45 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

This helps the project in any way or this is only for your IDE?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry it went in the commit...it's just the debugger config...throw away!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will fix now...ten minutes and i push the new commit

Cargo.toml Outdated
@@ -38,4 +39,4 @@ reqwest = { version = "0.11", features = ["json"] }
mostro-core = "0.1.8"
Copy link
Member

Choose a reason for hiding this comment

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

merged core, you can now update to mostro core 0.2.1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When we add changes to database and/or add new functions that interact with the database we have to run cargo sqlx prepare which update sqlx-data.json, this is needed to pass github tests

We have to definitively add to yaml file to automate the process..

src/app/release.rs Outdated Show resolved Hide resolved
src/db.rs Outdated Show resolved Hide resolved
Copy link
Member

@grunch grunch left a comment

Choose a reason for hiding this comment

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

great job, just a few changes to merge

@grunch
Copy link
Member

grunch commented Apr 26, 2023

When we add changes to database and/or add new functions that interact with the database we have to run cargo sqlx prepare which update sqlx-data.json, this is needed to pass github tests

@arkanoider arkanoider force-pushed the dev_votes_user branch 2 times, most recently from 6c32252 to 5c2c215 Compare April 26, 2023 16:04
@grunch grunch marked this pull request as ready for review April 26, 2023 18:20
Copy link
Member

@grunch grunch left a comment

Choose a reason for hiding this comment

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

LGTM

@grunch grunch merged commit d5f96d3 into MostroP2P:main Apr 26, 2023
@arkanoider arkanoider deleted the dev_votes_user branch April 26, 2023 18:25
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.

2 participants