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

dapp-feat: TransferMultiTokens feature complete (#319) #384

Conversation

quiet-node
Copy link
Member

Description: TransferMultiTokens feature complete

Related issue(s): #314

Fixes #319

** UI Demo **:

Screen.Recording.2023-09-11.at.1.35.31.PM.mov

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@quiet-node quiet-node added enhancement New feature or request P2 Tooling tooling labels Sep 11, 2023
@quiet-node quiet-node added this to the 0.5.0 milestone Sep 11, 2023
@quiet-node quiet-node requested a review from a team as a code owner September 11, 2023 18:38
@quiet-node quiet-node self-assigned this Sep 11, 2023
@github-actions
Copy link

github-actions bot commented Sep 11, 2023

Test Results

197 tests  ±0   191 ✔️ ±0   6m 35s ⏱️ -15s
  62 suites ±0       6 💤 ±0 
  13 files   ±0       0 ±0 

Results for commit ab4fee8. ± Comparison against base commit 95d6f6a.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

Nice.
Some suggestions

@@ -116,7 +116,8 @@ describe('TokenTransferContract test suite', () => {
baseContract as unknown as Contract,
hederaTokenAddress,
[senderA, senderB],
[3, 6, 9]
[-18, 3, 6, 9],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Create a single array constant with an appropriate name for this since it's reused so often

@@ -95,7 +98,7 @@ export const transferFungibleTokens = async (
});
}
if (!sanitizeErr) {
amounts.some((amount) => {
amounts.slice(1).some((amount) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you taking only the 1st element?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh the amounts.slice(1) actually helps skipping the first element of the array in the loop. The reason is that the initial item in the amounts array represents the totalInputAmount multiplied by -1, ensuring that the sum of the amounts can equal 0. For instance, if a client inputs 2 amounts, 100 and 200, the amounts array would be [-300, 100, 200]. This is why, when sanitizing the parameter, we only need to check on the amounts provided by the client.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, a short comment with this context on top of this line to help readers

inputType: 'text',
inputPlaceholder: 'Token address...',
inputSize: 'md',
inputFocusBorderColor: '#A98DF4',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
inputFocusBorderColor: '#A98DF4',
inputFocusBorderColor: HEDERA_BRANDING_COLORS....,

inputPlaceholder: 'Token address...',
inputSize: 'md',
inputFocusBorderColor: '#A98DF4',
inputClassname: 'w-full border-white/30',
Copy link
Collaborator

Choose a reason for hiding this comment

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

'w-full border-white/30' should be a constant

senderAddress: {
inputType: 'text',
inputPlaceholder: 'Sender address...',
inputSize: 'md',
Copy link
Collaborator

Choose a reason for hiding this comment

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

'md' should be a constant

Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

LG, just note the comment here or in a follow up

@quiet-node quiet-node merged commit f7d5135 into main Sep 13, 2023
16 checks passed
@quiet-node quiet-node deleted the 319-(TransferTokens)-Add-contract-interacting-features-to-TokenTransferContract-contract branch September 13, 2023 05:43
mshakeg pushed a commit to mshakeg/hedera-smart-contracts that referenced this pull request Oct 14, 2023
…graph#384)

* dapp-update: added gasLimit to transferTokensPublic and transferNonFungibleTokensPublic

Signed-off-by: Logan Nguyen <[email protected]>

* dapp-feat: finished TransferMultiTokens feature (hashgraph#319)

Signed-off-by: Logan Nguyen <[email protected]>

* dapp-update: replaced NON_FUNGIBLE with NFT for consistency

Signed-off-by: Logan Nguyen <[email protected]>

* dapp-update: added a reusable component for param fields

Signed-off-by: Logan Nguyen <[email protected]>

---------

Signed-off-by: Logan Nguyen <[email protected]>
Signed-off-by: Mo Shaikjee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 Tooling tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[System Contract DApp] Add contract interacting features to TokenTransferContract contract
2 participants