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 random image after order creation #619

Merged
merged 4 commits into from
Jan 2, 2025

Conversation

ndungudedan
Copy link
Contributor

@ndungudedan ndungudedan commented Dec 21, 2024

Resolves #608

The seller receives an image once an order is created. They will also receive the same image when paying the invoice.

This way, they can verify that the invoice originates from the bot.

The seller receives an image once an order is created. They will also receive the same image when paying the invoice.

This way, they can verify that the invoice originates from the bot.

Signed-off-by: ndungudedan <[email protected]>
@ndungudedan
Copy link
Contributor Author

How do you go about translations? I could probably use Google Translate but it's usually not that good. Please advise.

@Catrya
Copy link
Member

Catrya commented Dec 21, 2024

How do you go about translations? I could probably use Google Translate but it's usually not that good. Please advise.

Hi @ndungudedan, translations are put in the .yaml file of the corresponding language in ./locales
To translate I use chtgpt or deepl.com

Copy link
Member

@Catrya Catrya left a comment

Choose a reason for hiding this comment

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

Hi @ndungudedan, good start, it works!
However, it still does not fully comply with what the issue asks:

  • The image must appear in the center of the QR where the invoice is shown.
  • The images must be simple, without much content, easily identifiable, preferably with only 1 color.

@Catrya
Copy link
Member

Catrya commented Dec 22, 2024

@ndungudedan we can consult @grunch opinion, I was generating some images with chatgpt,.
This is what I asked chatgpt for. Although it would be better if they were smaller in size and had a white background:
Generate very simple and easily identifiable images, which are: a dog, a cat, a bird, a cup of coffee, a laptop, a mouse, a heart, a phone, a tree, a chair, a book, a lion, a plane. You must give me each image in several colors, for example the book in red, then in blue, violet, green, up to 10 colors.
image
image
image
image
image
image
image

@grunch
Copy link
Member

grunch commented Dec 23, 2024

Hi @ndungudedan the main idea is we should use simple images for the user can easily remember and identify it, let's see an example

After seller creates an order seller receives an image, let's say the seller receives a bear

Bear

In the message after order creation she sould say "Remember this image because you will see it again inside the invoice to pay"

Then when someone takes the order the bot sends an invoice with the image right in the center of the invoice, here an example with a real lnp2pbot invoice

photo_2024-12-21_15-37-53

@grunch
Copy link
Member

grunch commented Dec 23, 2024

Here are 71 icons from that same collections open source you can use, I you ask me I would prefer to have something like breez wallet which is more efficient probably, they have some images of animals of one color and then they change the color randomly for avatars, if you want to see it you can try the wallet here, but those icons attached in this comments also work well

Animals Icons Set.zip

@ndungudedan
Copy link
Contributor Author

@grunch Just made a commit with the requested changes. I used your zip of images. Please have a look.

Copy link
Member

@Catrya Catrya left a comment

Choose a reason for hiding this comment

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

Hi @ndungudedan, much better! However, the images are very blurry, and inside the QR it is very small.
Please use the images with higher resolution, inside this zip #619 (comment) those in Animals png large
Also increase the size of the image inside the QR a little so that even with the blurred QR the image can be identified

util/index.ts Outdated
const centerImage = new Image();
centerImage.src = `data:image/png;base64,${randomImage}`;

const imageSize = canvas.width * 0.2;
Copy link
Member

Choose a reason for hiding this comment

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

I think a more appropriate size might be 0.3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Set it to 0.3. Looks much better.

@Catrya
Copy link
Member

Catrya commented Dec 30, 2024

@ndungudedan Please update the branch with the latest changes from main because some bugs fixed in #620 are reappearing. Thanks!

@ndungudedan
Copy link
Contributor Author

@Catrya I have replaced the images with the large png set. Let's see if it fits.

Copy link
Member

@Catrya Catrya left a comment

Choose a reason for hiding this comment

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

ACK. Great job @ndungudedan !

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.

tACK

congratulations @ndungudedan please add a lightning invoice as a comment on this PR so we can pay to you for this great work

@grunch grunch merged commit a943bea into lnp2pBot:main Jan 2, 2025
4 checks passed
@ndungudedan
Copy link
Contributor Author

Thank you for the guidance and feedback guys.
Cheers to many more.

@grunch Here's the invoice:

lnbc1pnh09lhpp5tp7vyuxemuucc6ppl4x273s2ury4ye22q2e3j6htxa7jjmr5m36qdqqcqzzgxqyz5vqrzjqwnvuc0u4txn35cafc7w94gxvq5p3cu9dd95f7hlrh0fvs46wpvhd7cwwzegd49gzgqqqqryqqqqthqqpysp57axvkm4aeplu495p7ygrlk9cqyqvezvav0zh59d3a45603l9zvys9qrsgq4hpvffm03e5rqz87anew7um2857sd0uy45kpshm3kexdaacpcnvrsr09e3999t0jav4lrtep7am8xjwrkr2xcwe875rl3qlu4ndlgdqp5xtfd4

@grunch
Copy link
Member

grunch commented Jan 3, 2025

Thank you for the guidance and feedback guys. Cheers to many more.

@grunch Here's the invoice:

lnbc1pnh09lhpp5tp7vyuxemuucc6ppl4x273s2ury4ye22q2e3j6htxa7jjmr5m36qdqqcqzzgxqyz5vqrzjqwnvuc0u4txn35cafc7w94gxvq5p3cu9dd95f7hlrh0fvs46wpvhd7cwwzegd49gzgqqqqryqqqqthqqpysp57axvkm4aeplu495p7ygrlk9cqyqvezvav0zh59d3a45603l9zvys9qrsgq4hpvffm03e5rqz87anew7um2857sd0uy45kpshm3kexdaacpcnvrsr09e3999t0jav4lrtep7am8xjwrkr2xcwe875rl3qlu4ndlgdqp5xtfd4

Amount + fee: 200000 + 380.22 sat
Payment hash: 587cc270d9df398c6821fd4caf460ae0c952654a02b3196aeb377d296c74dc74
Payment status: SUCCEEDED, preimage: c40e186bcf5c360a16598b5eddf547a75d9228e86547a7908a0b06e8a645adb7

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.

Add random image after seller creates order
3 participants