Giter Club home page Giter Club logo

gas's Introduction

Vechain Gas Price Calculation

Basic Usage

yarn add @vechain.energy/gas
import estimate from '@vechain.energy/gas'

const clauses = [{ data: '0x', value: '0x0', to: '0x1A6f69Bb160c199B1862c83291d364836558AE8F' }]
const gasEstimate = await estimate (clauses)

This will:

  1. calculate the intrinsic gas
  2. load the base price from the network
  3. send the clause for vm gas estimation to the network

It will apply the gas calculation with a default gas coef of 0 based on https://docs.vechain.org/thor/learn/transaction-calculation.html

Options are:

type Options = {
    nodeOrConnex?: Connex | string  // the network to load additional gas information from
    caller?: string                 // optional caller address for the vm gas estimation
    gasPriceCoef?: number           // priority, 0 (low) to 255 (high)}

which default to:

const defaultOptions = {
    nodeOrConnex: "https://mainnet.veblocks.net",
    gasPriceCoef: 0,
}

gas's People

Contributors

ifavo avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.