concordium-node-sdk-js icon indicating copy to clipboard operation
concordium-node-sdk-js copied to clipboard

[JSS-101] Estimate smart-contract update energy costs

Open Ivan-Mahda opened this issue 9 months ago • 0 comments

Purpose

We should provide functions for computing an estimate of energy usage needed for running an update transaction for a smart contract on chain. The function should take the information needed for the update and use invokeContract to compute the energy cost.

Changes

Added new method getContractUpdateEnergyCost Get contract update energy cost Estimated by calculateEnergyCost, where transactionSpecificCost received from invokeContract used energy

Actual energy can be different from the estimated (about 1 - 5 NRG)

Updated README.md for node-sdk examples

image

Checklist

  • [x] My code follows the style of this project.
  • [x] The code compiles without warnings.
  • [x] I have performed a self-review of the changes.
  • [x] I have documented my code, in particular the intent of the hard-to-understand areas.
  • [x] (If necessary) I have updated the CHANGELOG.

By submitting the contribution I accept the terms and conditions of the Contributor License Agreement v1.0

  • link: https://developers.concordium.com/CLAs/Contributor-License-Agreement-v1.0.pdf

  • [x] I accept the above linked CLA.

Ivan-Mahda avatar May 22 '24 09:05 Ivan-Mahda