diff --git a/rust/chains/tw_polkadot/src/call_encoder/generic.rs b/rust/chains/tw_polkadot/src/call_encoder/generic.rs index b33e224af4c..6df67ee4c53 100644 --- a/rust/chains/tw_polkadot/src/call_encoder/generic.rs +++ b/rust/chains/tw_polkadot/src/call_encoder/generic.rs @@ -77,7 +77,7 @@ impl GenericBalances { match &b.message_oneof { BalanceVariant::transfer(t) => Self::encode_transfer(ctx, t), BalanceVariant::asset_transfer(t) => Self::encode_asset_transfer(ctx, t), - _ => Err(EncodeError::InvalidCallIndex), + _ => Err(EncodeError::NotSupported), } } } @@ -229,7 +229,7 @@ impl GenericStaking { StakingVariant::withdraw_unbonded(b) => Self::encode_withdraw_unbonded(b), StakingVariant::rebond(b) => Self::encode_rebond(b), StakingVariant::nominate(b) => Self::encode_nominate(ctx, b), - _ => Err(EncodeError::InvalidCallIndex), + _ => Err(EncodeError::NotSupported), } } } diff --git a/rust/chains/tw_polkadot/src/call_encoder/polkadot.rs b/rust/chains/tw_polkadot/src/call_encoder/polkadot.rs index 1f95ba21274..fe48ce7802f 100644 --- a/rust/chains/tw_polkadot/src/call_encoder/polkadot.rs +++ b/rust/chains/tw_polkadot/src/call_encoder/polkadot.rs @@ -31,7 +31,7 @@ impl TWPolkadotCallEncoder for PolkadotCallEncoder { GenericStaking::encode_call(&self.0, s)?.map(PolkadotCall::Staking) }, _ => { - return Err(EncodeError::InvalidCallIndex); + return Err(EncodeError::NotSupported); }, }; Ok(RawOwned(call.to_scale())) @@ -70,7 +70,7 @@ impl TWPolkadotCallEncoder for KusamaCallEncoder { GenericStaking::encode_call(&self.0, s)?.map(KusamaCall::Staking) }, _ => { - return Err(EncodeError::InvalidCallIndex); + return Err(EncodeError::NotSupported); }, }; Ok(RawOwned(call.to_scale())) diff --git a/rust/chains/tw_polkadot/src/call_encoder/polymesh.rs b/rust/chains/tw_polkadot/src/call_encoder/polymesh.rs index 0d91ed300b1..72371776150 100644 --- a/rust/chains/tw_polkadot/src/call_encoder/polymesh.rs +++ b/rust/chains/tw_polkadot/src/call_encoder/polymesh.rs @@ -81,7 +81,7 @@ impl PolymeshBalances { pub fn encode_call(b: &Balance) -> WithCallIndexResult { match &b.message_oneof { BalanceVariant::transfer(t) => Self::encode_transfer(t), - _ => Err(EncodeError::InvalidCallIndex), + _ => Err(EncodeError::NotSupported), } } } @@ -175,7 +175,7 @@ impl PolymeshIdentity { match &ident.message_oneof { IdentityVariant::join_identity_as_key(t) => Self::encode_join_identity(t), IdentityVariant::add_authorization(a) => Self::encode_add_authorization(a), - _ => Err(EncodeError::InvalidCallIndex), + _ => Err(EncodeError::NotSupported), } } } @@ -295,7 +295,7 @@ impl PolymeshStaking { StakingVariant::withdraw_unbonded(b) => Self::encode_withdraw_unbonded(b), StakingVariant::rebond(b) => Self::encode_rebond(b), StakingVariant::nominate(b) => Self::encode_nominate(b), - _ => Err(EncodeError::InvalidCallIndex), + _ => Err(EncodeError::NotSupported), } } } @@ -329,14 +329,14 @@ impl TWPolkadotCallEncoder for PolymeshCallEncoder { PolymeshIdentity::encode_call(msg)?.map(PolymeshCall::Identity) }, PolymeshVariant::None => { - return Err(EncodeError::InvalidCallIndex); + return Err(EncodeError::NotSupported); }, }, SigningVariant::staking_call(s) => { PolymeshStaking::encode_call(s)?.map(PolymeshCall::Staking) }, SigningVariant::None => { - return Err(EncodeError::InvalidCallIndex); + return Err(EncodeError::NotSupported); }, }; Ok(RawOwned(call.to_scale())) diff --git a/rust/frameworks/tw_substrate/src/extrinsic.rs b/rust/frameworks/tw_substrate/src/extrinsic.rs index cf9026703e0..665bfa55eb7 100644 --- a/rust/frameworks/tw_substrate/src/extrinsic.rs +++ b/rust/frameworks/tw_substrate/src/extrinsic.rs @@ -48,7 +48,7 @@ impl CallIndex { pub fn required_from_tw(call_index: Option<(i32, i32)>) -> Result { if call_index.is_none() { - return Err(EncodeError::MissingCallIndicesTable); + return Err(EncodeError::MissingCallIndices); } Self::from_tw(call_index) } diff --git a/rust/frameworks/tw_substrate/src/lib.rs b/rust/frameworks/tw_substrate/src/lib.rs index c8f227f9fe9..a4298a44562 100644 --- a/rust/frameworks/tw_substrate/src/lib.rs +++ b/rust/frameworks/tw_substrate/src/lib.rs @@ -19,10 +19,11 @@ pub use extensions::*; #[derive(Debug, Clone, Eq, PartialEq)] pub enum EncodeError { InvalidNetworkId, - MissingCallIndicesTable, + MissingCallIndices, InvalidCallIndex, InvalidAddress, InvalidValue, + NotSupported, } impl From for SigningError { @@ -31,7 +32,8 @@ impl From for SigningError { TWError::new(match err { EncodeError::InvalidAddress => SigningErrorType::Error_invalid_address, EncodeError::InvalidValue => SigningErrorType::Error_input_parse, - EncodeError::MissingCallIndicesTable => SigningErrorType::Error_not_supported, + EncodeError::MissingCallIndices => SigningErrorType::Error_not_supported, + EncodeError::NotSupported => SigningErrorType::Error_not_supported, _ => SigningErrorType::Error_invalid_params, }) .context(format!("{err:?}"))