Skip to content

Conversation

@thewhaleking
Copy link
Contributor

@thewhaleking thewhaleking commented Feb 12, 2025

  • Adds nonce protection for staking/unstaking calls
  • Adds get_stake_for_hotkey (and get_hotkey_stake alias) to AsyncSubtensor and Subtensor
  • Adds moving_price attr to DynamicInfo

@thewhaleking thewhaleking marked this pull request as ready for review February 12, 2025 18:37
basfroman
basfroman previously approved these changes Feb 13, 2025
@basfroman
Copy link
Collaborator

Test it with asyncio.gather before merge

@thewhaleking
Copy link
Contributor Author

Test it with asyncio.gather before merge

Tested with

import asyncio
import bittensor as bt
from bittensor_wallet.wallet import Wallet
import uvloop

wallet = Wallet(path="~/.bittensor/wallets", name="default3")
OTF = '5F4tQyWrhfGVcNhoqeiNsR6KjD4wMZ2kfhLj4oHYuyHbZAc3'

async def main():
    sub = bt.AsyncSubtensor( 'wss://main.mirror.test.opentensor.ai:443' )
    async with sub:
        all_infos = await sub.all_subnets()
        stakes = [sub.add_stake(
                wallet=wallet,
                hotkey_ss58=OTF,
                netuid=info.netuid,
                amount=bt.Balance.from_tao(1),
                wait_for_inclusion=False,
                wait_for_finalization=False
            ) for info in all_infos]
        results = await asyncio.gather(*stakes)
        print(results)

uvloop.run(main())

Working.

@thewhaleking thewhaleking changed the title Adds nonce protection for staking/unstaking calls. Last-minute requests Feb 13, 2025
@thewhaleking thewhaleking merged commit ad21515 into staging Feb 13, 2025
32 checks passed
@thewhaleking thewhaleking deleted the fix/thewhaleking/add-nonce-to-extrinsics-calls branch February 13, 2025 17:16
@ibraheem-abe ibraheem-abe mentioned this pull request Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants