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

[WIP] Commander (BTTUI) Backend Server #1861

Draft
wants to merge 28 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
77dd3c6
First command implemented in server.
thewhaleking May 9, 2024
f447ba6
[WIP] check-in
thewhaleking May 10, 2024
f4871de
[WIP] check-in
thewhaleking May 10, 2024
fbd4ecc
[WIP] check-in
thewhaleking May 10, 2024
56323b1
[WIP] check-in
thewhaleking May 13, 2024
28f649c
Initial removal of nest_asyncio, define uvicorn[standard] so that uvl…
thewhaleking May 13, 2024
ffe9b43
[WIP] Check-in. Optimised some of IO-bound code in the commands, made…
thewhaleking May 14, 2024
6a4f205
[WIP] Check-in.
thewhaleking May 15, 2024
b83aeaa
[WIP] Check-in.
thewhaleking May 15, 2024
9c8e854
[WIP] Check-in.
thewhaleking May 16, 2024
8bd2801
[WIP] Fixed wallet overview
thewhaleking May 16, 2024
9d141d5
[WIP] Unlock cold key and transfer working.
thewhaleking May 16, 2024
d1f4931
[WIP] Wallet Inspect working
thewhaleking May 17, 2024
d7456a6
[WIP] Add check_config to setup_get and unlock cold key
thewhaleking May 17, 2024
ab987e9
[WIP] Fixed Wallet Inspection
thewhaleking May 17, 2024
77b3084
[WIP] Convert dataclasses to actual dataclasses
thewhaleking May 17, 2024
aff9980
[WIP] Added comments for the future.
thewhaleking May 20, 2024
cf455fa
[WIP] Wallet Balance working.
thewhaleking May 22, 2024
e00dc04
[WIP] better error
thewhaleking May 22, 2024
dfd685b
[WIP] Non-POW Wallet functions ported.
thewhaleking May 22, 2024
94f6aed
[WIP] New async RPC call method (experimental)
thewhaleking May 23, 2024
48937ba
TODO
thewhaleking May 24, 2024
a1e769c
Merge branch 'staging' into feature/bittui-backend-server/thewhaleking
thewhaleking May 28, 2024
c390f3a
Merge remote-tracking branch 'origin/feature/bittui-backend-server/th…
thewhaleking May 28, 2024
37017d9
[WIP] Check-in
thewhaleking May 28, 2024
1b06239
[WIP] Stake Show command working, black formatting
thewhaleking May 29, 2024
22e7e73
Merge branch 'staging' into feature/bittui-backend-server/thewhaleking
thewhaleking May 29, 2024
cd050f1
[WIP] Stake Add done
thewhaleking May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions bittensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@

# Install and apply nest asyncio to allow the async functions
# to run in a .ipynb
import nest_asyncio

nest_asyncio.apply()

# Bittensor code and protocol version.
__version__ = "7.0.0"
Expand Down
81 changes: 81 additions & 0 deletions bittensor/commander/data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# The MIT License (MIT)
# Copyright © 2024 Yuma Rao

# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all copies or substantial portions of
# the Software.

# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

from typing import Optional

from pydantic import BaseModel

import bittensor


class Config:
netuid = 0
wallet = None
initialized = False
json_encrypted_path = None
json_encrypted_pw = None
netuids = [] # TODO implement
coldkey_unlocked = False

def __bool__(self):
return self.initialized

def setup(self, conf: "ConfigBody"):
self.initialized = True
self.netuid = conf.netuid
self.wallet = bittensor.wallet(
name=conf.wallet["name"],
hotkey=conf.wallet["hotkey"],
path=conf.wallet["path"],
) # maybe config
self.json_encrypted_path = conf.json_encrypted_path
self.json_encrypted_pw = conf.json_encrypted_pw

def as_dict(self):
return {
"initialized": self.initialized,
"netuid": self.netuid,
"wallet": {
"name": self.wallet.name,
"hotkey": self.wallet.hotkey.ss58_address,
"path": self.wallet.path,
},
"json_encrypted_path": self.json_encrypted_path,
"json_encrypted_pw": self.json_encrypted_pw,
}


class ConfigBody(BaseModel):
netuid: int = 0
wallet: dict
json_encrypted_path: Optional[str] = None
json_encrypted_pw: Optional[str] = None


class Password(BaseModel):
# TODO maybe encrypt this?
password: str


class StakeAdd(BaseModel):
all_tokens: bool = False
# uid: int
amount: float = None
max_stake: float = None
hotkeys_to_use: list[str] = None
all_hotkeys: bool = False
excluded_hotkeys: list[str] = None
Loading