@mavrykdynamics/taquito
Version:
High level functionality that builds upon the other packages in the Mavryk Typescript Library Suite.
95 lines (94 loc) • 3.71 kB
TypeScript
export interface EstimateProperties {
milligasLimit: number;
storageLimit: number;
opSize: number;
minimalFeePerStorageByteMumav: number;
baseFeeMumav?: number;
}
/**
* Examples of use :
*
* Estimate a transfer operation :
* ```
* // Assuming that provider and signer are already configured...
*
* const amount = 2;
* const address = 'mv1UrqbBFBXnEdHnvSrMpt2BQnZzFMA9HQnc';
*
* // Estimate gasLimit, storageLimit and fees for a transfer operation
* const est = await Mavryk.estimate.transfer({ to: address, amount: amount })
* console.log(est.burnFeeMumav, est.gasLimit, est.minimalFeeMumav, est.storageLimit,
* est.suggestedFeeMumav, est.totalCost, est.usingBaseFeeMumav)
*
* ```
*
* Estimate a contract origination :
* ```
* // generic.json is referring to a Michelson Smart Contract
*
* const genericMultisigJSON = require('./generic.json')
* const est = await Mavryk.estimate.originate({
* code: genericMultisigJSON,
* storage: {
* stored_counter: 0,
* threshold: 1,
* keys: ['edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t']
* }
* })
* console.log(est.burnFeeMumav, est.gasLimit, est.minimalFeeMumav, est.storageLimit,
* est.suggestedFeeMumav, est.totalCost, est.usingBaseFeeMumav)
*
* ```
*/
export declare class Estimate {
private readonly _milligasLimit;
private readonly _storageLimit;
readonly opSize: number | string;
private readonly minimalFeePerStorageByteMumav;
/**
* @description Base fee in mumav (1 mumav = 1e10−6 mav)
*/
private readonly baseFeeMumav;
constructor(_milligasLimit: number | string, _storageLimit: number | string, opSize: number | string, minimalFeePerStorageByteMumav: number | string,
/**
* @description Base fee in mumav (1 mumav = 1e10−6 mav)
*/
baseFeeMumav?: number | string);
/**
* @description The number of Mumav that will be burned for the storage of the [operation](https://protocol.mavryk.org/user/glossary.html#operations). (Storage + Allocation fees)
*/
get burnFeeMumav(): number;
/**
* @description The limit on the amount of storage an [operation](https://protocol.mavryk.org/user/glossary.html#operations) can use with 20 buffer.
*/
get storageLimit(): number;
/**
* @description The limit on the amount of [gas](https://protocol.mavryk.org/user/glossary.html#gas) a given operation can consume with 100 buffer depends on the operation.
*/
get gasLimit(): number;
private get operationFeeMumav();
private roundUp;
/**
* @description Minimum fees for the [operation](https://protocol.mavryk.org/user/glossary.html#operations) according to [baker](https://protocol.mavryk.org/user/glossary.html#baker) defaults.
*/
get minimalFeeMumav(): number;
/**
* @description The suggested fee for the operation which includes minimal fees and a small buffer.
*/
get suggestedFeeMumav(): number;
/**
* @description Fees according to your specified base fee will ensure that at least minimum fees are used.
*/
get usingBaseFeeMumav(): number;
/**
* @description The sum of `minimalFeeMumav` + `burnFeeMumav`.
*/
get totalCost(): number;
/**
* @description Since Delphinet, consumed gas is provided in milligas for more precision.
* This function returns an estimation of the gas that operation will consume in milligas.
*/
get consumedMilligas(): number;
static createEstimateInstanceFromProperties(estimateProperties: EstimateProperties[]): Estimate;
static createArrayEstimateInstancesFromProperties(estimateProperties: EstimateProperties[]): Estimate[];
}