fn handle(&mut self, inv: Invocation, ctx: &mut Self::Context) -> Self::Result {
        let state = self.state.as_ref().unwrap();
        trace!(
            "Provider {} handling {}",
            state.cap.claims.subject,
            inv.operation
        );
        if let WasccEntity::Actor(ref s) = inv.origin {
            if let WasccEntity::Capability {
                id,
                contract_id,
                binding,
            } = &inv.target
            {
                if id != &state.cap.id() {
                    return InvocationResponse::error(
                        &inv,
                        "Invocation target ID did not match provider ID",
                    );
                }
                if let Err(e) = run_capability_pre_invoke(&inv, &state.mw_chain) {
                    return InvocationResponse::error(
                        &inv,
                        &format!("Capability middleware pre-invoke failure: {}", e),
                    );
                }

                match state.plugin.handle_call(&s, &inv.operation, &inv.msg) {
                    Ok(msg) => {
                        let ir = InvocationResponse::success(&inv, msg);
                        match run_capability_post_invoke(ir, &state.mw_chain) {
                            Ok(r) => r,
                            Err(e) => InvocationResponse::error(
                                &inv,
                                &format!("Capability middleware post-invoke failure: {}", e),
                            ),
                        }
                    }
                    Err(e) => InvocationResponse::error(&inv, &format!("{}", e)),
                }
            } else {
                InvocationResponse::error(&inv, "Invocation sent to the wrong target")
            }
        } else {
            InvocationResponse::error(&inv, "Attempt to invoke capability from non-actor origin")
        }
    }
/// Receives an invocation from any source, validating the anti-forgery token
/// and that the destination matches this process. If those checks pass, runs
/// the capability provider pre-invoke middleware, invokes the operation on the native
/// plugin, then runs the provider post-invoke middleware.
Receives an invocation from any source, validating the anti-forgery token
and that the destination matches this process. If those checks pass, runs
the capability provider pre-invoke middleware, invokes the operation on the native
plugin, then runs the provider post-invoke middleware.
Receives an invocation from any source validating the anti - forgery token and that the destination matches this process . If those checks pass runs the capability provider pre - invoke middleware invokes the operation on the native plugin then runs the provider post - invoke middleware .
fn handle(&mut self, inv: Invocation, ctx: &mut Self::Context) -> Self::Result {
        let state = self.state.as_ref().unwrap();
        trace!(
            "Provider {} handling {}",
            state.cap.claims.subject,
            inv.operation
        );
        if let WasccEntity::Actor(ref s) = inv.origin {
            if let WasccEntity::Capability {
                id,
                contract_id,
                binding,
            } = &inv.target
            {
                if id != &state.cap.id() {
                    return InvocationResponse::error(
                        &inv,
                        "Invocation target ID did not match provider ID",
                    );
                }
                if let Err(e) = run_capability_pre_invoke(&inv, &state.mw_chain) {
                    return InvocationResponse::error(
                        &inv,
                        &format!("Capability middleware pre-invoke failure: {}", e),
                    );
                }
                match state.plugin.handle_call(&s, &inv.operation, &inv.msg) {
                    Ok(msg) => {
                        let ir = InvocationResponse::success(&inv, msg);
                        match run_capability_post_invoke(ir, &state.mw_chain) {
                            Ok(r) => r,
                            Err(e) => InvocationResponse::error(
                                &inv,
                                &format!("Capability middleware post-invoke failure: {}", e),
                            ),
                        }
                    }
                    Err(e) => InvocationResponse::error(&inv, &format!("{}", e)),
                }
            } else {
                InvocationResponse::error(&inv, "Invocation sent to the wrong target")
            }
        } else {
            InvocationResponse::error(&inv, "Attempt to invoke capability from non-actor origin")
        }
    }
fn handle ( & mut self , inv : Invocation , ctx : & mut Self :: Context ) -> Self :: Result { let state = self . state . as_ref ( ) . unwrap ( ) ; trace ! ( " " state cap claims subject inv operation ) ; if let WasccEntity :: Actor ( ref s ) = inv . origin { if let WasccEntity :: Capability { id , contract_id , binding , } = & inv . target { if id != & state . cap . id ( ) { return InvocationResponse :: error ( & inv , " " , ) ; } if let Err ( e ) = run_capability_pre_invoke ( & inv , & state . mw_chain ) { return InvocationResponse :: error ( & inv , & format ! ( " " e ) , ) ; } match state . plugin . handle_call ( & s , & inv . operation , & inv . msg ) { Ok ( msg ) => { let ir = InvocationResponse :: success ( & inv , msg ) ; match run_capability_post_invoke ( ir , & state . mw_chain ) { Ok ( r ) => r , Err ( e ) => InvocationResponse :: error ( & inv , & format ! ( " " e ) , ) , } } Err ( e ) => InvocationResponse :: error ( & inv , & format ! ( " " e ) ) , } } else { InvocationResponse :: error ( & inv , " " ) } } else { InvocationResponse :: error ( & inv , " " ) } }
Receives an invocation from any source, validating the anti-forgery token
and that the destination matches this process.
Receives an invocation from any source validating the anti - forgery token and that the destination matches this process .
&mut self
inv
Invocation
ctx
&mut Self::Context
&mut self
inv
Invocation
ctx
&mut Self::Context