Skip to content

Commit 983363a

Browse files
committed
into for error
1 parent 0eab7ae commit 983363a

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

  • crates/near-mpc-contract-interface/src

crates/near-mpc-contract-interface/src/client.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::call_args::{
1313
VoteUpdateArgs,
1414
};
1515
use crate::deposits::{
16-
self, DepositOverflowError, MINIMUM_NODE_MANAGEMENT_DEPOSIT_YOCTONEAR, SIGN_DEPOSIT_YOCTONEAR,
16+
DepositOverflowError, MINIMUM_NODE_MANAGEMENT_DEPOSIT_YOCTONEAR, SIGN_DEPOSIT_YOCTONEAR,
1717
STORAGE_BYTE_COST_YOCTONEAR, SUBMIT_PARTICIPANT_INFO_DEPOSIT_MILLINEAR,
1818
propose_update_required_deposit_yoctonear,
1919
};
@@ -112,10 +112,7 @@ impl<C: CallContract> MpcContractHandle<C> {
112112
&self,
113113
args: ProposeUpdateArgs,
114114
) -> Result<C::Output, MpcContractHandleError<C::Error>> {
115-
let payload_bytes = args.payload_bytes().map_err(|err| match err {
116-
PayloadBytesError::Serialize(err) => MpcContractHandleError::Serialize(err),
117-
PayloadBytesError::Overflow => MpcContractHandleError::Deposit(DepositOverflowError),
118-
})?;
115+
let payload_bytes = args.payload_bytes()?;
119116
let deposit = NearToken::from_yoctonear(propose_update_required_deposit_yoctonear(
120117
payload_bytes,
121118
STORAGE_BYTE_COST_YOCTONEAR,
@@ -308,6 +305,15 @@ pub enum MpcContractHandleError<E> {
308305
Call(E),
309306
}
310307

308+
impl<E> From<PayloadBytesError> for MpcContractHandleError<E> {
309+
fn from(value: PayloadBytesError) -> Self {
310+
match value {
311+
PayloadBytesError::Serialize(err) => MpcContractHandleError::Serialize(err),
312+
PayloadBytesError::Overflow => MpcContractHandleError::Deposit(DepositOverflowError),
313+
}
314+
}
315+
}
316+
311317
#[cfg(test)]
312318
#[expect(non_snake_case)]
313319
mod tests {

0 commit comments

Comments
 (0)