Skip to content

feat: rpc send tokens #659

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

Open
wants to merge 48 commits into
base: refactor/big-int
Choose a base branch
from
Open

Conversation

andreabadesso
Copy link
Contributor

@andreabadesso andreabadesso commented Mar 5, 2025

Screen.Recording.2025-03-09.at.15.43.59.mov

Acceptance Criteria

  • We should be able to handle sendTransaction RPC requests
  • We should be able to handle data outputs
  • We should register tokens used in outputs or inputs automatically
  • We should handle insufficient balance errors properly

Security Checklist

  • Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.

@andreabadesso andreabadesso self-assigned this Mar 5, 2025
@andreabadesso andreabadesso added the enhancement New feature or request label Mar 5, 2025
@andreabadesso andreabadesso moved this to In Progress (Done) in Hathor Network Mar 5, 2025
@andreabadesso andreabadesso moved this from In Progress (Done) to In Progress (WIP) in Hathor Network Mar 5, 2025
@andreabadesso andreabadesso force-pushed the refactor/big-int branch 2 times, most recently from 06c1f1d to 925a29e Compare March 9, 2025 15:27
@andreabadesso andreabadesso force-pushed the feat/rpc-send-tokens branch 3 times, most recently from 17ca208 to 5bc205f Compare March 9, 2025 18:42
@andreabadesso andreabadesso moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Mar 9, 2025
@andreabadesso andreabadesso force-pushed the feat/rpc-send-tokens branch from e7301c4 to 091b89f Compare March 9, 2025 18:48
return '-';
}

return numberUtils.prettyValue(value);
Copy link
Member

Choose a reason for hiding this comment

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

We should format considering NFT as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks

@pedroferreira1 pedroferreira1 moved this from In Progress (Done) to In Review (WIP) in Hathor Network Mar 12, 2025
@andreabadesso andreabadesso force-pushed the refactor/big-int branch 2 times, most recently from 433c4fe to f395832 Compare March 12, 2025 15:14
@andreabadesso andreabadesso moved this from In Review (WIP) to In Progress (Done) in Hathor Network Mar 14, 2025
@andreabadesso andreabadesso moved this from In Progress (Done) to In Progress (WIP) in Hathor Network Mar 17, 2025
@andreabadesso andreabadesso moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Mar 17, 2025
Copy link
Member

@pedroferreira1 pedroferreira1 left a comment

Choose a reason for hiding this comment

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

I think this PR is missing the i18n files.

Comment on lines 213 to 215
if (!tokenId) {
return constants.DEFAULT_NATIVE_TOKEN_CONFIG.symbol;
}
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 we changed this in the desktop wallet PR. Now we don't have a default and you just check if it's the default native token UID

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored to be exactly like the hathor wallet

<Text style={styles.labelText}>{t`Data field`}</Text>
<View style={styles.valueContainer}>
<Text style={styles.monospace}>
{output.data.join(',')}
Copy link
Member

Choose a reason for hiding this comment

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

We also need to change this, just like in the desktop wallet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

image

@pedroferreira1 pedroferreira1 moved this from In Progress (Done) to In Review (WIP) in Hathor Network Mar 18, 2025
@andreabadesso andreabadesso force-pushed the refactor/big-int branch 2 times, most recently from 2bce8bf to 98fb803 Compare March 20, 2025 15:56
@andreabadesso andreabadesso moved this from In Review (WIP) to In Progress (WIP) in Hathor Network Mar 20, 2025
@andreabadesso andreabadesso moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Mar 20, 2025
return numberUtils.prettyValue(value);
const isNFT = tokenId && helpersUtils.isTokenNFT(tokenId, tokenMetadata);

return numberUtils.prettyValue(value, isNFT ? 0 : constants.DECIMAL_PLACES);
Copy link
Member

Choose a reason for hiding this comment

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

After the decimal places refactor you should use the redux state here as well

@github-project-automation github-project-automation bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Mar 20, 2025
Copy link

@raul-oliveira raul-oliveira left a comment

Choose a reason for hiding this comment

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

Looks good. I've placed some comments about the code base.

@raul-oliveira raul-oliveira self-requested a review March 21, 2025 16:31
onAmountUpdate={onAmountChange}
value={amount}
allowOnlyInteger={isNFT()}
style={{ flex: 1 }}

Choose a reason for hiding this comment

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

add the comments from the prev version, it could be helpful in a future time

// we need this so the placeholder doesn't break in android
// devices after erasing the text
// https://github.com/facebook/react-native/issues/30666

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Thanks

Copy link

@raul-oliveira raul-oliveira left a comment

Choose a reason for hiding this comment

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

Code looks good! Tks for addressing the refactors.

@andreabadesso andreabadesso moved this from In Review (WIP) to In Review (Done) in Hathor Network Mar 26, 2025
@anafigueired
Copy link

anafigueired commented Mar 28, 2025

Hey! 👋 From a UX/UI perspective, here are some suggestions and questions:

  1. Should we inform the user that this transaction comes from an external source? Even if it’s coming from Hathor Play or another known dApp.

  2. Currently, if the user doesn’t have enough funds, the message shown is a bit generic. Suggestion: show something clearer like “Insufficient balance to accept this transaction”.

  3. I made a small mockup with visual improvements for readability: added more spacing between output cards for clarity and
    replaced the "Copy" text with an icon to keep the layout cleaner (see screenshot).

1  New Nano Contract Transaction Screen

  1. To avoid visual repetition and improve hierarchy, I grouped the outputs into two sections: Data Outputs and Address Outputs. I created two layout options for this and will attach both here.
    Question: do you think it’s common to have many outputs? If so, we might want to consider a more scalable layout in the future.

Agrupar 1
Agrupar 2

The Figma file: https://www.figma.com/design/qQZ91mzazEgiGJbKs1mKUc/Nano-Contracts?node-id=3339-3113&t=DAVFJhGAkbykMYmN-1

@andreabadesso andreabadesso moved this from In Review (Done) to In Progress (WIP) in Hathor Network Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress (WIP)
Development

Successfully merging this pull request may close these issues.

5 participants