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

swapped simulate() to use simulateOp instead of runOp and added tests #2581

Merged
merged 5 commits into from
Aug 3, 2023

Conversation

dsawali
Copy link
Contributor

@dsawali dsawali commented Jul 25, 2023

closes #2548

  • added simulateOperation RPC endpoint
  • added unit tests and updated integration tests
  • updated simulate() in Provider.ts to use simulateOperation() instead of runOperation()

Thank you for your contribution to Taquito.

Before submitting this PR, please make sure:

  • Your code builds cleanly without any errors or warnings
  • You have run the linter against the changes
  • You have added unit tests (if relevant/appropriate)
  • You have added integration tests (if relevant/appropriate)
  • All public methods or types have TypeDoc coverage with a complete description, and ideally an @example
  • You have added or updated corresponding documentation
  • If relevant, you have written a first draft summary describing the change for inclusion in Release Notes.

In this PR, please also make sure:

  • You have linked this PR to the issue by putting closes #TICKETNUMBER in the description box (when applicable)
  • You have added a concise description on your changes

Release Note Draft Snippet

If relevant, please write a summary of your change that will be suitable for
inclusion in the Release Notes for the next Taquito release.

@netlify
Copy link

netlify bot commented Jul 25, 2023

Deploy Preview for taquito-test-dapp ready!

Name Link
🔨 Latest commit efd9426
🔍 Latest deploy log https://app.netlify.com/sites/taquito-test-dapp/deploys/64c998e4d1cc4d00089b373f
😎 Deploy Preview https://deploy-preview-2581--taquito-test-dapp.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
Copy link

github-actions bot commented Jul 25, 2023

New packages have been deployed to the preview repository at https://npm.preview.tezostaquito.io/.

Published packages:

npm i @taquito/utils@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/core@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/rpc@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/beacon-wallet@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/tzip12@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/ledger-signer@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/http-utils@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/sapling@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/michelson-encoder@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/signer@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/tzip16@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/taquito@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/michel-codec@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/remote-signer@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/contracts-library@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/local-forging@17.1.1-b9076a5-- --registry https://npm.preview.tezostaquito.io/

@github-actions
Copy link

github-actions bot commented Jul 25, 2023

A new deploy preview is available on Netlify at https://b9076a5--tezostaquito.netlify.app

@dsawali dsawali marked this pull request as ready for review July 25, 2023 23:45
@@ -100,7 +100,7 @@ export class RPCEstimateProvider extends Provider implements EstimationProvider
opbytes,
opOb: { branch, contents },
} = await this.forge(op);
const operation: RPCRunOperationParam = {
const operation: RPCSimulateOperationParam = {
operation: { branch, contents, signature: SIGNATURE_STUB },
Copy link
Collaborator

@hui-an-yang hui-an-yang Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will we consider removing signature_stub when simulating?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, removed.

async simulateOperation(
op: RPCSimulateOperationParam,
{ block }: RPCOptions = defaultRPCOptions
): Promise<PreapplyResponse> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surprised to see PreapplyReponse here, but understand if it's returning the same object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PreapplyResponse is basically just content so I guess it was just reusing the type. It was the same for run_operation so I just followed suit.

Copy link
Collaborator

@hui-an-yang hui-an-yang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 🙌

@dsawali dsawali merged commit 0cc6936 into master Aug 3, 2023
11 of 12 checks passed
@dsawali dsawali deleted the 2548-simulate branch August 3, 2023 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use simulate RPC endpoint instead of run_operation to estimate operations in Taquito
2 participants