Skip to content

Commit

Permalink
Merge pull request #1 from opentensor/experimental/thewhaleking/typer
Browse files Browse the repository at this point in the history
Initial commit for Typer (wallet commands)
  • Loading branch information
thewhaleking authored Aug 5, 2024
2 parents bdbe2d8 + dca2d7a commit a1733da
Show file tree
Hide file tree
Showing 13 changed files with 7,452 additions and 0 deletions.
1,263 changes: 1,263 additions & 0 deletions cli.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cuda_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cubit>=1.1.0
14 changes: 14 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
aiohttp~=3.9.5
backoff~=2.2.1
git+https://github.com/opentensor/btwallet # bittensor_wallet
GitPython>=3.0.0
fuzzywuzzy~=0.18.0
netaddr~=1.3.0
numpy>=2.0.1
pycryptodome # Crypto
PyYAML~=6.0.1
rich~=13.7
scalecodec==1.2.11
substrate-interface~=1.7.9
typer~=0.12
websockets>=12.0
166 changes: 166 additions & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
from dataclasses import dataclass


class Constants:
networks = ["local", "finney", "test", "archive"]
finney_entrypoint = "wss://entrypoint-finney.opentensor.ai:443"
finney_test_entrypoint = "wss://test.finney.opentensor.ai:443/"
archive_entrypoint = "wss://archive.chain.opentensor.ai:443/"
local_entrypoint = "ws://127.0.0.1:9444"
network_map = {
"finney": finney_entrypoint,
"test": finney_test_entrypoint,
"archive": archive_entrypoint,
"local": local_entrypoint,
}
delegates_detail_url = "https://raw.githubusercontent.com/opentensor/bittensor-delegates/main/public/delegates.json"


@dataclass
class DelegatesDetails:
name: str
url: str
description: str
signature: str

@classmethod
def from_json(cls, json: dict[str, any]) -> "DelegatesDetails":
return cls(
name=json["name"],
url=json["url"],
description=json["description"],
signature=json["signature"],
)


class Defaults:
netuid = 1

class subtensor:
network = "finney"
chain_endpoint = None
_mock = False

class pow_register:
num_processes = None
update_interval = 50_000
output_in_place = True
verbose = False

class cuda:
dev_id = 0
use_cuda = False
tpb = 256

class wallet:
name = "default"
hotkey = "default"
path = "~/.bittensor/wallets/"

class logging:
debug = False
trace = False
record_log = False
logging_dir = "~/.bittensor/miners"


defaults = Defaults


TYPE_REGISTRY = {
"types": {
"Balance": "u64", # Need to override default u128
},
"runtime_api": {
"NeuronInfoRuntimeApi": {
"methods": {
"get_neuron_lite": {
"params": [
{
"name": "netuid",
"type": "u16",
},
{
"name": "uid",
"type": "u16",
},
],
"type": "Vec<u8>",
},
"get_neurons_lite": {
"params": [
{
"name": "netuid",
"type": "u16",
},
],
"type": "Vec<u8>",
},
}
},
"StakeInfoRuntimeApi": {
"methods": {
"get_stake_info_for_coldkey": {
"params": [
{
"name": "coldkey_account_vec",
"type": "Vec<u8>",
},
],
"type": "Vec<u8>",
},
"get_stake_info_for_coldkeys": {
"params": [
{
"name": "coldkey_account_vecs",
"type": "Vec<Vec<u8>>",
},
],
"type": "Vec<u8>",
},
},
},
"ValidatorIPRuntimeApi": {
"methods": {
"get_associated_validator_ip_info_for_subnet": {
"params": [
{
"name": "netuid",
"type": "u16",
},
],
"type": "Vec<u8>",
},
},
},
"SubnetInfoRuntimeApi": {
"methods": {
"get_subnet_hyperparams": {
"params": [
{
"name": "netuid",
"type": "u16",
},
],
"type": "Vec<u8>",
}
}
},
"SubnetRegistrationRuntimeApi": {
"methods": {"get_network_registration_cost": {"params": [], "type": "u64"}}
},
},
}

NETWORK_EXPLORER_MAP = {
"opentensor": {
"local": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer",
"endpoint": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer",
"finney": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer",
},
"taostats": {
"local": "https://x.taostats.io",
"endpoint": "https://x.taostats.io",
"finney": "https://x.taostats.io",
},
}
Loading

0 comments on commit a1733da

Please sign in to comment.