UNPKG

@mavrykdynamics/taquito

Version:

High level functionality that builds upon the other packages in the Mavryk Typescript Library Suite.

106 lines (105 loc) 3.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRevealFeeInternal = exports.getRevealFee = exports.getRevealGasLimit = exports.ChainIds = exports.protocols = exports.Protocols = exports.COST_PER_BYTE = exports.ORIGINATION_SIZE = exports.REVEAL_STORAGE_LIMIT = exports.DEFAULT_STORAGE_LIMIT = exports.DEFAULT_FEE = exports.DEFAULT_GAS_LIMIT = void 0; /** * @deprecated default reveal gasLimit please use getRevealGasLimit(address) instead, removing hardcoded gasLimit of delegation, origination and transfer */ exports.DEFAULT_GAS_LIMIT = { DELEGATION: 10600, ORIGINATION: 10600, TRANSFER: 10600, REVEAL_TZ1: 1000, REVEAL_TZ2: 1000, REVEAL_TZ3: 2000, REVEAL_TZ4: 2000, }; /** * @deprecated default reveal fee please use getRevealFee(address) instead, removing hardcoded fee of delegation, origination and transfer */ exports.DEFAULT_FEE = { DELEGATION: 1257, ORIGINATION: 10000, TRANSFER: 10000, REVEAL: 374, }; /** * @deprecated default reveal storageLimit please use REVEAL_STORAGE_LIMIT instead, removing hardcoded storageLimit of delegation, origination and transfer */ exports.DEFAULT_STORAGE_LIMIT = { DELEGATION: 0, ORIGINATION: 257, TRANSFER: 257, REVEAL: 0, }; // value is based on mavkit-client reveal operation gasLimit of each address type const REVEAL_GAS_LIMIT = { TZ1: 169, TZ2: 155, TZ3: 445, TZ4: 1674, }; // value is based on mavkit-client reveal operation fee of each address type const REVEAL_FEE = { TZ1: 276, TZ2: 276, TZ3: 305, TZ4: 477, }; // value is based on mavkit-client reveal operation storageLimit of all address type exports.REVEAL_STORAGE_LIMIT = 0; // protocol constants exports.ORIGINATION_SIZE = 257; // protocol constants exports.COST_PER_BYTE = 250; var Protocols; (function (Protocols) { Protocols["PtAtLas"] = "PtAtLasdzXg4XxeVNtWheo13nG4wHXP22qYMqFcT3fyBpWkFero"; Protocols["PtBoreas"] = "PtBoreasK2KPuKbeYtXeEdudEHS7YcMFHE9amwheUc4kejTxgRi"; Protocols["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"; })(Protocols || (exports.Protocols = Protocols = {})); exports.protocols = { '019': [Protocols.PtAtLas], '020': [Protocols.PtBoreas], '021': [Protocols.ProtoALpha], }; var ChainIds; (function (ChainIds) { ChainIds["MAINNET"] = "NetXXAAR1wWQhhe"; ChainIds["BASENET"] = "NetXmtMsNf69w1w"; ChainIds["ATLASNET"] = "NetXvyTAafh8goH"; ChainIds["BOREASNET"] = "NetXo8SqH1c38SS"; })(ChainIds || (exports.ChainIds = ChainIds = {})); // A fixed fee reveal operation gasLimit accepted by both simulate and injection endpoint is between 1.2-5 times of actual gas consumption (3.5 fails occasionally with gas exhausted; 4 fails occasionally with fee too low) const getRevealGasLimit = (address) => Math.round((getRevealGasLimitInternal(address) * 37) / 10); exports.getRevealGasLimit = getRevealGasLimit; const getRevealGasLimitInternal = (address) => { switch (address.substring(0, 3)) { case 'mv1': return REVEAL_GAS_LIMIT.TZ1; case 'mv2': return REVEAL_GAS_LIMIT.TZ2; case 'mv3': return REVEAL_GAS_LIMIT.TZ3; case 'mv4': return REVEAL_GAS_LIMIT.TZ4; default: throw new Error(`Cannot estimate reveal gas limit for ${address}`); } }; const getRevealFee = (address) => Math.round(((0, exports.getRevealFeeInternal)(address) * 12) / 10); exports.getRevealFee = getRevealFee; const getRevealFeeInternal = (address) => { switch (address.substring(0, 3)) { case 'mv1': return REVEAL_FEE.TZ1; case 'mv2': return REVEAL_FEE.TZ2; case 'mv3': return REVEAL_FEE.TZ3; case 'mv4': return REVEAL_FEE.TZ4; default: throw new Error(`Cannot estimate reveal fee for ${address}`); } }; exports.getRevealFeeInternal = getRevealFeeInternal;