jorgenbuilder / ic-inspector

⭐⭐⭐⭐⭐ Chrome extension for decoding responses from the Internet Computer blockchain
https://chromewebstore.google.com/detail/ic-inspector/meaadkenfkhjakkkdapaallimhbdofck?hl=en&authuser=0
MIT License
52 stars 9 forks source link

Handle `null` return values from Motoko canisters #23

Closed dansteren closed 1 year ago

dansteren commented 2 years ago

Description When making a query to a motoko canister that returns a null value, the decoder doesn't capture the event.

To Reproduce Steps to reproduce the behavior:

  1. Deploy (locally) the following motoko canister:
    actor HelloWorld {
    public query func getNull(): async Null {
    return null;
    };
    }
  2. Open the candid UI website for your deployed canister. Likely at http://ryjl3-tyaaa-aaaaa-aaaba-cai.localhost:8000/?id=rrkah-fqaaa-aaaaa-aaaaq-cai
  3. Click "Query" to make a query to the canister image
  4. Note that the canister call is made successfully (as shown in the Candid UI), but the event isn't captured by the decoder.

Expected behavior The call should be captured by the decoder, show up in the decoder panel, and correctly display that the returned data is null.

System Information

Additional context This only seems to be a problem with Motoko canisters. I've deployed the equivalent canister in Rust and Azle and the decoder can handle those responses fine.

The candid of the deployed canister is:

service : {
  getNull: () -> (null) query;
}
jorgenbuilder commented 2 years ago

Thanks so much for the report! I will attempt a repro + fix later today.

jorgenbuilder commented 1 year ago

Tidying up, this was fixed in a previous release.