-
Notifications
You must be signed in to change notification settings - Fork 327
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ 5 Skipped Deployments
|
@@ -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"> |
There was a problem hiding this comment.
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
:)
export const StellarMemoType = [ | ||
"NO_MEMO", | ||
"MEMO_TEXT", | ||
"MEMO_ID", | ||
"MEMO_HASH", | ||
"MEMO_RETURN", | ||
] as const; |
There was a problem hiding this comment.
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;
?
There was a problem hiding this comment.
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()
.
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.
apps/ledger-live-mobile/src/screens/SendFunds/02-SelectRecipient.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Martin CAYUELAS <112866305+mcayuelas-ledger@users.noreply.github.com>
There was a problem hiding this 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"], |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
β Checklist
npx changeset
was attached.π 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