@@ -75,23 +75,27 @@ def _from_dict(cls, decoded: dict) -> "DynamicInfo":
75
75
76
76
subnet_volume = Balance .from_rao (decoded ["subnet_volume" ]).set_unit (netuid )
77
77
78
- if decoded .get ("subnet_identity" ):
78
+ if subnet_identity := decoded .get ("subnet_identity" ):
79
+ # we need to check it for keep backwards compatibility
80
+ logo_bytes = subnet_identity .get ("logo_url" )
81
+ si_logo_url = bytes (logo_bytes ).decode () if logo_bytes else None
82
+
79
83
subnet_identity = SubnetIdentity (
80
- subnet_name = bytes (decoded ["subnet_identity" ]["subnet_name" ]).decode (),
81
- github_repo = bytes (decoded ["subnet_identity" ]["github_repo" ]).decode (),
82
- subnet_contact = bytes (
83
- decoded ["subnet_identity" ]["subnet_contact" ]
84
- ).decode (),
85
- subnet_url = bytes (decoded ["subnet_identity" ]["subnet_url" ]).decode (),
86
- logo_url = bytes (decoded ["subnet_identity" ]["logo_url" ]).decode (),
87
- discord = bytes (decoded ["subnet_identity" ]["discord" ]).decode (),
88
- description = bytes (decoded ["subnet_identity" ]["description" ]).decode (),
89
- additional = bytes (decoded ["subnet_identity" ]["additional" ]).decode (),
84
+ subnet_name = bytes (subnet_identity ["subnet_name" ]).decode (),
85
+ github_repo = bytes (subnet_identity ["github_repo" ]).decode (),
86
+ subnet_contact = bytes (subnet_identity ["subnet_contact" ]).decode (),
87
+ subnet_url = bytes (subnet_identity ["subnet_url" ]).decode (),
88
+ logo_url = si_logo_url ,
89
+ discord = bytes (subnet_identity ["discord" ]).decode (),
90
+ description = bytes (subnet_identity ["description" ]).decode (),
91
+ additional = bytes (subnet_identity ["additional" ]).decode (),
90
92
)
91
93
else :
92
94
subnet_identity = None
95
+
93
96
price = decoded .get ("price" , None )
94
97
98
+ print (f">>> price: { type (price )} , { price } " )
95
99
if price and not isinstance (price , Balance ):
96
100
raise ValueError (f"price must be a Balance object, got { type (price )} ." )
97
101
@@ -110,7 +114,11 @@ def _from_dict(cls, decoded: dict) -> "DynamicInfo":
110
114
tao_in = tao_in ,
111
115
k = tao_in .rao * alpha_in .rao ,
112
116
is_dynamic = is_dynamic ,
113
- price = price ,
117
+ price = (
118
+ price
119
+ if price is not None
120
+ else Balance .from_tao (tao_in .tao / alpha_in .tao ).set_unit (netuid )
121
+ ),
114
122
alpha_out_emission = alpha_out_emission ,
115
123
alpha_in_emission = alpha_in_emission ,
116
124
tao_in_emission = tao_in_emission ,
0 commit comments