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

feat(llm): πŸ“ add Stellar memo input on the recipient selection step #8178

Merged
merged 7 commits into from
Oct 30, 2024

Conversation

thesan
Copy link
Contributor

@thesan thesan commented Oct 23, 2024

βœ… Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • ...

πŸ“ Description

Screen.Recording.2024-10-23.at.16.05.42.mov

Add stellar memo input and validation. Follow up of #8155.

❓ Context


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@thesan thesan requested review from a team as code owners October 23, 2024 14:08
Copy link

vercel bot commented Oct 23, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-docs ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2024 2:05pm
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2024 2:05pm
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2024 2:05pm
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2024 2:05pm
web-tools ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2024 2:05pm

@live-github-bot live-github-bot bot added mobile Has changes in LLM common Has changes in live-common labels Oct 23, 2024
@@ -316,6 +317,9 @@ export default function SendSelectRecipient({ navigation, route }: Props) {
placeholder={t("send.summary.memo.title")}
onChange={memoTag.handleChange}
/>
<LText mt={4} pl={2} color="alert">
Copy link
Contributor

Choose a reason for hiding this comment

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

You should use <Text> from ledgerhq/react-ui :)

Comment on lines +35 to +41
export const StellarMemoType = [
"NO_MEMO",
"MEMO_TEXT",
"MEMO_ID",
"MEMO_HASH",
"MEMO_RETURN",
] as const;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe each elem could be part of an enum to be more accurate ? and more easy ti use in other component ? like in

const type = memoType === "NO_MEMO" && value ? "MEMO_TEXT" : memoType; ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah initially I created a type for this but it required more changes than I was confortable making to the Stellar code.
E.g in some places memoType is assigned a value.toString().
image

I'm not sure whether there's a good reason for this but rather than risking breaking things I decided not to touch the type of the Stellar transaction and just base my changes on this StellarMemoType list.

Wozacosta
Wozacosta previously approved these changes Oct 25, 2024
Co-authored-by: Martin CAYUELAS <112866305+mcayuelas-ledger@users.noreply.github.com>
Copy link
Contributor

@mcayuelas-ledger mcayuelas-ledger left a comment

Choose a reason for hiding this comment

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

Little suggestion :)

import QueuedDrawer from "~/components/QueuedDrawer";

export const MEMO_TYPES = new Map<MemoType, string>([
["NO_MEMO", "stellar.memoType.NO_MEMO"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't use enum for "NO_MEMO" etc? :)

More easier to use and to be sure we have all options!

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 also wanted to use an enum at first but then I realised that typescript enum can't really be iterated on (I think they lose their type with Object.values) without this the code becomes pretty verbose. Plus Mounir mentioned that it would be an anti pattern. Also IMO inferring the type from StellarMemoType (defined in Stellar's types/bridge.ts) provides a better type safety.

@thesan thesan merged commit 96094ea into develop Oct 30, 2024
56 checks passed
@thesan thesan deleted the feat/llm-memo-on-stellar-send-receiver-step branch October 30, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Has changes in live-common mobile Has changes in LLM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants