How to use "cowsay" project in my project?

: D Great to see the cow’s getting out and about!

You’ll want to follow this syntax for calling to external canisters at the moment: Calling another canister's methods - #2 by Ori

Where you define the canister as an actor with a matching signature to the canister you’re calling (or subtype of). You can find the signature on its listing: https://k7gat-daaaa-aaaae-qaahq-cai.ic0.app/listing/cowsay-10237/7igbu-3qaaa-aaaaa-qaapq-cai

So for cowsay you can build the call as follows:

actor {
    public func main() : async Text {
        let cowsay = actor(“7igbu-3qaaa-aaaaa-qaapq-cai”): actor { cowsay: (Text) -> async Text };
        return await cowsay.cowsay(“hello”);
    };
};

And a Motoko playground example is here for you:
https://m7sm4-2iaaa-aaaab-qabra-cai.raw.ic0.app/?tag=1759972232

7 Likes