The comments say that the promise should be resolved with a metadata object, but it looks like we're resolving with the result object (which has the metadata in the `metadata` member). Should we resolve with `result.metadata` instead, or change the comment?