mesg-foundation / js-sdk

Javascript mono-repo with all the tools to interact with MESG
https://mesg.com
4 stars 4 forks source link

Simulate transaction before broadcasting #185

Closed antho1404 closed 4 years ago

antho1404 commented 4 years ago

Right now the transaction is sent with no simulation. This means that there is no fee optimization and no checks before sending it. We should add this step of simulating the transaction and adjusting the fees based on the simulation.

NicolasMahe commented 4 years ago

Could you quickly increase the hardcoded gas to much more? Or put a flag / config to override it? The service-ethereum cannot be deployed with the current gas limit:

➜  js-sdk git:(feature/task-refactoring) ✗ ./packages/cli/bin/run service:dev ../services/service-ethereum
  ✔ Starting environment
  ✔ Compiling service
  ✖ Creating service
    → out of gas: out of gas in location: WritePerByte; gasWanted: 300000, gasUsed: 349145
    Starting service
    Fetching service's logs
Error: out of gas: out of gas in location: WritePerByte; gasWanted: 300000, gasUsed: 349145
    at API.<anonymous> (~/Development/MESG/js-sdk/packages/api/lib/lcd.js:58:23)
    at Generator.next (<anonymous>)
    at fulfilled (~/Development/MESG/js-sdk/packages/api/lib/lcd.js:5:58)
antho1404 commented 4 years ago

Issue migrated to liteflow-labs/liteflow-js#67