js icon indicating copy to clipboard operation
js copied to clipboard

printNewEdition - serial only or is there a way to print concurrently?

Open joenoon opened this issue 2 years ago • 1 comments

From what I can tell printNewEdition requires originalSupply to be passed in by the client. It is then incremented by 1 and used as the edition in the instructions. https://github.com/metaplex-foundation/js/blob/278b93334d73ca995abd98517c9082752209fd02/packages/js/src/plugins/nftModule/operations/printNewEdition.ts#L276 also line 362.

If multiple clients are all trying to print the "next" edition, I assume there will be a lot of failing transactions as the client's view becomes stale.

Is this true or am I misunderstanding how this works? For our use-case an ideal scenario is if we could "print next", without specifying edition/originalSupply, and let the on-chain programs atomically increment the values. That would open up full concurrency. Does such a way exist already but maybe isn't exposed via the js lib?

joenoon avatar Feb 01 '23 15:02 joenoon

Yeah i've ran into this exact situation. I don't know if anyone has built an on chain program to handle this but would be dope. To start I'm probably going to be building a queue system in js with a redis cache

myyellowshoe avatar Jun 23 '23 17:06 myyellowshoe