Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide the ability to obtain operation hash before sending it to the node #435

Closed
emishur opened this issue Sep 16, 2020 · 2 comments
Closed
Assignees
Labels
enhancement New feature or request ux/dx Related to Developer Experience
Milestone

Comments

@emishur
Copy link

emishur commented Sep 16, 2020

Currently, operation signing and injecting is done as a single operation.

If we want to save pending operation hash in the database we cannot guarantee transactionality.
In the following code snipped if db.save... fails we have no way to recover a hash or rollback Tezos operation

const operation = await contract.methods.foo(param).send();
await db.savePendingOperation(operation.hash);

If we can obtain operation hash before submitting it to tezos, we can recover if either DB or Tezos interaction fails:

const operation = await.contract.method.foo(param).sign();
await db.savePendingOperation(operation.hash);
await operation.send();
@jevonearth jevonearth added the enhancement New feature or request label Sep 16, 2020
@jevonearth
Copy link
Collaborator

Linking this to #432 as I think we can satisfy this use-case within the scope of that issue. Thank you @emishur

@jevonearth jevonearth added this to the v7.2 milestone Nov 27, 2020
@Innkst Innkst modified the milestones: v7.2, v8.2 Feb 17, 2021
@jevonearth jevonearth added the ux/dx Related to Developer Experience label Mar 9, 2021
@roxaneletourneau roxaneletourneau self-assigned this Mar 10, 2021
@Innkst Innkst modified the milestones: v8.2, v8.1 Mar 11, 2021
@roxaneletourneau
Copy link
Collaborator

roxaneletourneau commented Mar 12, 2021

As preliminary work, a util function allowing to obtain the operation has been added to the Taquito/utils package.
With this function, it is possible to obtain the operation hash before sending the operation to the node, but this required several steps that are normally abstracted by Taquito. An example has been added: integration-tests/call-contract-method-manual-steps.spec.ts.

A better API will be provided for this use-case with #432.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ux/dx Related to Developer Experience
Projects
Status: Done
Development

No branches or pull requests

4 participants