Probably Promise overuse?

I share your opinion, there seem to be some calls that seemingly have little reason to be asynchronous, like CryptoInterface.sha3Hash. It probably has something to do with how the SAFE client library is called using a Foreign Function Interface (FFI).

By the way, you can rewrite the then chain to make use of async and await:

(async () => {
    let md      = await app.mutableData.newRandomPublic(CONSTANTS.TAG_TYPE_INBOX)
    let inboxMd = await md.quickSetup(baseInbox)
    let permSet = await app.mutableData.newPermissionSet()
    await permSet.setAllow('Insert')
    await inboxMd.setUserPermissions(null, permSet, 1)
})()

Should do the exact same thing – didn’t test.

2 Likes