onflow / freshmint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow Node library users to have full control over the transaction lifecycle

psiemens opened this issue · comments

Currently a user can call client.sendAsync, which submits a transaction to Flow and return its transaction ID. They can then poll for the results of that transaction by ID. However, they will need to parse any errors and events themselves, rather than relying on the built-in handlers inside Freshmint.

Some users will need to manage the complete lifecycle of a transaction in order to remain fault tolerant and respond to errors gracefully. We should find a way for the caller to own the transaction lifecycle but still make use of the event parsing functions provided by Freshmint.

Note: this probably also means improving the error handling logic here: https://github.com/packagelabs/freshmint/blob/alpha/src/lib/transactions.ts#L105

Callers should be able to distinguish between network errors and execution errors, for example, and handle them accordingly.