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

transfer all #5

Open
Supremesource opened this issue Jan 29, 2024 · 0 comments
Open

transfer all #5

Supremesource opened this issue Jan 29, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Supremesource
Copy link
Member

Enhanced transferring features

Background

We've received several requests for a feature that enables users to unstake all keys on a disk and transfer their balances to a specified address. This feature aims to simplify the management of multiple wallet addresses.

Example that Huck sent (applied to the commune repository logic):

import argparse
import commune as c

# Set up command-line argument parsing
parser = argparse.ArgumentParser(description='Transfer all balance to a specific address.')
parser.add_argument('--address', type=str, help='The address to transfer to.')

parser.add_argument('--min', type=float, default=0.5, help='Min stake amount to left. Default is 0.5.')

# Parse command-line arguments
args = parser.parse_args()

wallet_addresses = c.keys()
print(wallet_addresses)

for address in wallet_addresses:
    try:
        # Unstake all balance from the wallet
        staked = c.get_stake(address)
        print(f"Staked amount is {staked}")
        if (staked > 0):
            c.unstake(staked, address)
        
        # Transfer all balance to the specific address
        balance = c.get_balance(address)
        print(f"Total balance is {balance}")

        if (balance > args.min):
            c.transfer(args.address, balance - args.min, address)

    except Exception as e:
        # Code that will run if the exception is raised
        print(f"An error occurred: {e}")```

Discussion and Feedback:

We are looking to the community for feedback on this feature. Please share your thoughts, potential use cases, or suggestions to improve this feature. Your input is valuable in shaping this enhancement to better suit user needs.

@Supremesource Supremesource added the enhancement New feature or request label Jan 29, 2024
@Supremesource Supremesource pinned this issue Jan 29, 2024
@steinerkelvin steinerkelvin self-assigned this Feb 29, 2024
@steinerkelvin steinerkelvin changed the title "Auto-Transfer" transfer all Feb 29, 2024
@Supremesource Supremesource unpinned this issue May 12, 2024
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
None yet
Development

No branches or pull requests

2 participants