diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 6696259a3..b7a347c46 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -1369,7 +1369,13 @@ impl_runtime_apis! { } fn get_delegate(delegate_account_vec: Vec) -> Vec { - SubtensorModule::get_delegate(delegate_account_vec).map(|r| r.encode()).unwrap_or_default() + let _result = SubtensorModule::get_delegate(delegate_account_vec); + if _result.is_some() { + let result = _result.expect("Could not get DelegateInfo"); + result.encode() + } else { + vec![] + } } fn get_delegated(delegatee_account_vec: Vec) -> Vec { @@ -1385,7 +1391,13 @@ impl_runtime_apis! { } fn get_neuron_lite(netuid: u16, uid: u16) -> Vec { - SubtensorModule::get_neuron_lite(netuid, uid).map(|r| r.encode()).unwrap_or_default() + let _result = SubtensorModule::get_neuron_lite(netuid, uid); + if _result.is_some() { + let result = _result.expect("Could not get NeuronInfoLite"); + result.encode() + } else { + vec![] + } } fn get_neurons(netuid: u16) -> Vec { @@ -1394,13 +1406,25 @@ impl_runtime_apis! { } fn get_neuron(netuid: u16, uid: u16) -> Vec { - SubtensorModule::get_neuron(netuid, uid).map(|r| r.encode()).unwrap_or_default() + let _result = SubtensorModule::get_neuron(netuid, uid); + if _result.is_some() { + let result = _result.expect("Could not get NeuronInfo"); + result.encode() + } else { + vec![] + } } } impl subtensor_custom_rpc_runtime_api::SubnetInfoRuntimeApi for Runtime { fn get_subnet_info(netuid: u16) -> Vec { - SubtensorModule::get_subnet_info(netuid).map(|r| r.encode()).unwrap_or_default() + let _result = SubtensorModule::get_subnet_info(netuid); + if _result.is_some() { + let result = _result.expect("Could not get SubnetInfo"); + result.encode() + } else { + vec![] + } } fn get_subnets_info() -> Vec { @@ -1424,7 +1448,13 @@ impl_runtime_apis! { } fn get_subnet_hyperparams(netuid: u16) -> Vec { - SubtensorModule::get_subnet_hyperparams(netuid).map(|r| r.encode()).unwrap_or_default() + let _result = SubtensorModule::get_subnet_hyperparams(netuid); + if _result.is_some() { + let result = _result.expect("Could not get SubnetHyperparams"); + result.encode() + } else { + vec![] + } } }