Implement wallet_send

How to implement the wallet_send method in a Motoko program?
Is it possible to use dfx wallet --network ic send in a dynamically created canister?

I figured out the solution for this. If anyone facing the same issue as mine I hope this will help.

public shared func wallet_send(
        // Signature of the wallet recieve function in the calling canister
        wallet_send: shared () -> async { accepted: Nat }, 
        amount : Nat
) : async { accepted: Nat } {
        Cycles.add(amount);
        let l = await wallet_send();
        { accepted = amount };
};

This will be useful if you create canisters dynamically in your program.