@taquito/taquito
Version:
High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.
136 lines (135 loc) • 6.49 kB
JavaScript
;
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 = void 0;
// value is based on octez-client reveal operation gasLimit of each address type in Tallinn Protocol
const REVEAL_GAS_LIMIT = {
TZ1: 171,
TZ2: 157,
TZ3: 447,
TZ4: 3252,
};
// value is based on octez-client reveal operation fee of each address type in Tallinn Protocol
const REVEAL_FEE = {
TZ1: 278,
TZ2: 277,
TZ3: 306,
TZ4: 736,
};
// value is based on octez-client reveal operation storageLimit of all address type in Tallinn Protocol
exports.REVEAL_STORAGE_LIMIT = 0;
// protocol constants in Tallinn Protocol
// NOTE: When updating constants here, also check:
// website/src/config/tezos-constants.mjs (documentation constants, versioned by doc version)
exports.ORIGINATION_SIZE = 257;
// protocol constants in Tallinn Protocol
exports.COST_PER_BYTE = 250;
var Protocols;
(function (Protocols) {
Protocols["Pt24m4xi"] = "Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd";
Protocols["PsBABY5H"] = "PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU";
Protocols["PsBabyM1"] = "PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS";
Protocols["PsCARTHA"] = "PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb";
Protocols["PsDELPH1"] = "PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo";
Protocols["PtEdo2Zk"] = "PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA";
Protocols["PsFLorena"] = "PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i";
Protocols["PtGRANADs"] = "PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV";
Protocols["PtHangz2"] = "PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx";
Protocols["PsiThaCa"] = "PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP";
Protocols["Psithaca2"] = "Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A";
Protocols["PtJakart2"] = "PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY";
Protocols["PtKathman"] = "PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg";
Protocols["PtLimaPtL"] = "PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW";
Protocols["PtMumbaii"] = "PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc";
Protocols["PtMumbai2"] = "PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1";
Protocols["PtNairobi"] = "PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf";
Protocols["ProxfordY"] = "ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH";
Protocols["PtParisBx"] = "PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ";
Protocols["PsParisCZ"] = "PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi";
Protocols["PsQuebecn"] = "PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg";
Protocols["PsRiotuma"] = "PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7";
Protocols["PtSeouLou"] = "PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh";
Protocols["PtTALLiNt"] = "PtTALLiNtPec7mE7yY4m3k26J8Qukef3E3ehzhfXgFZKGtDdAXu";
Protocols["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK";
})(Protocols || (exports.Protocols = Protocols = {}));
exports.protocols = {
'004': [Protocols.Pt24m4xi],
'005': [Protocols.PsBABY5H, Protocols.PsBabyM1],
'006': [Protocols.PsCARTHA],
'007': [Protocols.PsDELPH1],
'008': [Protocols.PtEdo2Zk], // edonet v2
'009': [Protocols.PsFLorena],
'010': [Protocols.PtGRANADs],
'011': [Protocols.PtHangz2], // hangzhou v2,
'012': [Protocols.PsiThaCa, Protocols.Psithaca2],
'013': [Protocols.PtJakart2],
'014': [Protocols.PtKathman],
'015': [Protocols.PtLimaPtL],
'016': [Protocols.PtMumbai2], // mumbai v2
'017': [Protocols.PtNairobi],
'019': [Protocols.ProxfordY],
'020': [Protocols.PtParisBx, Protocols.PsParisCZ],
'021': [Protocols.PsQuebecn],
'022': [Protocols.PsRiotuma],
'023': [Protocols.PtSeouLou],
'024': [Protocols.PtTALLiNt],
'025': [Protocols.ProtoALpha],
};
var ChainIds;
(function (ChainIds) {
ChainIds["MAINNET"] = "NetXdQprcVkpaWU";
ChainIds["GHOSTNET"] = "NetXnHfVqm9iesp";
ChainIds["SHADOWNET"] = "NetXsqzbfFenSTS";
ChainIds["CARTHAGENET"] = "NetXjD3HPJJjmcd";
ChainIds["DELPHINET"] = "NetXm8tYqnMWky1";
ChainIds["EDONET"] = "NetXSgo1ZT2DRUG";
ChainIds["FLORENCENET"] = "NetXxkAx4woPLyu";
ChainIds["GRANADANET"] = "NetXz969SFaFn8k";
ChainIds["HANGZHOUNET"] = "NetXZSsxBpMQeAT";
ChainIds["ITHACANET"] = "NetXbhmtAbMukLc";
ChainIds["JAKARTANET2"] = "NetXLH1uAxK7CCh";
ChainIds["KATHMANDUNET"] = "NetXazhm4yetmff";
ChainIds["LIMANET"] = "NetXizpkH94bocH";
ChainIds["MUMBAINET"] = "NetXQw6nWSnrJ5t";
ChainIds["MUMBAINET2"] = "NetXgbcrNtXD2yA";
ChainIds["NAIROBINET"] = "NetXyuzvDo2Ugzb";
ChainIds["OXFORDNET2"] = "NetXxWsskGahzQB";
ChainIds["PARISBNET"] = "NetXo8SqH1c38SS";
ChainIds["PARISCNET"] = "NetXXWAHLEvre9b";
ChainIds["QUEBECNET"] = "NetXuTeGinLEqxp";
ChainIds["RIONET"] = "NetXPdgaoabtBth";
ChainIds["SEOULNET"] = "NetXd56aBs1aeW3";
ChainIds["TALLINNNET"] = "NetXe8DbhW9A1eS";
})(ChainIds || (exports.ChainIds = ChainIds = {}));
const getRevealGasLimit = (address) => Math.round((getRevealGasLimitInternal(address) * 37) / 10);
exports.getRevealGasLimit = getRevealGasLimit;
const getRevealGasLimitInternal = (address) => {
switch (address.substring(0, 3)) {
case 'tz1':
return REVEAL_GAS_LIMIT.TZ1;
case 'tz2':
return REVEAL_GAS_LIMIT.TZ2;
case 'tz3':
return REVEAL_GAS_LIMIT.TZ3;
case 'tz4':
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 'tz1':
return REVEAL_FEE.TZ1;
case 'tz2':
return REVEAL_FEE.TZ2;
case 'tz3':
return REVEAL_FEE.TZ3;
case 'tz4':
return REVEAL_FEE.TZ4 * 1.7;
default:
throw new Error(`Cannot estimate reveal fee for ${address}`);
}
};
exports.getRevealFeeInternal = getRevealFeeInternal;