Skip to content

Commit

Permalink
Extract wallet (#1403)
Browse files Browse the repository at this point in the history
* integrate openconfig progess

* add type or suppress for argparse

* use for problematic types

* fix type hints

* move test under testcase class

* move tests under testcase class

* add test for btcli with empty arguments on every command

* remove unneeded setup from test

* remove type or suppress from int

* remove to defaults test

* use dot get for prefix check

* move test to package

* move wallet mock

* move some utils to package

* move wallet to package

* move reregister to registration utils

* add mocks

* move keyfile to package

* move test to utils tests

* use different naming

* fix import

* change function name and use kwargs

* modify naming

* add is_hotkey_registered

* use new function

* fix patch

* arg is cuda (typo)

* specify reregister true

* use generate wallet

* get mock wallet during tests

* extract get ss58 format util

* remove _mock arg

* extract tests

* import from base

* use subtensor for get_balance

* use new hotkey during test

* fix mocking

* add new packages to reqs file

* use new package naming

* bump wallet dep
  • Loading branch information
camfairchild authored Jun 28, 2023
1 parent 9b35e2d commit 6206c09
Show file tree
Hide file tree
Showing 24 changed files with 564 additions and 2,417 deletions.
21 changes: 7 additions & 14 deletions bittensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def turn_console_off():
from bittensor._cli import cli as cli
from bittensor._axon import axon as axon
from bittensor._axon import axon_info as axon_info
from bittensor._wallet import wallet as wallet
from bittensor._keyfile import keyfile as keyfile
from bittensor_wallet import wallet as wallet
from bittensor_wallet import keyfile as keyfile
from bittensor._metagraph import metagraph as metagraph
from bittensor._prometheus import prometheus as prometheus
from bittensor._subtensor import subtensor as subtensor
Expand All @@ -171,8 +171,9 @@ def turn_console_off():
from bittensor._cli.cli_impl import CLI as CLI
from bittensor_config.config_impl import Config as Config
from bittensor._subtensor.chain_data import DelegateInfo as DelegateInfo
from bittensor._wallet.wallet_impl import Wallet as Wallet
from bittensor._keyfile.keyfile_impl import Keyfile as Keyfile
from bittensor_wallet import Wallet as Wallet
from bittensor_wallet import Keyfile as Keyfile
from bittensor_wallet import Keypair as Keypair
from bittensor._subtensor.chain_data import NeuronInfo as NeuronInfo
from bittensor._subtensor.chain_data import NeuronInfoLite as NeuronInfoLite
from bittensor._subtensor.chain_data import PrometheusInfo as PrometheusInfo
Expand All @@ -184,7 +185,7 @@ def turn_console_off():
from bittensor._ipfs.ipfs_impl import Ipfs as Ipfs

# ---- Errors and Exceptions -----
from bittensor._keyfile.keyfile_impl import KeyFileError as KeyFileError
from bittensor_wallet import KeyFileError as KeyFileError

from bittensor._proto.bittensor_pb2 import ForwardTextPromptingRequest
from bittensor._proto.bittensor_pb2 import ForwardTextPromptingResponse
Expand All @@ -210,25 +211,17 @@ def turn_console_off():
from bittensor._neuron.base_prompting_miner import BasePromptingMiner
from bittensor._neuron.base_huggingface_miner import HuggingFaceMiner

# ---- Errors and Exceptions -----
from bittensor._keyfile.keyfile_impl import KeyFileError as KeyFileError

# ---- Errors and Exceptions -----
from bittensor._keyfile.keyfile_impl import KeyFileError as KeyFileError

# DEFAULTS
defaults = Config()
defaults.netuid = 1
subtensor.add_defaults( defaults )
axon.add_defaults( defaults )
prioritythreadpool.add_defaults( defaults )
prometheus.add_defaults( defaults )
wallet.add_defaults( defaults )
wallet.add_defaults( defaults, prefix = 'wallet' )
dataset.add_defaults( defaults )
logging.add_defaults( defaults )

from substrateinterface import Keypair as Keypair

# Logging helpers.
def trace():
logging.set_trace(True)
Expand Down
2 changes: 1 addition & 1 deletion bittensor/_cli/commands/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def run (cli):
for wallet in tqdm( wallets ):
delegates: List[Tuple(bittensor.DelegateInfo, bittensor.Balance)] = subtensor.get_delegated( coldkey_ss58=wallet.coldkeypub.ss58_address )
if not wallet.coldkeypub_file.exists_on_device(): continue
cold_balance = wallet.get_balance( subtensor = subtensor )
cold_balance = subtensor.get_balance( wallet.coldkeypub.ss58_address )
table.add_row(
wallet.name,
str(cold_balance),
Expand Down
Loading

0 comments on commit 6206c09

Please sign in to comment.