@taquito/utils
Version:
Encoding, crypto, and utility helpers for Taquito.
204 lines (203 loc) • 9.56 kB
JavaScript
"use strict";
// ref https://gitlab.com/tezos/tezos/-/blob/master/src/lib_crypto/base58.ml
Object.defineProperty(exports, "__esModule", { value: true });
exports.payloadLength = exports.prefixV2 = exports.PrefixV2 = void 0;
/**
* base58 name to prefix mapping
*/
var PrefixV2;
(function (PrefixV2) {
PrefixV2["BlockHash"] = "B";
PrefixV2["OperationHash"] = "o";
PrefixV2["OperationListHash"] = "Lo";
PrefixV2["OperationListListHash"] = "LLo";
PrefixV2["ProtocolHash"] = "P";
PrefixV2["ContextHash"] = "Co";
PrefixV2["BlockMetadataHash"] = "bm";
PrefixV2["OperationMetadataHash"] = "r";
PrefixV2["OperationMetadataListHash"] = "Lr";
PrefixV2["OperationMetadataListListHash"] = "LLr";
PrefixV2["Ed25519PublicKeyHash"] = "tz1";
PrefixV2["Secp256k1PublicKeyHash"] = "tz2";
PrefixV2["P256PublicKeyHash"] = "tz3";
PrefixV2["ContractHash"] = "KT1";
PrefixV2["BlindedPublicKeyHash"] = "btz1";
PrefixV2["BLS12_381PublicKeyHash"] = "tz4";
PrefixV2["TXRollupAddress"] = "txr1";
PrefixV2["ZkRollupHash"] = "epx1";
PrefixV2["ScRollupHash"] = "scr1";
PrefixV2["SmartRollupHash"] = "sr1";
PrefixV2["CryptoboxPublicKeyHash"] = "id";
PrefixV2["Ed25519Seed"] = "edsk";
PrefixV2["Ed25519PublicKey"] = "edpk";
PrefixV2["Secp256k1SecretKey"] = "spsk";
PrefixV2["P256SecretKey"] = "p2sk";
PrefixV2["BLS12_381SecretKey"] = "BLsk";
PrefixV2["ValueHash"] = "vh";
PrefixV2["CycleNonce"] = "nce";
PrefixV2["ScriptExpr"] = "expr";
PrefixV2["InboxHash"] = "txi";
PrefixV2["MessageHash"] = "txm";
PrefixV2["CommitmentHash"] = "txc";
PrefixV2["MessageResultHash"] = "txmr";
PrefixV2["MessageResultListHash"] = "txM";
PrefixV2["WithdrawListHash"] = "txw";
PrefixV2["ScRollupStateHash"] = "scs1";
PrefixV2["ScRollupCommitmentHash"] = "scc1";
PrefixV2["SmartRollupStateHash"] = "srs1";
PrefixV2["SmartRollupCommitmentHash"] = "src1";
PrefixV2["Ed25519EncryptedSeed"] = "edesk";
PrefixV2["Secp256k1EncryptedSecretKey"] = "spesk";
PrefixV2["P256EncryptedSecretKey"] = "p2esk";
PrefixV2["BLS12_381EncryptedSecretKey"] = "BLesk";
PrefixV2["Secp256k1EncryptedScalar"] = "seesk";
PrefixV2["Secp256k1PublicKey"] = "sppk";
PrefixV2["P256PublicKey"] = "p2pk";
PrefixV2["Secp256k1Scalar"] = "SSp";
PrefixV2["Secp256k1Element"] = "GSp";
PrefixV2["Ed25519SecretKey"] = "_edsk";
PrefixV2["Ed25519Signature"] = "edsig";
PrefixV2["Secp256k1Signature"] = "spsig1";
PrefixV2["P256Signature"] = "p2sig";
PrefixV2["GenericSignature"] = "sig";
PrefixV2["ChainID"] = "Net";
PrefixV2["SaplingSpendingKey"] = "sask";
PrefixV2["EncryptedSaplingSpendingKey"] = "_sask";
PrefixV2["SaplingAddress"] = "zet1";
PrefixV2["GenericAggregateSignature"] = "asig";
PrefixV2["BLS12_381Signature"] = "BLsig";
PrefixV2["BLS12_381PublicKey"] = "BLpk";
PrefixV2["SlotHeader"] = "sh";
})(PrefixV2 || (exports.PrefixV2 = PrefixV2 = {}));
/**
* base58 prefix to bytes mapping
*/
exports.prefixV2 = {
[]: new Uint8Array([1, 52]),
[]: new Uint8Array([5, 116]),
[]: new Uint8Array([133, 233]),
[]: new Uint8Array([29, 159, 109]),
[]: new Uint8Array([2, 170]),
[]: new Uint8Array([79, 199]),
[]: new Uint8Array([234, 249]),
[]: new Uint8Array([5, 183]),
[]: new Uint8Array([134, 39]),
[]: new Uint8Array([29, 159, 182]),
[]: new Uint8Array([6, 161, 159]),
[]: new Uint8Array([6, 161, 161]),
[]: new Uint8Array([6, 161, 164]),
[]: new Uint8Array([2, 90, 121]),
[]: new Uint8Array([1, 2, 49, 223]),
[]: new Uint8Array([6, 161, 166]),
[]: new Uint8Array([1, 128, 120, 31]),
[]: new Uint8Array([1, 23, 224, 125]),
[]: new Uint8Array([1, 118, 132, 217]),
[]: new Uint8Array([6, 124, 117]),
[]: new Uint8Array([153, 103]),
[]: new Uint8Array([13, 15, 58, 7]),
[]: new Uint8Array([13, 15, 37, 217]),
[]: new Uint8Array([17, 162, 224, 201]),
[]: new Uint8Array([16, 81, 238, 189]),
[]: new Uint8Array([3, 150, 192, 40]),
[]: new Uint8Array([1, 106, 242]),
[]: new Uint8Array([69, 220, 169]),
[]: new Uint8Array([13, 44, 64, 27]),
[]: new Uint8Array([79, 148, 196]),
[]: new Uint8Array([79, 149, 30]),
[]: new Uint8Array([79, 148, 17]),
[]: new Uint8Array([18, 7, 206, 87]),
[]: new Uint8Array([79, 146, 82]),
[]: new Uint8Array([79, 150, 72]),
[]: new Uint8Array([17, 144, 122, 202]),
[]: new Uint8Array([17, 144, 21, 100]),
[]: new Uint8Array([17, 165, 235, 240]),
[]: new Uint8Array([17, 165, 134, 138]),
[]: new Uint8Array([7, 90, 60, 179, 41]),
[]: new Uint8Array([9, 237, 241, 174, 150]),
[]: new Uint8Array([9, 48, 57, 115, 171]),
[]: new Uint8Array([2, 5, 30, 53, 25]),
[]: new Uint8Array([1, 131, 36, 86, 248]),
[]: new Uint8Array([3, 254, 226, 86]),
[]: new Uint8Array([3, 178, 139, 127]),
[]: new Uint8Array([38, 248, 136]),
[]: new Uint8Array([5, 92, 0]),
[]: new Uint8Array([43, 246, 78, 7]),
[]: new Uint8Array([9, 245, 205, 134, 18]),
[]: new Uint8Array([13, 115, 101, 19, 63]),
[]: new Uint8Array([54, 240, 44, 52]),
[]: new Uint8Array([4, 130, 43]),
[]: new Uint8Array([87, 82, 0]),
[]: new Uint8Array([11, 237, 20, 92]),
[]: new Uint8Array([11, 237, 20, 92]),
[]: new Uint8Array([18, 71, 40, 223]),
[]: new Uint8Array([2, 75, 234, 101]),
[]: new Uint8Array([40, 171, 64, 207]),
[]: new Uint8Array([6, 149, 135, 204]),
[]: new Uint8Array([2, 116, 180]),
};
/**
* base58 prefix to payload length mapping
*/
exports.payloadLength = {
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 20,
[]: 20,
[]: 20,
[]: 20,
[]: 20,
[]: 20,
[]: 20,
[]: 20,
[]: 20,
[]: 20,
[]: 16,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 32,
[]: 56,
[]: 56,
[]: 56,
[]: 56,
[]: 60,
[]: 33,
[]: 33,
[]: 33,
[]: 33,
[]: 64,
[]: 64,
[]: 64,
[]: 64,
[]: 64,
[]: 4,
[]: 169,
[]: 193,
[]: 43,
[]: 96,
[]: 96,
[]: 48,
[]: 48,
};