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

Feature request: Add "send all" option to fungible tokens #438

Open
PiVortex opened this issue Jan 21, 2025 · 1 comment · May be fixed by #440
Open

Feature request: Add "send all" option to fungible tokens #438

PiVortex opened this issue Jan 21, 2025 · 1 comment · May be fixed by #440
Assignees
Labels
enhancement New feature or request

Comments

@PiVortex
Copy link

It would be helpful to introduce a "send all" option for fungible tokens that determines your balance and sends exactly that making sure it leaves exactly 0 balance left.

Since this could be a critical operation I suggest instead of this popping up as an option button that the user types in "send all" when specifying how many tokens. This "send all" suggestion would appear in the examples.

Image

Use case: I have a contract that needs to be initialized with a certain number of tokens. The amount of tokens changes when I use the contract. I want to redeploy the contract but it becomes difficult to get the exact number of tokens to reinitialize.

Slime gave my message in tools a thumbs up so it seems like it could be useful to others also.

Thanks

@PiVortex PiVortex added the enhancement New feature or request label Jan 21, 2025
@github-project-automation github-project-automation bot moved this to NEW❗ in DevTools Jan 21, 2025
@frol
Copy link
Collaborator

frol commented Jan 21, 2025

The challenge here is that at the moment where you enter "send all" there is no information about the current balance since we have not yet asked for the network configuration, so we don't even have the RPC information yet. On the other hand, we can use a dedicated enum instead of just NearAmount:

/// "all" -> MaxAmount
/// "10 NEAR" -> ExactAmount(NearAmount(10 NEAR))
enum TransferAmount {
    MaxAmount,
    ExactAmount(NearAmount),
}

This way we will be able to resolve "all" to the specific number at the moment where we will have more information about the network.

@FroVolod FroVolod self-assigned this Jan 22, 2025
@FroVolod FroVolod linked a pull request Jan 25, 2025 that will close this issue
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: NEW❗
Development

Successfully merging a pull request may close this issue.

3 participants