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

fix: Fixed information about successful transfer of "send all" ft tokens #447

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FroVolod
Copy link
Collaborator

These changes correct information about the successful transfer of ft tokens

Screen.Recording.2025-02-10.at.11.45.53.mov

Comment on lines +106 to +109
pub fn update_amount(&mut self, new_amount: u128) -> Self {
self.amount = new_amount;
self.clone()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. This is a totally wrong implementation as it changes self and then clones and returns the copy
  2. This method is not needed. Just create a new FungibleToken with ::from_params_ft

&ft_contract_account_id,
near_primitives::types::BlockId::Hash(outcome_view.receipts_outcome[0].block_hash).into()
) {
let ft_transfer_amount = ft_balance.clone().update_amount(ft_transfer.amount);
Copy link
Collaborator

Choose a reason for hiding this comment

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

^ use FungibleToken::from_params_ft instead

network_config,
&signer_account_id,
&ft_contract_account_id,
near_primitives::types::BlockId::Hash(outcome_view.receipts_outcome[0].block_hash).into()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Take the block_hash from the last receipts_outcome, not the first one.

Suggested change
near_primitives::types::BlockId::Hash(outcome_view.receipts_outcome[0].block_hash).into()
near_primitives::types::BlockId::Hash(outcome_view.receipts_outcome.last().expect("FT transfer should have at least one receipt outcome, but none was received").block_hash).into()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: NEW❗
Development

Successfully merging this pull request may close these issues.

2 participants