Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions bittensor_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5025,6 +5025,7 @@ def subnets_create(
description: Optional[str] = typer.Option(
None, "--description", help="Description"
),
logo_url: Optional[str] = typer.Option(None, "--logo-url", help="Logo URL"),
additional_info: Optional[str] = typer.Option(
None, "--additional-info", help="Additional information"
),
Expand Down Expand Up @@ -5067,6 +5068,7 @@ def subnets_create(
subnet_url=subnet_url,
discord=discord,
description=description,
logo_url=logo_url,
additional=additional_info,
)
self._run_command(
Expand Down Expand Up @@ -5190,6 +5192,7 @@ def subnets_set_identity(
description: Optional[str] = typer.Option(
None, "--description", help="Description"
),
logo_url: Optional[str] = typer.Option(None, "--logo-url", help="Logo URL"),
additional_info: Optional[str] = typer.Option(
None, "--additional-info", help="Additional information"
),
Expand Down Expand Up @@ -5241,6 +5244,7 @@ def subnets_set_identity(
subnet_url=subnet_url,
discord=discord,
description=description,
logo_url=logo_url,
additional=additional_info,
)

Expand Down
2 changes: 2 additions & 0 deletions bittensor_cli/src/bittensor/chain_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ class SubnetIdentity(InfoBase):
subnet_url: str
discord: str
description: str
logo_url: str
additional: str

@classmethod
Expand All @@ -641,6 +642,7 @@ def _fix_decoded(cls, decoded: dict) -> "SubnetIdentity":
subnet_url=bytes(decoded["subnet_url"]).decode(),
discord=bytes(decoded["discord"]).decode(),
description=bytes(decoded["description"]).decode(),
logo_url=bytes(decoded["logo_url"]).decode(),
additional=bytes(decoded["additional"]).decode(),
)

Expand Down
8 changes: 8 additions & 0 deletions bittensor_cli/src/bittensor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,7 @@ def prompt_for_subnet_identity(
subnet_url: Optional[str],
discord: Optional[str],
description: Optional[str],
logo_url: Optional[str],
additional: Optional[str],
):
"""
Expand Down Expand Up @@ -1227,6 +1228,13 @@ def prompt_for_subnet_identity(
lambda x: x and len(x.encode("utf-8")) > 1024,
"[red]Error:[/red] Description must be <= 1024 bytes.",
),
(
"logo_url",
"[blue]Logo URL [dim](optional)[/blue]",
logo_url,
lambda x: x and len(x.encode("utf-8")) > 1024,
"[red]Error:[/red] Logo URL must be <= 1024 bytes.",
),
(
"additional",
"[blue]Additional information [dim](optional)[/blue]",
Expand Down
6 changes: 6 additions & 0 deletions bittensor_cli/src/commands/subnets/subnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ async def _find_event_attributes_in_extrinsic_receipt(
"description": subnet_identity["description"].encode()
if subnet_identity.get("description")
else b"",
"logo_url": subnet_identity["logo_url"].encode()
if subnet_identity.get("logo_url")
else b"",
"additional": subnet_identity["additional"].encode()
if subnet_identity.get("additional")
else b"",
Expand Down Expand Up @@ -2207,6 +2210,7 @@ async def set_identity(
"subnet_url": subnet_identity.get("subnet_url", ""),
"discord": subnet_identity.get("discord", ""),
"description": subnet_identity.get("description", ""),
"logo_url": subnet_identity.get("logo_url", ""),
"additional": subnet_identity.get("additional", ""),
}

Expand Down Expand Up @@ -2252,6 +2256,7 @@ async def set_identity(
"subnet_url",
"discord",
"description",
"logo_url",
"additional",
]:
value = getattr(identity, key, None)
Expand Down Expand Up @@ -2301,6 +2306,7 @@ async def get_identity(
"subnet_url",
"discord",
"description",
"logo_url",
"additional",
]:
value = getattr(identity, key, None)
Expand Down
7 changes: 7 additions & 0 deletions tests/e2e_tests/test_staking_sudo.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def test_staking(local_chain, wallet_setup):
"A test subnet for e2e testing",
"--additional-info",
"Created by Alice",
"--logo-url",
"https://testsubnet.com/logo.png",
"--no-prompt",
"--json-output",
],
Expand Down Expand Up @@ -121,6 +123,8 @@ def test_staking(local_chain, wallet_setup):
"A test subnet for e2e testing",
"--additional-info",
"Created by Alice",
"--logo-url",
"https://testsubnet.com/logo.png",
"--no-prompt",
"--json-output",
],
Expand Down Expand Up @@ -198,6 +202,8 @@ def test_staking(local_chain, wallet_setup):
sn_discord := "alice#1234",
"--description",
sn_description := "A test subnet for e2e testing",
"--logo-url",
sn_logo_url := "https://testsubnet.com/logo.png",
"--additional-info",
sn_add_info := "Created by Alice",
"--json-output",
Expand Down Expand Up @@ -225,6 +231,7 @@ def test_staking(local_chain, wallet_setup):
assert get_identity_output["subnet_url"] == sn_url
assert get_identity_output["discord"] == sn_discord
assert get_identity_output["description"] == sn_description
assert get_identity_output["logo_url"] == sn_logo_url
assert get_identity_output["additional"] == sn_add_info

# Start emissions on SNs
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e_tests/test_unstaking.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def test_unstaking(local_chain, wallet_setup):
"A test subnet for e2e testing",
"--additional-info",
"Test subnet",
"--logo-url",
"https://testsubnet.com/logo.png",
"--no-prompt",
],
)
Expand Down Expand Up @@ -115,6 +117,8 @@ def test_unstaking(local_chain, wallet_setup):
"A test subnet for e2e testing",
"--additional-info",
"Test subnet",
"--logo-url",
"https://testsubnet.com/logo.png",
"--no-prompt",
],
)
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e_tests/test_wallet_interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def test_wallet_overview_inspect(local_chain, wallet_setup):
"test#1234",
"--description",
"A test subnet for e2e testing",
"--logo-url",
"https://testsubnet.com/logo.png",
"--additional-info",
"Test subnet",
"--no-prompt",
Expand Down Expand Up @@ -388,6 +390,8 @@ def test_wallet_identities(local_chain, wallet_setup):
"A test subnet for e2e testing",
"--additional-info",
"Created by Alice",
"--logo-url",
"https://testsubnet.com/logo.png",
"--no-prompt",
],
)
Expand Down