paritytech / capi

[WIP] A framework for crafting interactions with Substrate chains
https://docs.capi.dev
Apache License 2.0
104 stars 9 forks source link

Two calls in succession, inBlockEvents "cannot regress" error #1194

Open VadimSaveljev opened 1 year ago

VadimSaveljev commented 1 year ago

I'm trying to use two capi calls in succession first is creating nft collection second is setting metadata for that collection

I need to make these calls separately, because first call generates collection ID, which I take and set the metadata

so for maximum speed I'm utilising inBlockEvents which allows to get the ID very fast without waiting for things to be finalized, this is how I did things in PJS but it seems that if I run a second call without waiting for things to be finalized I get the "cannot regress" error in rune.js

async evaluate(time, receipt) {
        if (this._currentTime > time)
            throw new Error("cannot regress");

If I use finalizedEvents in the first call, then everything works fine.

So what am I missing? Do I actually need to wait for everything to finish (finalize) or I can somehow handle this situation?

tjjfvi commented 1 year ago

This is caused by #1151, which I'm aiming to fix by end of week