@taquito/local-forging
Advanced tools
Comparing version 18.0.0-RC.0 to 19.0.0-beta-RC.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.paddedBytesEncoder = exports.depositsLimitDecoder = exports.burnLimitDecoder = exports.burnLimitEncoder = exports.entrypointNameDecoder = exports.entrypointNameEncoder = exports.blockPayloadHashDecoder = exports.blockPayloadHashEncoder = exports.valueParameterDecoder = exports.valueParameterEncoder = exports.parametersEncoder = exports.entrypointEncoder = exports.parametersDecoder = exports.entrypointDecoder = exports.zarithDecoder = exports.zarithEncoder = exports.smartRollupCommitmentHashDecoder = exports.smartContractAddressDecoder = exports.smartRollupAddressDecoder = exports.addressDecoder = exports.smartRollupCommitmentHashEncoder = exports.publicKeyDecoder = exports.smartContractAddressEncoder = exports.smartRollupAddressEncoder = exports.addressEncoder = exports.publicKeyEncoder = exports.pkhEncoder = exports.delegateDecoder = exports.boolDecoder = exports.int16Decoder = exports.int16Encoder = exports.int32Decoder = exports.int32Encoder = exports.delegateEncoder = exports.pvmKindDecoder = exports.pvmKindEncoder = exports.ballotDecoder = exports.ballotEncoder = exports.proposalsEncoder = exports.proposalsDecoder = exports.proposalDecoder = exports.proposalEncoder = exports.boolEncoder = exports.tz1Encoder = exports.branchEncoder = exports.pkhDecoder = exports.branchDecoder = exports.tz1Decoder = exports.prefixDecoder = exports.prefixEncoder = void 0; | ||
exports.smartRollupMessageDecoder = exports.smartRollupMessageEncoder = exports.paddedBytesDecoder = void 0; | ||
exports.burnLimitDecoder = exports.burnLimitEncoder = exports.entrypointNameDecoder = exports.entrypointNameEncoder = exports.blockPayloadHashDecoder = exports.blockPayloadHashEncoder = exports.valueParameterDecoder = exports.valueParameterEncoder = exports.parametersEncoder = exports.entrypointEncoder = exports.parametersDecoder = exports.entrypointDecoder = exports.zarithDecoder = exports.zarithEncoder = exports.smartRollupCommitmentHashDecoder = exports.smartContractAddressDecoder = exports.smartRollupAddressDecoder = exports.addressDecoder = exports.smartRollupCommitmentHashEncoder = exports.publicKeyDecoder = exports.smartContractAddressEncoder = exports.smartRollupAddressEncoder = exports.addressEncoder = exports.publicKeyEncoder = exports.publicKeyHashesEncoder = exports.publicKeyHashEncoder = exports.delegateDecoder = exports.boolDecoder = exports.int16Decoder = exports.int16Encoder = exports.int32Decoder = exports.int32Encoder = exports.delegateEncoder = exports.pvmKindDecoder = exports.pvmKindEncoder = exports.ballotDecoder = exports.ballotEncoder = exports.proposalsEncoder = exports.proposalsDecoder = exports.proposalDecoder = exports.proposalEncoder = exports.boolEncoder = exports.tz1Encoder = exports.branchEncoder = exports.publicKeyHashesDecoder = exports.publicKeyHashDecoder = exports.branchDecoder = exports.tz1Decoder = exports.prefixDecoder = exports.prefixEncoder = void 0; | ||
exports.smartRollupMessageDecoder = exports.smartRollupMessageEncoder = exports.paddedBytesDecoder = exports.paddedBytesEncoder = exports.depositsLimitDecoder = exports.depositsLimitEncoder = void 0; | ||
const utils_1 = require("@taquito/utils"); | ||
@@ -15,3 +15,3 @@ const errors_1 = require("./errors"); | ||
const prefixEncoder = (prefix) => (str) => { | ||
return utils_1.buf2hex(Buffer.from(utils_1.b58cdecode(str, utils_1.prefix[prefix]))); | ||
return (0, utils_1.buf2hex)(Buffer.from((0, utils_1.b58cdecode)(str, utils_1.prefix[prefix]))); | ||
}; | ||
@@ -21,30 +21,42 @@ exports.prefixEncoder = prefixEncoder; | ||
const val = str.consume(utils_1.prefixLength[pre]); | ||
return utils_1.b58cencode(val, utils_1.prefix[pre]); | ||
return (0, utils_1.b58cencode)(val, utils_1.prefix[pre]); | ||
}; | ||
exports.prefixDecoder = prefixDecoder; | ||
exports.tz1Decoder = exports.prefixDecoder(utils_1.Prefix.TZ1); | ||
exports.branchDecoder = exports.prefixDecoder(utils_1.Prefix.B); | ||
const pkhDecoder = (val) => { | ||
exports.tz1Decoder = (0, exports.prefixDecoder)(utils_1.Prefix.TZ1); | ||
exports.branchDecoder = (0, exports.prefixDecoder)(utils_1.Prefix.B); | ||
const publicKeyHashDecoder = (val) => { | ||
const prefix = val.consume(1); | ||
if (prefix[0] === 0x00) { | ||
return exports.prefixDecoder(utils_1.Prefix.TZ1)(val); | ||
return (0, exports.prefixDecoder)(utils_1.Prefix.TZ1)(val); | ||
} | ||
else if (prefix[0] === 0x01) { | ||
return exports.prefixDecoder(utils_1.Prefix.TZ2)(val); | ||
return (0, exports.prefixDecoder)(utils_1.Prefix.TZ2)(val); | ||
} | ||
else if (prefix[0] === 0x02) { | ||
return exports.prefixDecoder(utils_1.Prefix.TZ3)(val); | ||
return (0, exports.prefixDecoder)(utils_1.Prefix.TZ3)(val); | ||
} | ||
}; | ||
exports.pkhDecoder = pkhDecoder; | ||
exports.branchEncoder = exports.prefixEncoder(utils_1.Prefix.B); | ||
exports.tz1Encoder = exports.prefixEncoder(utils_1.Prefix.TZ1); | ||
exports.publicKeyHashDecoder = publicKeyHashDecoder; | ||
const publicKeyHashesDecoder = (val) => { | ||
if (!(0, exports.boolDecoder)(val)) { | ||
return undefined; | ||
} | ||
const publicKeyHashes = []; | ||
val.consume(4); | ||
while (val.length() > 0) { | ||
publicKeyHashes.push((0, exports.publicKeyHashDecoder)(val)); | ||
} | ||
return publicKeyHashes; | ||
}; | ||
exports.publicKeyHashesDecoder = publicKeyHashesDecoder; | ||
exports.branchEncoder = (0, exports.prefixEncoder)(utils_1.Prefix.B); | ||
exports.tz1Encoder = (0, exports.prefixEncoder)(utils_1.Prefix.TZ1); | ||
const boolEncoder = (bool) => (bool ? 'ff' : '00'); | ||
exports.boolEncoder = boolEncoder; | ||
const proposalEncoder = (proposal) => { | ||
return exports.prefixEncoder(utils_1.Prefix.P)(proposal); | ||
return (0, exports.prefixEncoder)(utils_1.Prefix.P)(proposal); | ||
}; | ||
exports.proposalEncoder = proposalEncoder; | ||
const proposalDecoder = (proposal) => { | ||
return exports.prefixDecoder(utils_1.Prefix.P)(proposal); | ||
return (0, exports.prefixDecoder)(utils_1.Prefix.P)(proposal); | ||
}; | ||
@@ -56,3 +68,3 @@ exports.proposalDecoder = proposalDecoder; | ||
while (proposal.length() > 0) { | ||
proposals.push(exports.proposalDecoder(proposal)); | ||
proposals.push((0, exports.proposalDecoder)(proposal)); | ||
} | ||
@@ -63,3 +75,3 @@ return proposals; | ||
const proposalsEncoder = (proposals) => { | ||
return utils_2.pad(32 * proposals.length) + proposals.map((x) => exports.proposalEncoder(x)).join(''); | ||
return (0, utils_2.pad)(32 * proposals.length) + proposals.map((x) => (0, exports.proposalEncoder)(x)).join(''); | ||
}; | ||
@@ -100,2 +112,4 @@ exports.proposalsEncoder = proposalsEncoder; | ||
return '01'; | ||
case 'riscv': | ||
return '02'; | ||
default: | ||
@@ -113,2 +127,4 @@ throw new errors_1.UnsupportedPvmKindError(pvm); | ||
return 'wasm_2_0_0'; | ||
case 0x02: | ||
return 'riscv'; | ||
default: | ||
@@ -121,6 +137,6 @@ throw new errors_1.DecodePvmKindError(value[0].toString()); | ||
if (val) { | ||
return exports.boolEncoder(true) + exports.pkhEncoder(val); | ||
return (0, exports.boolEncoder)(true) + (0, exports.publicKeyHashEncoder)(val); | ||
} | ||
else { | ||
return exports.boolEncoder(false); | ||
return (0, exports.boolEncoder)(false); | ||
} | ||
@@ -173,25 +189,38 @@ }; | ||
const delegateDecoder = (val) => { | ||
const hasDelegate = exports.boolDecoder(val); | ||
const hasDelegate = (0, exports.boolDecoder)(val); | ||
if (hasDelegate) { | ||
return exports.pkhDecoder(val); | ||
return (0, exports.publicKeyHashDecoder)(val); | ||
} | ||
}; | ||
exports.delegateDecoder = delegateDecoder; | ||
const pkhEncoder = (val) => { | ||
const publicKeyHashEncoder = (val) => { | ||
const pubkeyPrefix = val.substring(0, 3); | ||
switch (pubkeyPrefix) { | ||
case utils_1.Prefix.TZ1: | ||
return '00' + exports.prefixEncoder(utils_1.Prefix.TZ1)(val); | ||
return '00' + (0, exports.prefixEncoder)(utils_1.Prefix.TZ1)(val); | ||
case utils_1.Prefix.TZ2: | ||
return '01' + exports.prefixEncoder(utils_1.Prefix.TZ2)(val); | ||
return '01' + (0, exports.prefixEncoder)(utils_1.Prefix.TZ2)(val); | ||
case utils_1.Prefix.TZ3: | ||
return '02' + exports.prefixEncoder(utils_1.Prefix.TZ3)(val); | ||
return '02' + (0, exports.prefixEncoder)(utils_1.Prefix.TZ3)(val); | ||
case utils_1.Prefix.TZ4: | ||
return '03' + exports.prefixEncoder(utils_1.Prefix.TZ4)(val); | ||
return '03' + (0, exports.prefixEncoder)(utils_1.Prefix.TZ4)(val); | ||
default: | ||
throw new utils_1.InvalidKeyHashError(val, utils_1.invalidDetail(utils_1.ValidationResult.NO_PREFIX_MATCHED) + | ||
throw new utils_1.InvalidKeyHashError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + | ||
` expecting one for the following "${utils_1.Prefix.TZ1}", "${utils_1.Prefix.TZ2}", "${utils_1.Prefix.TZ3}" or "${utils_1.Prefix.TZ4}".`); | ||
} | ||
}; | ||
exports.pkhEncoder = pkhEncoder; | ||
exports.publicKeyHashEncoder = publicKeyHashEncoder; | ||
const publicKeyHashesEncoder = (val) => { | ||
if (!val) { | ||
return (0, exports.boolEncoder)(false); | ||
} | ||
if (val.length === 0) { | ||
return (0, exports.boolEncoder)(true) + (0, utils_2.pad)(0); | ||
} | ||
const publicKeyHashes = val.reduce((prev, curr) => { | ||
return prev + (0, exports.publicKeyHashEncoder)(curr); | ||
}, ''); | ||
return (0, exports.boolEncoder)(true) + (0, utils_2.pad)(publicKeyHashes.length / 2) + publicKeyHashes; | ||
}; | ||
exports.publicKeyHashesEncoder = publicKeyHashesEncoder; | ||
const publicKeyEncoder = (val) => { | ||
@@ -201,9 +230,9 @@ const pubkeyPrefix = val.substring(0, 4); | ||
case utils_1.Prefix.EDPK: | ||
return '00' + exports.prefixEncoder(utils_1.Prefix.EDPK)(val); | ||
return '00' + (0, exports.prefixEncoder)(utils_1.Prefix.EDPK)(val); | ||
case utils_1.Prefix.SPPK: | ||
return '01' + exports.prefixEncoder(utils_1.Prefix.SPPK)(val); | ||
return '01' + (0, exports.prefixEncoder)(utils_1.Prefix.SPPK)(val); | ||
case utils_1.Prefix.P2PK: | ||
return '02' + exports.prefixEncoder(utils_1.Prefix.P2PK)(val); | ||
return '02' + (0, exports.prefixEncoder)(utils_1.Prefix.P2PK)(val); | ||
default: | ||
throw new utils_1.InvalidPublicKeyError(val, utils_1.invalidDetail(utils_1.ValidationResult.NO_PREFIX_MATCHED) + | ||
throw new utils_1.InvalidPublicKeyError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + | ||
` expecting one of the following '${utils_1.Prefix.EDPK}', '${utils_1.Prefix.SPPK}', '${utils_1.Prefix.P2PK}' or '${utils_1.Prefix.BLPK}'.`); | ||
@@ -220,7 +249,7 @@ } | ||
case utils_1.Prefix.TZ4: | ||
return '00' + exports.pkhEncoder(val); | ||
return '00' + (0, exports.publicKeyHashEncoder)(val); | ||
case utils_1.Prefix.KT1: | ||
return '01' + exports.prefixEncoder(utils_1.Prefix.KT1)(val) + '00'; | ||
return '01' + (0, exports.prefixEncoder)(utils_1.Prefix.KT1)(val) + '00'; | ||
default: | ||
throw new core_1.InvalidAddressError(val, utils_1.invalidDetail(utils_1.ValidationResult.NO_PREFIX_MATCHED) + | ||
throw new core_1.InvalidAddressError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + | ||
` expecting one of the following prefix '${utils_1.Prefix.TZ1}', ${utils_1.Prefix.TZ2}', '${utils_1.Prefix.TZ3}', '${utils_1.Prefix.TZ4}' or '${utils_1.Prefix.KT1}'.`); | ||
@@ -232,5 +261,5 @@ } | ||
if (val.substring(0, 3) !== utils_1.Prefix.SR1) { | ||
throw new errors_1.InvalidSmartRollupAddressError(val, utils_1.invalidDetail(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SR1}'.`); | ||
throw new errors_1.InvalidSmartRollupAddressError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SR1}'.`); | ||
} | ||
return exports.prefixEncoder(utils_1.Prefix.SR1)(val); | ||
return (0, exports.prefixEncoder)(utils_1.Prefix.SR1)(val); | ||
}; | ||
@@ -241,5 +270,5 @@ exports.smartRollupAddressEncoder = smartRollupAddressEncoder; | ||
if (prefix === utils_1.Prefix.KT1) { | ||
return '01' + exports.prefixEncoder(utils_1.Prefix.KT1)(val) + '00'; | ||
return '01' + (0, exports.prefixEncoder)(utils_1.Prefix.KT1)(val) + '00'; | ||
} | ||
throw new core_1.InvalidContractAddressError(val, utils_1.invalidDetail(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.KT1}'.`); | ||
throw new core_1.InvalidContractAddressError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.KT1}'.`); | ||
}; | ||
@@ -251,9 +280,9 @@ exports.smartContractAddressEncoder = smartContractAddressEncoder; | ||
case 0x00: | ||
return exports.prefixDecoder(utils_1.Prefix.EDPK)(val); | ||
return (0, exports.prefixDecoder)(utils_1.Prefix.EDPK)(val); | ||
case 0x01: | ||
return exports.prefixDecoder(utils_1.Prefix.SPPK)(val); | ||
return (0, exports.prefixDecoder)(utils_1.Prefix.SPPK)(val); | ||
case 0x02: | ||
return exports.prefixDecoder(utils_1.Prefix.P2PK)(val); | ||
return (0, exports.prefixDecoder)(utils_1.Prefix.P2PK)(val); | ||
default: | ||
throw new utils_1.InvalidPublicKeyError(val.toString(), utils_1.invalidDetail(utils_1.ValidationResult.NO_PREFIX_MATCHED)); | ||
throw new utils_1.InvalidPublicKeyError(val.toString(), (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED)); | ||
} | ||
@@ -265,5 +294,5 @@ }; | ||
if (prefix === utils_1.Prefix.SRC1) { | ||
return exports.prefixEncoder(utils_1.Prefix.SRC1)(val); | ||
return (0, exports.prefixEncoder)(utils_1.Prefix.SRC1)(val); | ||
} | ||
throw new errors_1.InvalidSmartRollupCommitmentHashError(val, utils_1.invalidDetail(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SRC1}'`); | ||
throw new errors_1.InvalidSmartRollupCommitmentHashError(val, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SRC1}'`); | ||
}; | ||
@@ -275,5 +304,5 @@ exports.smartRollupCommitmentHashEncoder = smartRollupCommitmentHashEncoder; | ||
case 0x00: | ||
return exports.pkhDecoder(val); | ||
return (0, exports.publicKeyHashDecoder)(val); | ||
case 0x01: { | ||
const address = exports.prefixDecoder(utils_1.Prefix.KT1)(val); | ||
const address = (0, exports.prefixDecoder)(utils_1.Prefix.KT1)(val); | ||
val.consume(1); | ||
@@ -288,5 +317,5 @@ return address; | ||
const smartRollupAddressDecoder = (val) => { | ||
const address = exports.prefixDecoder(utils_1.Prefix.SR1)(val); | ||
const address = (0, exports.prefixDecoder)(utils_1.Prefix.SR1)(val); | ||
if (address.substring(0, 3) !== utils_1.Prefix.SR1) { | ||
throw new errors_1.InvalidSmartRollupAddressError(address, utils_1.invalidDetail(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SR1}'.`); | ||
throw new errors_1.InvalidSmartRollupAddressError(address, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SR1}'.`); | ||
} | ||
@@ -299,13 +328,13 @@ return address; | ||
if (preamble[0] === 0x01) { | ||
const scAddress = exports.prefixDecoder(utils_1.Prefix.KT1)(val); | ||
const scAddress = (0, exports.prefixDecoder)(utils_1.Prefix.KT1)(val); | ||
val.consume(1); | ||
return scAddress; | ||
} | ||
throw new core_1.InvalidContractAddressError(val.toString(), utils_1.invalidDetail(utils_1.ValidationResult.NO_PREFIX_MATCHED)); | ||
throw new core_1.InvalidContractAddressError(val.toString(), (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED)); | ||
}; | ||
exports.smartContractAddressDecoder = smartContractAddressDecoder; | ||
const smartRollupCommitmentHashDecoder = (val) => { | ||
const address = exports.prefixDecoder(utils_1.Prefix.SRC1)(val); | ||
const address = (0, exports.prefixDecoder)(utils_1.Prefix.SRC1)(val); | ||
if (address.substring(0, 4) !== utils_1.Prefix.SRC1) { | ||
throw new errors_1.InvalidSmartRollupCommitmentHashError(address, utils_1.invalidDetail(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SRC1}'`); | ||
throw new errors_1.InvalidSmartRollupCommitmentHashError(address, (0, utils_1.invalidDetail)(utils_1.ValidationResult.NO_PREFIX_MATCHED) + ` expecting prefix '${utils_1.Prefix.SRC1}'`); | ||
} | ||
@@ -356,3 +385,3 @@ return address; | ||
const entrypointDecoder = (value) => { | ||
const preamble = utils_2.pad(value.consume(1)[0], 2); | ||
const preamble = (0, utils_2.pad)(value.consume(1)[0], 2); | ||
if (preamble in constants_1.entrypointMapping) { | ||
@@ -362,3 +391,3 @@ return constants_1.entrypointMapping[preamble]; | ||
else { | ||
const entry = codec_1.extractRequiredLen(value, 1); | ||
const entry = (0, codec_1.extractRequiredLen)(value, 1); | ||
const entrypoint = Buffer.from(entry).toString('utf8'); | ||
@@ -378,5 +407,5 @@ if (entrypoint.length > constants_1.ENTRYPOINT_MAX_LENGTH) { | ||
else { | ||
const encodedEntrypoint = exports.entrypointDecoder(val); | ||
const params = codec_1.extractRequiredLen(val); | ||
const parameters = codec_1.valueDecoder(new uint8array_consumer_1.Uint8ArrayConsumer(params)); | ||
const encodedEntrypoint = (0, exports.entrypointDecoder)(val); | ||
const params = (0, codec_1.extractRequiredLen)(val); | ||
const parameters = (0, codec_1.valueDecoder)(new uint8array_consumer_1.Uint8ArrayConsumer(params)); | ||
return { | ||
@@ -398,3 +427,3 @@ entrypoint: encodedEntrypoint, | ||
const value = { string: entrypoint }; | ||
return `ff${codec_1.valueEncoder(value).slice(8)}`; | ||
return `ff${(0, codec_1.valueEncoder)(value).slice(8)}`; | ||
} | ||
@@ -407,4 +436,4 @@ }; | ||
} | ||
const encodedEntrypoint = exports.entrypointEncoder(val.entrypoint); | ||
const parameters = codec_1.valueEncoder(val.value); | ||
const encodedEntrypoint = (0, exports.entrypointEncoder)(val.entrypoint); | ||
const parameters = (0, codec_1.valueEncoder)(val.value); | ||
const length = (parameters.length / 2).toString(16).padStart(8, '0'); | ||
@@ -415,20 +444,20 @@ return `ff${encodedEntrypoint}${length}${parameters}`; | ||
const valueParameterEncoder = (value) => { | ||
const valueEncoded = codec_1.valueEncoder(value); | ||
return `${utils_2.pad(valueEncoded.length / 2)}${valueEncoded}`; | ||
const valueEncoded = (0, codec_1.valueEncoder)(value); | ||
return `${(0, utils_2.pad)(valueEncoded.length / 2)}${valueEncoded}`; | ||
}; | ||
exports.valueParameterEncoder = valueParameterEncoder; | ||
const valueParameterDecoder = (val) => { | ||
const value = codec_1.extractRequiredLen(val); | ||
return codec_1.valueDecoder(new uint8array_consumer_1.Uint8ArrayConsumer(value)); | ||
const value = (0, codec_1.extractRequiredLen)(val); | ||
return (0, codec_1.valueDecoder)(new uint8array_consumer_1.Uint8ArrayConsumer(value)); | ||
}; | ||
exports.valueParameterDecoder = valueParameterDecoder; | ||
exports.blockPayloadHashEncoder = exports.prefixEncoder(utils_1.Prefix.VH); | ||
exports.blockPayloadHashDecoder = exports.prefixDecoder(utils_1.Prefix.VH); | ||
exports.blockPayloadHashEncoder = (0, exports.prefixEncoder)(utils_1.Prefix.VH); | ||
exports.blockPayloadHashDecoder = (0, exports.prefixDecoder)(utils_1.Prefix.VH); | ||
const entrypointNameEncoder = (entrypoint) => { | ||
const value = { string: entrypoint }; | ||
return `${codec_1.valueEncoder(value).slice(2)}`; | ||
return `${(0, codec_1.valueEncoder)(value).slice(2)}`; | ||
}; | ||
exports.entrypointNameEncoder = entrypointNameEncoder; | ||
const entrypointNameDecoder = (val) => { | ||
const entry = codec_1.extractRequiredLen(val); | ||
const entry = (0, codec_1.extractRequiredLen)(val); | ||
return Buffer.from(entry).toString('utf8'); | ||
@@ -438,3 +467,3 @@ }; | ||
const burnLimitEncoder = (val) => { | ||
return !val ? '00' : `ff${exports.zarithEncoder(val)}`; | ||
return !val ? '00' : `ff${(0, exports.zarithEncoder)(val)}`; | ||
}; | ||
@@ -445,10 +474,14 @@ exports.burnLimitEncoder = burnLimitEncoder; | ||
if (Buffer.from(prefix).toString('hex') !== '00') { | ||
return exports.zarithDecoder(value); | ||
return (0, exports.zarithDecoder)(value); | ||
} | ||
}; | ||
exports.burnLimitDecoder = burnLimitDecoder; | ||
const depositsLimitEncoder = (val) => { | ||
return !val ? '00' : `ff${(0, exports.zarithEncoder)(val)}`; | ||
}; | ||
exports.depositsLimitEncoder = depositsLimitEncoder; | ||
const depositsLimitDecoder = (value) => { | ||
const prefix = value.consume(1); | ||
if (Buffer.from(prefix).toString('hex') !== '00') { | ||
return exports.zarithDecoder(value); | ||
return (0, exports.zarithDecoder)(value); | ||
} | ||
@@ -458,7 +491,7 @@ }; | ||
const paddedBytesEncoder = (val, paddingLength = 8) => { | ||
return `${utils_2.pad(val.length / 2, paddingLength)}${val}`; | ||
return `${(0, utils_2.pad)(val.length / 2, paddingLength)}${val}`; | ||
}; | ||
exports.paddedBytesEncoder = paddedBytesEncoder; | ||
const paddedBytesDecoder = (val) => { | ||
const value = codec_1.extractRequiredLen(val); | ||
const value = (0, codec_1.extractRequiredLen)(val); | ||
return Buffer.from(value).toString('hex'); | ||
@@ -469,13 +502,12 @@ }; | ||
const message = val.reduce((prev, curr) => { | ||
return prev + `${utils_2.pad(curr.length / 2)}${curr}`; | ||
return prev + `${(0, utils_2.pad)(curr.length / 2)}${curr}`; | ||
}, ''); | ||
return `${utils_2.pad(message.length / 2)}${message}`; | ||
return `${(0, utils_2.pad)(message.length / 2)}${message}`; | ||
}; | ||
exports.smartRollupMessageEncoder = smartRollupMessageEncoder; | ||
const smartRollupMessageDecoder = (val) => { | ||
const valueArray = codec_1.extractRequiredLen(val); | ||
const ret = codec_1.stripLengthPrefixFromBytes(new uint8array_consumer_1.Uint8ArrayConsumer(valueArray)); | ||
const valueArray = (0, codec_1.extractRequiredLen)(val); | ||
const ret = (0, codec_1.stripLengthPrefixFromBytes)(new uint8array_consumer_1.Uint8ArrayConsumer(valueArray)); | ||
return ret.map((value) => Buffer.from(value).toString('hex')); | ||
}; | ||
exports.smartRollupMessageDecoder = smartRollupMessageDecoder; | ||
//# sourceMappingURL=codec.js.map |
@@ -20,2 +20,3 @@ "use strict"; | ||
CODEC["PKH"] = "pkh"; | ||
CODEC["PKH_ARR"] = "pkhArr"; | ||
CODEC["DELEGATE"] = "delegate"; | ||
@@ -63,3 +64,3 @@ CODEC["SCRIPT"] = "script"; | ||
CODEC["OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE"] = "smart_rollup_execute_outbox_message"; | ||
})(CODEC = exports.CODEC || (exports.CODEC = {})); | ||
})(CODEC || (exports.CODEC = CODEC = {})); | ||
// See https://tezos.gitlab.io/whitedoc/michelson.html#full-grammar | ||
@@ -258,3 +259,3 @@ exports.opMapping = { | ||
const keyNum = typeof key === 'string' ? parseInt(key, 10) : key; | ||
result[exports.kindMapping[keyNum]] = utils_1.pad(keyNum, 2); | ||
result[exports.kindMapping[keyNum]] = (0, utils_1.pad)(keyNum, 2); | ||
}); | ||
@@ -279,2 +280,1 @@ return result; | ||
})(); | ||
//# sourceMappingURL=constants.js.map |
@@ -10,4 +10,4 @@ "use strict"; | ||
exports.decoders = { | ||
[constants_1.CODEC.SECRET]: (val) => utils_1.toHexString(val.consume(20)), | ||
[constants_1.CODEC.RAW]: (val) => utils_1.toHexString(val.consume(32)), | ||
[constants_1.CODEC.SECRET]: (val) => (0, utils_1.toHexString)(val.consume(20)), | ||
[constants_1.CODEC.RAW]: (val) => (0, utils_1.toHexString)(val.consume(32)), | ||
[constants_1.CODEC.TZ1]: codec_1.tz1Decoder, | ||
@@ -17,3 +17,4 @@ [constants_1.CODEC.BRANCH]: codec_1.branchDecoder, | ||
[constants_1.CODEC.PUBLIC_KEY]: codec_1.publicKeyDecoder, | ||
[constants_1.CODEC.PKH]: codec_1.pkhDecoder, | ||
[constants_1.CODEC.PKH]: codec_1.publicKeyHashDecoder, | ||
[constants_1.CODEC.PKH_ARR]: codec_1.publicKeyHashesDecoder, | ||
[constants_1.CODEC.DELEGATE]: codec_1.delegateDecoder, | ||
@@ -40,24 +41,23 @@ [constants_1.CODEC.INT32]: codec_1.int32Decoder, | ||
}; | ||
exports.decoders[constants_1.CODEC.OPERATION] = operation_1.operationDecoder(exports.decoders); | ||
exports.decoders[constants_1.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.ActivationSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_FAILING_NOOP] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.FailingNoopSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_DELEGATION] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.DelegationSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_TRANSACTION] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.TransactionSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_ORIGINATION] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.OriginationSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_BALLOT] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.BallotSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_ATTESTATION] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.AttestationSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_ENDORSEMENT] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.EndorsementSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_SEED_NONCE_REVELATION] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.SeedNonceRevelationSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_PROPOSALS] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.ProposalsSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_REVEAL] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.RevealSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.RegisterGlobalConstantSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_TRANSFER_TICKET] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.TransferTicketSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_INCREASE_PAID_STORAGE] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.IncreasePaidStorageSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.UpdateConsensusKeySchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_DRAIN_DELEGATE] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.DrainDelegateSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.SmartRollupOriginateSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.SmartRollupAddMessagesSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.SmartRollupExecuteOutboxMessageSchema)(val); | ||
exports.decoders[constants_1.CODEC.MANAGER] = operation_1.schemaDecoder(exports.decoders)(operation_1.ManagerOperationSchema); | ||
exports.decoders[constants_1.CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => operation_1.schemaDecoder(exports.decoders)(operation_1.SetDepositsLimitSchema)(val); | ||
//# sourceMappingURL=decoder.js.map | ||
exports.decoders[constants_1.CODEC.OPERATION] = (0, operation_1.operationDecoder)(exports.decoders); | ||
exports.decoders[constants_1.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.ActivationSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_FAILING_NOOP] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.FailingNoopSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_DELEGATION] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.DelegationSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_TRANSACTION] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.TransactionSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_ORIGINATION] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.OriginationSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_BALLOT] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.BallotSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_ATTESTATION] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.AttestationSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_ENDORSEMENT] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.EndorsementSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_SEED_NONCE_REVELATION] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.SeedNonceRevelationSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_PROPOSALS] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.ProposalsSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_REVEAL] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.RevealSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.RegisterGlobalConstantSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_TRANSFER_TICKET] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.TransferTicketSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_INCREASE_PAID_STORAGE] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.IncreasePaidStorageSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.UpdateConsensusKeySchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_DRAIN_DELEGATE] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.DrainDelegateSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.SmartRollupOriginateSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.SmartRollupAddMessagesSchema)(val); | ||
exports.decoders[constants_1.CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.SmartRollupExecuteOutboxMessageSchema)(val); | ||
exports.decoders[constants_1.CODEC.MANAGER] = (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.ManagerOperationSchema); | ||
exports.decoders[constants_1.CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => (0, operation_1.schemaDecoder)(exports.decoders)(operation_1.SetDepositsLimitSchema)(val); |
@@ -15,3 +15,4 @@ "use strict"; | ||
[constants_1.CODEC.PUBLIC_KEY]: codec_1.publicKeyEncoder, | ||
[constants_1.CODEC.PKH]: codec_1.pkhEncoder, | ||
[constants_1.CODEC.PKH]: codec_1.publicKeyHashEncoder, | ||
[constants_1.CODEC.PKH_ARR]: codec_1.publicKeyHashesEncoder, | ||
[constants_1.CODEC.DELEGATE]: codec_1.delegateEncoder, | ||
@@ -33,2 +34,3 @@ [constants_1.CODEC.SCRIPT]: codec_2.scriptEncoder, | ||
[constants_1.CODEC.BURN_LIMIT]: codec_1.burnLimitEncoder, | ||
[constants_1.CODEC.DEPOSITS_LIMIT]: codec_1.depositsLimitEncoder, | ||
[constants_1.CODEC.PVM_KIND]: codec_1.pvmKindEncoder, | ||
@@ -38,23 +40,23 @@ [constants_1.CODEC.PADDED_BYTES]: codec_1.paddedBytesEncoder, | ||
}; | ||
exports.encoders[constants_1.CODEC.OPERATION] = operation_1.operationEncoder(exports.encoders); | ||
exports.encoders[constants_1.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.ActivationSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_DELEGATION] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.DelegationSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_TRANSACTION] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.TransactionSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_ORIGINATION] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.OriginationSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_BALLOT] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.BallotSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_ATTESTATION] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.AttestationSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_ENDORSEMENT] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.EndorsementSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_SEED_NONCE_REVELATION] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.SeedNonceRevelationSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_PROPOSALS] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.ProposalsSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_REVEAL] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.RevealSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.RegisterGlobalConstantSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_TRANSFER_TICKET] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.TransferTicketSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_INCREASE_PAID_STORAGE] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.IncreasePaidStorageSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.UpdateConsensusKeySchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_DRAIN_DELEGATE] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.DrainDelegateSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.SmartRollupOriginateSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.SmartRollupAddMessagesSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.SmartRollupExecuteOutboxMessageSchema)(val); | ||
exports.encoders[constants_1.CODEC.MANAGER] = operation_1.schemaEncoder(exports.encoders)(operation_1.ManagerOperationSchema); | ||
exports.encoders[constants_1.CODEC.OP_FAILING_NOOP] = (val) => operation_1.schemaEncoder(exports.encoders)(operation_1.FailingNoopSchema)(val); | ||
//# sourceMappingURL=encoder.js.map | ||
exports.encoders[constants_1.CODEC.OPERATION] = (0, operation_1.operationEncoder)(exports.encoders); | ||
exports.encoders[constants_1.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.ActivationSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_DELEGATION] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.DelegationSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_TRANSACTION] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.TransactionSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_ORIGINATION] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.OriginationSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_BALLOT] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.BallotSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_ATTESTATION] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.AttestationSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_ENDORSEMENT] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.EndorsementSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_SEED_NONCE_REVELATION] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.SeedNonceRevelationSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_PROPOSALS] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.ProposalsSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_REVEAL] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.RevealSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.RegisterGlobalConstantSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_TRANSFER_TICKET] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.TransferTicketSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_INCREASE_PAID_STORAGE] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.IncreasePaidStorageSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_UPDATE_CONSENSUS_KEY] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.UpdateConsensusKeySchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_DRAIN_DELEGATE] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.DrainDelegateSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_SMART_ROLLUP_ORIGINATE] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.SmartRollupOriginateSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_SMART_ROLLUP_ADD_MESSAGES] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.SmartRollupAddMessagesSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.SmartRollupExecuteOutboxMessageSchema)(val); | ||
exports.encoders[constants_1.CODEC.MANAGER] = (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.ManagerOperationSchema); | ||
exports.encoders[constants_1.CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.SetDepositsLimitSchema)(val); | ||
exports.encoders[constants_1.CODEC.OP_FAILING_NOOP] = (val) => (0, operation_1.schemaEncoder)(exports.encoders)(operation_1.FailingNoopSchema)(val); |
@@ -165,2 +165,1 @@ "use strict"; | ||
exports.InvalidSmartRollupCommitmentHashError = InvalidSmartRollupCommitmentHashError; | ||
//# sourceMappingURL=errors.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=interface.js.map |
@@ -27,13 +27,13 @@ "use strict"; | ||
const scriptEncoder = (script) => { | ||
const code = exports.valueEncoder(script.code); | ||
const storage = exports.valueEncoder(script.storage); | ||
return `${utils_1.pad(code.length / 2, 8)}${code}${utils_1.pad(storage.length / 2, 8)}${storage}`; | ||
const code = (0, exports.valueEncoder)(script.code); | ||
const storage = (0, exports.valueEncoder)(script.storage); | ||
return `${(0, utils_1.pad)(code.length / 2, 8)}${code}${(0, utils_1.pad)(storage.length / 2, 8)}${storage}`; | ||
}; | ||
exports.scriptEncoder = scriptEncoder; | ||
const scriptDecoder = (value) => { | ||
const code = exports.extractRequiredLen(value); | ||
const storage = exports.extractRequiredLen(value); | ||
const code = (0, exports.extractRequiredLen)(value); | ||
const storage = (0, exports.extractRequiredLen)(value); | ||
return { | ||
code: exports.valueDecoder(new uint8array_consumer_1.Uint8ArrayConsumer(code)), | ||
storage: exports.valueDecoder(new uint8array_consumer_1.Uint8ArrayConsumer(storage)), | ||
code: (0, exports.valueDecoder)(new uint8array_consumer_1.Uint8ArrayConsumer(code)), | ||
storage: (0, exports.valueDecoder)(new uint8array_consumer_1.Uint8ArrayConsumer(storage)), | ||
}; | ||
@@ -44,17 +44,17 @@ }; | ||
if (Array.isArray(value)) { | ||
const encoded = value.map((x) => exports.valueEncoder(x)).join(''); | ||
const encoded = value.map((x) => (0, exports.valueEncoder)(x)).join(''); | ||
const len = encoded.length / 2; | ||
return `02${utils_1.pad(len)}${encoded}`; | ||
return `02${(0, utils_1.pad)(len)}${encoded}`; | ||
} | ||
else if (exports.isPrim(value)) { | ||
return exports.primEncoder(value); | ||
else if ((0, exports.isPrim)(value)) { | ||
return (0, exports.primEncoder)(value); | ||
} | ||
else if (exports.isBytes(value)) { | ||
return exports.bytesEncoder(value); | ||
else if ((0, exports.isBytes)(value)) { | ||
return (0, exports.bytesEncoder)(value); | ||
} | ||
else if (exports.isString(value)) { | ||
return exports.stringEncoder(value); | ||
else if ((0, exports.isString)(value)) { | ||
return (0, exports.stringEncoder)(value); | ||
} | ||
else if (exports.isInt(value)) { | ||
return exports.intEncoder(value); | ||
else if ((0, exports.isInt)(value)) { | ||
return (0, exports.intEncoder)(value); | ||
} | ||
@@ -68,12 +68,12 @@ throw new errors_1.UnexpectedMichelsonValueError(JSON.stringify(value)); | ||
case 0x0a: | ||
return exports.bytesDecoder(value); | ||
return (0, exports.bytesDecoder)(value); | ||
case 0x01: | ||
return exports.stringDecoder(value); | ||
return (0, exports.stringDecoder)(value); | ||
case 0x00: | ||
return exports.intDecoder(value); | ||
return (0, exports.intDecoder)(value); | ||
case 0x02: { | ||
const val = new uint8array_consumer_1.Uint8ArrayConsumer(exports.extractRequiredLen(value)); | ||
const val = new uint8array_consumer_1.Uint8ArrayConsumer((0, exports.extractRequiredLen)(value)); | ||
const results = []; | ||
while (val.length() > 0) { | ||
results.push(exports.valueDecoder(val)); | ||
results.push((0, exports.valueDecoder)(val)); | ||
} | ||
@@ -83,3 +83,3 @@ return results; | ||
default: | ||
return exports.primDecoder(value, preamble); | ||
return (0, exports.primDecoder)(value, preamble); | ||
} | ||
@@ -117,7 +117,7 @@ }; | ||
const len = value.bytes.length / 2; | ||
return `0a${utils_1.pad(len)}${value.bytes}`; | ||
return `0a${(0, utils_1.pad)(len)}${value.bytes}`; | ||
}; | ||
exports.bytesEncoder = bytesEncoder; | ||
const bytesDecoder = (value) => { | ||
const bytes = exports.extractRequiredLen(value); | ||
const bytes = (0, exports.extractRequiredLen)(value); | ||
return { | ||
@@ -131,7 +131,7 @@ bytes: Buffer.from(bytes).toString('hex'), | ||
const hexLength = str.length / 2; | ||
return `01${utils_1.pad(hexLength)}${str}`; | ||
return `01${(0, utils_1.pad)(hexLength)}${str}`; | ||
}; | ||
exports.stringEncoder = stringEncoder; | ||
const stringDecoder = (value) => { | ||
const str = exports.extractRequiredLen(value); | ||
const str = (0, exports.extractRequiredLen)(value); | ||
return { | ||
@@ -193,8 +193,8 @@ string: Buffer.from(str).toString('utf8'), | ||
// Specify the number of args max is 3 without annotation | ||
const preamble = utils_1.pad(Math.min(2 * argsCount + hasAnnot + 0x03, 9), 2); | ||
const preamble = (0, utils_1.pad)(Math.min(2 * argsCount + hasAnnot + 0x03, 9), 2); | ||
const op = constants_1.opMappingReverse[value.prim]; | ||
let encodedArgs = (value.args || []).map((arg) => exports.valueEncoder(arg)).join(''); | ||
const encodedAnnots = Array.isArray(value.annots) ? exports.encodeAnnots(value.annots) : ''; | ||
let encodedArgs = (value.args || []).map((arg) => (0, exports.valueEncoder)(arg)).join(''); | ||
const encodedAnnots = Array.isArray(value.annots) ? (0, exports.encodeAnnots)(value.annots) : ''; | ||
if ((value.prim === 'LAMBDA' || value.prim === 'LAMBDA_REC') && argsCount) { | ||
encodedArgs = utils_1.pad(encodedArgs.length / 2) + encodedArgs + utils_1.pad(0); | ||
encodedArgs = (0, utils_1.pad)(encodedArgs.length / 2) + encodedArgs + (0, utils_1.pad)(0); | ||
} | ||
@@ -204,7 +204,7 @@ if ((value.prim === 'pair' || value.prim === 'Pair') && argsCount > 2) { | ||
encodedAnnots === '' | ||
? utils_1.pad(encodedArgs.length / 2) + encodedArgs + utils_1.pad(0) | ||
: utils_1.pad(encodedArgs.length / 2) + encodedArgs; | ||
? (0, utils_1.pad)(encodedArgs.length / 2) + encodedArgs + (0, utils_1.pad)(0) | ||
: (0, utils_1.pad)(encodedArgs.length / 2) + encodedArgs; | ||
} | ||
if (value.prim === 'view' && value.args) { | ||
encodedArgs = utils_1.pad(encodedArgs.length / 2) + encodedArgs + utils_1.pad(0); | ||
encodedArgs = (0, utils_1.pad)(encodedArgs.length / 2) + encodedArgs + (0, utils_1.pad)(0); | ||
} | ||
@@ -226,3 +226,3 @@ return `${preamble}${op}${encodedArgs}${encodedAnnots}`; | ||
if (argsCount != 0) { | ||
return exports.primViewDecoder(value, result); | ||
return (0, exports.primViewDecoder)(value, result); | ||
} | ||
@@ -236,7 +236,7 @@ else { | ||
if ((constants_1.opMapping[op] === 'pair' || constants_1.opMapping[op] === 'Pair') && argsCount > 2) { | ||
combPairArgs = exports.decodeCombPair(value); | ||
combPairArgs = (0, exports.decodeCombPair)(value); | ||
argsCount = 0; | ||
combPairAnnots = exports.decodeAnnots(value); | ||
combPairAnnots = (0, exports.decodeAnnots)(value); | ||
} | ||
const args = new Array(argsCount).fill(0).map(() => exports.valueDecoder(value)); | ||
const args = new Array(argsCount).fill(0).map(() => (0, exports.valueDecoder)(value)); | ||
if (constants_1.opMapping[op] === 'LAMBDA' || constants_1.opMapping[op] === 'LAMBDA_REC') { | ||
@@ -255,3 +255,3 @@ value.consume(4); | ||
else if (hasAnnot) { | ||
result['annots'] = exports.decodeAnnots(value); | ||
result['annots'] = (0, exports.decodeAnnots)(value); | ||
} | ||
@@ -263,3 +263,3 @@ return result; | ||
value.consume(4); | ||
result['args'] = new Array(4).fill(0).map(() => exports.valueDecoder(value)); | ||
result['args'] = new Array(4).fill(0).map(() => (0, exports.valueDecoder)(value)); | ||
value.consume(4); | ||
@@ -270,6 +270,6 @@ return result; | ||
const decodeCombPair = (val) => { | ||
const array = new uint8array_consumer_1.Uint8ArrayConsumer(exports.extractRequiredLen(val)); | ||
const array = new uint8array_consumer_1.Uint8ArrayConsumer((0, exports.extractRequiredLen)(val)); | ||
const args = []; | ||
while (array.length() > 0) { | ||
args.push(exports.valueDecoder(array)); | ||
args.push((0, exports.valueDecoder)(array)); | ||
} | ||
@@ -286,3 +286,3 @@ return args; | ||
const len = mergedAnnot.length / 2; | ||
return `${utils_1.pad(len)}${mergedAnnot}`; | ||
return `${(0, utils_1.pad)(len)}${mergedAnnot}`; | ||
}; | ||
@@ -298,2 +298,1 @@ exports.encodeAnnots = encodeAnnots; | ||
exports.decodeAnnots = decodeAnnots; | ||
//# sourceMappingURL=codec.js.map |
@@ -22,5 +22,5 @@ "use strict"; | ||
ProtocolsHash["PtNairobi"] = "PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf"; | ||
ProtocolsHash["ProxfordS"] = "ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8"; | ||
ProtocolsHash["ProxfordY"] = "ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH"; | ||
ProtocolsHash["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"; | ||
})(ProtocolsHash = exports.ProtocolsHash || (exports.ProtocolsHash = {})); | ||
})(ProtocolsHash || (exports.ProtocolsHash = ProtocolsHash = {})); | ||
const protoLevel = { | ||
@@ -43,4 +43,4 @@ Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd: 4, | ||
PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf: 17, | ||
ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8: 18, | ||
ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 19, | ||
ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH: 19, | ||
ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK: 20, | ||
}; | ||
@@ -51,2 +51,1 @@ function ProtoInferiorTo(a, b) { | ||
exports.ProtoInferiorTo = ProtoInferiorTo; | ||
//# sourceMappingURL=protocols.js.map |
@@ -138,2 +138,3 @@ "use strict"; | ||
parameters_ty: constants_1.CODEC.VALUE, | ||
whitelist: constants_1.CODEC.PKH_ARR, | ||
}; | ||
@@ -191,3 +192,3 @@ exports.SmartRollupAddMessagesSchema = { | ||
} | ||
return prev + values.reduce((prevBytes, current) => prevBytes + encoder(current), ''); | ||
return (prev + values.reduce((prevBytes, current) => prevBytes + encoder(current), '')); | ||
} | ||
@@ -230,2 +231,1 @@ else { | ||
exports.schemaDecoder = schemaDecoder; | ||
//# sourceMappingURL=operation.js.map |
@@ -8,3 +8,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -40,3 +44,3 @@ if (k2 === undefined) k2 = k; | ||
Object.defineProperty(exports, "ProtocolsHash", { enumerable: true, get: function () { return protocols_2.ProtocolsHash; } }); | ||
const PROTOCOL_CURRENT = protocols_1.ProtocolsHash.ProxfordS; | ||
const PROTOCOL_CURRENT = protocols_1.ProtocolsHash.ProxfordY; | ||
function getCodec(codec, _proto) { | ||
@@ -52,2 +56,3 @@ return { | ||
exports.getCodec = getCodec; | ||
// | ||
class LocalForger { | ||
@@ -59,11 +64,11 @@ constructor(protocolHash = PROTOCOL_CURRENT) { | ||
forge(params) { | ||
const branchValidation = utils_1.validateBlock(params.branch); | ||
const branchValidation = (0, utils_1.validateBlock)(params.branch); | ||
if (branchValidation !== utils_1.ValidationResult.VALID) { | ||
throw new core_1.InvalidBlockHashError(params.branch, utils_1.invalidDetail(branchValidation)); | ||
throw new core_1.InvalidBlockHashError(params.branch, (0, utils_1.invalidDetail)(branchValidation)); | ||
} | ||
for (const content of params.contents) { | ||
if (!validator_1.validateOperationKind(content.kind)) { | ||
if (!(0, validator_1.validateOperationKind)(content.kind)) { | ||
throw new core_1.InvalidOperationKindError(content.kind); | ||
} | ||
const diff = validator_1.validateMissingProperty(content); | ||
const diff = (0, validator_1.validateMissingProperty)(content); | ||
if (diff.length === 1) { | ||
@@ -79,2 +84,8 @@ if (content.kind === 'delegation' && diff[0] === 'delegate') { | ||
} | ||
else if (content.kind === 'set_deposits_limit' && diff[0] === 'limit') { | ||
continue; | ||
} | ||
else if (content.kind === 'smart_rollup_originate' && diff[0] === 'whitelist') { | ||
continue; | ||
} | ||
else { | ||
@@ -97,2 +108,1 @@ throw new errors_1.InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`); | ||
exports.localForger = new LocalForger(); | ||
//# sourceMappingURL=taquito-local-forging.js.map |
@@ -6,6 +6,2 @@ "use strict"; | ||
class Uint8ArrayConsumer { | ||
constructor(arr, offset = 0) { | ||
this.arr = arr; | ||
this.offset = offset; | ||
} | ||
static fromHexString(hex) { | ||
@@ -21,2 +17,6 @@ const lowHex = hex.toLowerCase(); | ||
} | ||
constructor(arr, offset = 0) { | ||
this.arr = arr; | ||
this.offset = offset; | ||
} | ||
consume(count) { | ||
@@ -38,2 +38,1 @@ const subArr = this.arr.subarray(this.offset, this.offset + count); | ||
exports.Uint8ArrayConsumer = Uint8ArrayConsumer; | ||
//# sourceMappingURL=uint8array-consumer.js.map |
@@ -19,2 +19,1 @@ "use strict"; | ||
exports.pad = pad; | ||
//# sourceMappingURL=utils.js.map |
@@ -56,2 +56,1 @@ "use strict"; | ||
exports.validateMissingProperty = validateMissingProperty; | ||
//# sourceMappingURL=validator.js.map |
@@ -6,5 +6,4 @@ "use strict"; | ||
exports.VERSION = { | ||
"commitHash": "21f25a09b87809102b0214544d2c5396eeb5872e", | ||
"version": "18.0.0-RC.0" | ||
"commitHash": "bd52c12d05e329e4cf3a81fe55c4778a47879ccd", | ||
"version": "19.0.0-beta-RC.0" | ||
}; | ||
//# sourceMappingURL=version.js.map |
@@ -25,2 +25,3 @@ import { Prefix, buf2hex, b58cdecode, prefix, prefixLength, b58cencode, InvalidKeyHashError, invalidDetail, ValidationResult, InvalidPublicKeyError, validateBlock } from '@taquito/utils'; | ||
CODEC["PKH"] = "pkh"; | ||
CODEC["PKH_ARR"] = "pkhArr"; | ||
CODEC["DELEGATE"] = "delegate"; | ||
@@ -432,6 +433,2 @@ CODEC["SCRIPT"] = "script"; | ||
class Uint8ArrayConsumer { | ||
constructor(arr, offset = 0) { | ||
this.arr = arr; | ||
this.offset = offset; | ||
} | ||
static fromHexString(hex) { | ||
@@ -447,2 +444,6 @@ const lowHex = hex.toLowerCase(); | ||
} | ||
constructor(arr, offset = 0) { | ||
this.arr = arr; | ||
this.offset = offset; | ||
} | ||
consume(count) { | ||
@@ -727,3 +728,3 @@ const subArr = this.arr.subarray(this.offset, this.offset + count); | ||
const branchDecoder = prefixDecoder(Prefix.B); | ||
const pkhDecoder = (val) => { | ||
const publicKeyHashDecoder = (val) => { | ||
const prefix = val.consume(1); | ||
@@ -740,2 +741,13 @@ if (prefix[0] === 0x00) { | ||
}; | ||
const publicKeyHashesDecoder = (val) => { | ||
if (!boolDecoder(val)) { | ||
return undefined; | ||
} | ||
const publicKeyHashes = []; | ||
val.consume(4); | ||
while (val.length() > 0) { | ||
publicKeyHashes.push(publicKeyHashDecoder(val)); | ||
} | ||
return publicKeyHashes; | ||
}; | ||
const branchEncoder = prefixEncoder(Prefix.B); | ||
@@ -792,2 +804,4 @@ const tz1Encoder = prefixEncoder(Prefix.TZ1); | ||
return '01'; | ||
case 'riscv': | ||
return '02'; | ||
default: | ||
@@ -804,2 +818,4 @@ throw new UnsupportedPvmKindError(pvm); | ||
return 'wasm_2_0_0'; | ||
case 0x02: | ||
return 'riscv'; | ||
default: | ||
@@ -811,3 +827,3 @@ throw new DecodePvmKindError(value[0].toString()); | ||
if (val) { | ||
return boolEncoder(true) + pkhEncoder(val); | ||
return boolEncoder(true) + publicKeyHashEncoder(val); | ||
} | ||
@@ -859,6 +875,6 @@ else { | ||
if (hasDelegate) { | ||
return pkhDecoder(val); | ||
return publicKeyHashDecoder(val); | ||
} | ||
}; | ||
const pkhEncoder = (val) => { | ||
const publicKeyHashEncoder = (val) => { | ||
const pubkeyPrefix = val.substring(0, 3); | ||
@@ -879,2 +895,14 @@ switch (pubkeyPrefix) { | ||
}; | ||
const publicKeyHashesEncoder = (val) => { | ||
if (!val) { | ||
return boolEncoder(false); | ||
} | ||
if (val.length === 0) { | ||
return boolEncoder(true) + pad(0); | ||
} | ||
const publicKeyHashes = val.reduce((prev, curr) => { | ||
return prev + publicKeyHashEncoder(curr); | ||
}, ''); | ||
return boolEncoder(true) + pad(publicKeyHashes.length / 2) + publicKeyHashes; | ||
}; | ||
const publicKeyEncoder = (val) => { | ||
@@ -901,3 +929,3 @@ const pubkeyPrefix = val.substring(0, 4); | ||
case Prefix.TZ4: | ||
return '00' + pkhEncoder(val); | ||
return '00' + publicKeyHashEncoder(val); | ||
case Prefix.KT1: | ||
@@ -947,3 +975,3 @@ return '01' + prefixEncoder(Prefix.KT1)(val) + '00'; | ||
case 0x00: | ||
return pkhDecoder(val); | ||
return publicKeyHashDecoder(val); | ||
case 0x01: { | ||
@@ -1096,2 +1124,5 @@ const address = prefixDecoder(Prefix.KT1)(val); | ||
}; | ||
const depositsLimitEncoder = (val) => { | ||
return !val ? '00' : `ff${zarithEncoder(val)}`; | ||
}; | ||
const depositsLimitDecoder = (value) => { | ||
@@ -1253,2 +1284,3 @@ const prefix = value.consume(1); | ||
parameters_ty: CODEC.VALUE, | ||
whitelist: CODEC.PKH_ARR, | ||
}; | ||
@@ -1304,3 +1336,3 @@ const SmartRollupAddMessagesSchema = { | ||
} | ||
return prev + values.reduce((prevBytes, current) => prevBytes + encoder(current), ''); | ||
return (prev + values.reduce((prevBytes, current) => prevBytes + encoder(current), '')); | ||
} | ||
@@ -1349,3 +1381,4 @@ else { | ||
[CODEC.PUBLIC_KEY]: publicKeyDecoder, | ||
[CODEC.PKH]: pkhDecoder, | ||
[CODEC.PKH]: publicKeyHashDecoder, | ||
[CODEC.PKH_ARR]: publicKeyHashesDecoder, | ||
[CODEC.DELEGATE]: delegateDecoder, | ||
@@ -1402,3 +1435,4 @@ [CODEC.INT32]: int32Decoder, | ||
[CODEC.PUBLIC_KEY]: publicKeyEncoder, | ||
[CODEC.PKH]: pkhEncoder, | ||
[CODEC.PKH]: publicKeyHashEncoder, | ||
[CODEC.PKH_ARR]: publicKeyHashesEncoder, | ||
[CODEC.DELEGATE]: delegateEncoder, | ||
@@ -1420,2 +1454,3 @@ [CODEC.SCRIPT]: scriptEncoder, | ||
[CODEC.BURN_LIMIT]: burnLimitEncoder, | ||
[CODEC.DEPOSITS_LIMIT]: depositsLimitEncoder, | ||
[CODEC.PVM_KIND]: pvmKindEncoder, | ||
@@ -1445,2 +1480,3 @@ [CODEC.PADDED_BYTES]: paddedBytesEncoder, | ||
encoders[CODEC.MANAGER] = schemaEncoder(encoders)(ManagerOperationSchema); | ||
encoders[CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder(encoders)(SetDepositsLimitSchema)(val); | ||
encoders[CODEC.OP_FAILING_NOOP] = (val) => schemaEncoder(encoders)(FailingNoopSchema)(val); | ||
@@ -1516,3 +1552,3 @@ | ||
ProtocolsHash["PtNairobi"] = "PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf"; | ||
ProtocolsHash["ProxfordS"] = "ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8"; | ||
ProtocolsHash["ProxfordY"] = "ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH"; | ||
ProtocolsHash["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"; | ||
@@ -1523,4 +1559,4 @@ })(ProtocolsHash || (ProtocolsHash = {})); | ||
const VERSION = { | ||
"commitHash": "21f25a09b87809102b0214544d2c5396eeb5872e", | ||
"version": "18.0.0-RC.0" | ||
"commitHash": "bd52c12d05e329e4cf3a81fe55c4778a47879ccd", | ||
"version": "19.0.0-beta-RC.0" | ||
}; | ||
@@ -1532,3 +1568,3 @@ | ||
*/ | ||
const PROTOCOL_CURRENT = ProtocolsHash.ProxfordS; | ||
const PROTOCOL_CURRENT = ProtocolsHash.ProxfordY; | ||
function getCodec(codec, _proto) { | ||
@@ -1543,2 +1579,3 @@ return { | ||
} | ||
// | ||
class LocalForger { | ||
@@ -1569,2 +1606,8 @@ constructor(protocolHash = PROTOCOL_CURRENT) { | ||
} | ||
else if (content.kind === 'set_deposits_limit' && diff[0] === 'limit') { | ||
continue; | ||
} | ||
else if (content.kind === 'smart_rollup_originate' && diff[0] === 'whitelist') { | ||
continue; | ||
} | ||
else { | ||
@@ -1571,0 +1614,0 @@ throw new InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`); |
@@ -7,6 +7,2 @@ (function (global, factory) { | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var BigNumber__default = /*#__PURE__*/_interopDefaultLegacy(BigNumber); | ||
const toHexString = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), ''); | ||
@@ -32,2 +28,3 @@ const pad = (num, paddingLen = 8) => { | ||
CODEC["PKH"] = "pkh"; | ||
CODEC["PKH_ARR"] = "pkhArr"; | ||
CODEC["DELEGATE"] = "delegate"; | ||
@@ -439,6 +436,2 @@ CODEC["SCRIPT"] = "script"; | ||
class Uint8ArrayConsumer { | ||
constructor(arr, offset = 0) { | ||
this.arr = arr; | ||
this.offset = offset; | ||
} | ||
static fromHexString(hex) { | ||
@@ -454,2 +447,6 @@ const lowHex = hex.toLowerCase(); | ||
} | ||
constructor(arr, offset = 0) { | ||
this.arr = arr; | ||
this.offset = offset; | ||
} | ||
consume(count) { | ||
@@ -734,3 +731,3 @@ const subArr = this.arr.subarray(this.offset, this.offset + count); | ||
const branchDecoder = prefixDecoder(utils.Prefix.B); | ||
const pkhDecoder = (val) => { | ||
const publicKeyHashDecoder = (val) => { | ||
const prefix = val.consume(1); | ||
@@ -747,2 +744,13 @@ if (prefix[0] === 0x00) { | ||
}; | ||
const publicKeyHashesDecoder = (val) => { | ||
if (!boolDecoder(val)) { | ||
return undefined; | ||
} | ||
const publicKeyHashes = []; | ||
val.consume(4); | ||
while (val.length() > 0) { | ||
publicKeyHashes.push(publicKeyHashDecoder(val)); | ||
} | ||
return publicKeyHashes; | ||
}; | ||
const branchEncoder = prefixEncoder(utils.Prefix.B); | ||
@@ -799,2 +807,4 @@ const tz1Encoder = prefixEncoder(utils.Prefix.TZ1); | ||
return '01'; | ||
case 'riscv': | ||
return '02'; | ||
default: | ||
@@ -811,2 +821,4 @@ throw new UnsupportedPvmKindError(pvm); | ||
return 'wasm_2_0_0'; | ||
case 0x02: | ||
return 'riscv'; | ||
default: | ||
@@ -818,3 +830,3 @@ throw new DecodePvmKindError(value[0].toString()); | ||
if (val) { | ||
return boolEncoder(true) + pkhEncoder(val); | ||
return boolEncoder(true) + publicKeyHashEncoder(val); | ||
} | ||
@@ -866,6 +878,6 @@ else { | ||
if (hasDelegate) { | ||
return pkhDecoder(val); | ||
return publicKeyHashDecoder(val); | ||
} | ||
}; | ||
const pkhEncoder = (val) => { | ||
const publicKeyHashEncoder = (val) => { | ||
const pubkeyPrefix = val.substring(0, 3); | ||
@@ -886,2 +898,14 @@ switch (pubkeyPrefix) { | ||
}; | ||
const publicKeyHashesEncoder = (val) => { | ||
if (!val) { | ||
return boolEncoder(false); | ||
} | ||
if (val.length === 0) { | ||
return boolEncoder(true) + pad(0); | ||
} | ||
const publicKeyHashes = val.reduce((prev, curr) => { | ||
return prev + publicKeyHashEncoder(curr); | ||
}, ''); | ||
return boolEncoder(true) + pad(publicKeyHashes.length / 2) + publicKeyHashes; | ||
}; | ||
const publicKeyEncoder = (val) => { | ||
@@ -908,3 +932,3 @@ const pubkeyPrefix = val.substring(0, 4); | ||
case utils.Prefix.TZ4: | ||
return '00' + pkhEncoder(val); | ||
return '00' + publicKeyHashEncoder(val); | ||
case utils.Prefix.KT1: | ||
@@ -954,3 +978,3 @@ return '01' + prefixEncoder(utils.Prefix.KT1)(val) + '00'; | ||
case 0x00: | ||
return pkhDecoder(val); | ||
return publicKeyHashDecoder(val); | ||
case 0x01: { | ||
@@ -990,3 +1014,3 @@ const address = prefixDecoder(utils.Prefix.KT1)(val); | ||
const fn = []; | ||
let nn = new BigNumber__default["default"](n, 10); | ||
let nn = new BigNumber(n, 10); | ||
if (nn.isNaN()) { | ||
@@ -1018,3 +1042,3 @@ throw new TypeError(`Invalid zarith number ${n}`); | ||
} | ||
let num = new BigNumber__default["default"](0); | ||
let num = new BigNumber(0); | ||
for (let i = mostSignificantByte; i >= 0; i -= 1) { | ||
@@ -1026,3 +1050,3 @@ const tmp = n.get(i) & 0x7f; | ||
n.consume(mostSignificantByte + 1); | ||
return new BigNumber__default["default"](num).toString(); | ||
return new BigNumber(num).toString(); | ||
}; | ||
@@ -1106,2 +1130,5 @@ const entrypointDecoder = (value) => { | ||
}; | ||
const depositsLimitEncoder = (val) => { | ||
return !val ? '00' : `ff${zarithEncoder(val)}`; | ||
}; | ||
const depositsLimitDecoder = (value) => { | ||
@@ -1263,2 +1290,3 @@ const prefix = value.consume(1); | ||
parameters_ty: exports.CODEC.VALUE, | ||
whitelist: exports.CODEC.PKH_ARR, | ||
}; | ||
@@ -1314,3 +1342,3 @@ const SmartRollupAddMessagesSchema = { | ||
} | ||
return prev + values.reduce((prevBytes, current) => prevBytes + encoder(current), ''); | ||
return (prev + values.reduce((prevBytes, current) => prevBytes + encoder(current), '')); | ||
} | ||
@@ -1359,3 +1387,4 @@ else { | ||
[exports.CODEC.PUBLIC_KEY]: publicKeyDecoder, | ||
[exports.CODEC.PKH]: pkhDecoder, | ||
[exports.CODEC.PKH]: publicKeyHashDecoder, | ||
[exports.CODEC.PKH_ARR]: publicKeyHashesDecoder, | ||
[exports.CODEC.DELEGATE]: delegateDecoder, | ||
@@ -1412,3 +1441,4 @@ [exports.CODEC.INT32]: int32Decoder, | ||
[exports.CODEC.PUBLIC_KEY]: publicKeyEncoder, | ||
[exports.CODEC.PKH]: pkhEncoder, | ||
[exports.CODEC.PKH]: publicKeyHashEncoder, | ||
[exports.CODEC.PKH_ARR]: publicKeyHashesEncoder, | ||
[exports.CODEC.DELEGATE]: delegateEncoder, | ||
@@ -1430,2 +1460,3 @@ [exports.CODEC.SCRIPT]: scriptEncoder, | ||
[exports.CODEC.BURN_LIMIT]: burnLimitEncoder, | ||
[exports.CODEC.DEPOSITS_LIMIT]: depositsLimitEncoder, | ||
[exports.CODEC.PVM_KIND]: pvmKindEncoder, | ||
@@ -1455,2 +1486,3 @@ [exports.CODEC.PADDED_BYTES]: paddedBytesEncoder, | ||
encoders[exports.CODEC.MANAGER] = schemaEncoder(encoders)(ManagerOperationSchema); | ||
encoders[exports.CODEC.OP_SET_DEPOSITS_LIMIT] = (val) => schemaEncoder(encoders)(SetDepositsLimitSchema)(val); | ||
encoders[exports.CODEC.OP_FAILING_NOOP] = (val) => schemaEncoder(encoders)(FailingNoopSchema)(val); | ||
@@ -1526,3 +1558,3 @@ | ||
ProtocolsHash["PtNairobi"] = "PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf"; | ||
ProtocolsHash["ProxfordS"] = "ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8"; | ||
ProtocolsHash["ProxfordY"] = "ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH"; | ||
ProtocolsHash["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"; | ||
@@ -1533,4 +1565,4 @@ })(exports.ProtocolsHash || (exports.ProtocolsHash = {})); | ||
const VERSION = { | ||
"commitHash": "21f25a09b87809102b0214544d2c5396eeb5872e", | ||
"version": "18.0.0-RC.0" | ||
"commitHash": "bd52c12d05e329e4cf3a81fe55c4778a47879ccd", | ||
"version": "19.0.0-beta-RC.0" | ||
}; | ||
@@ -1542,3 +1574,3 @@ | ||
*/ | ||
const PROTOCOL_CURRENT = exports.ProtocolsHash.ProxfordS; | ||
const PROTOCOL_CURRENT = exports.ProtocolsHash.ProxfordY; | ||
function getCodec(codec, _proto) { | ||
@@ -1553,2 +1585,3 @@ return { | ||
} | ||
// | ||
class LocalForger { | ||
@@ -1579,2 +1612,8 @@ constructor(protocolHash = PROTOCOL_CURRENT) { | ||
} | ||
else if (content.kind === 'set_deposits_limit' && diff[0] === 'limit') { | ||
continue; | ||
} | ||
else if (content.kind === 'smart_rollup_originate' && diff[0] === 'whitelist') { | ||
continue; | ||
} | ||
else { | ||
@@ -1607,5 +1646,3 @@ throw new InvalidOperationSchemaError(content, `missing properties "${diff.join(', ')}"`); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); | ||
//# sourceMappingURL=taquito-local-forging.umd.js.map |
@@ -8,3 +8,4 @@ import { Prefix } from '@taquito/utils'; | ||
export declare const branchDecoder: (str: Uint8ArrayConsumer) => string; | ||
export declare const pkhDecoder: (val: Uint8ArrayConsumer) => string | undefined; | ||
export declare const publicKeyHashDecoder: (val: Uint8ArrayConsumer) => string | undefined; | ||
export declare const publicKeyHashesDecoder: (val: Uint8ArrayConsumer) => (string | undefined)[] | undefined; | ||
export declare const branchEncoder: (str: string) => string; | ||
@@ -28,3 +29,4 @@ export declare const tz1Encoder: (str: string) => string; | ||
export declare const delegateDecoder: (val: Uint8ArrayConsumer) => string | undefined; | ||
export declare const pkhEncoder: (val: string) => string; | ||
export declare const publicKeyHashEncoder: (val: string) => string; | ||
export declare const publicKeyHashesEncoder: (val?: string[]) => string; | ||
export declare const publicKeyEncoder: (val: string) => string; | ||
@@ -60,2 +62,3 @@ export declare const addressEncoder: (val: string) => string; | ||
export declare const burnLimitDecoder: (value: Uint8ArrayConsumer) => string | undefined; | ||
export declare const depositsLimitEncoder: (val: string) => string; | ||
export declare const depositsLimitDecoder: (value: Uint8ArrayConsumer) => string | undefined; | ||
@@ -62,0 +65,0 @@ export declare const paddedBytesEncoder: (val: string, paddingLength?: number) => string; |
@@ -10,2 +10,3 @@ export declare const ENTRYPOINT_MAX_LENGTH = 31; | ||
PKH = "pkh", | ||
PKH_ARR = "pkhArr", | ||
DELEGATE = "delegate", | ||
@@ -12,0 +13,0 @@ SCRIPT = "script", |
import { Uint8ArrayConsumer } from './uint8array-consumer'; | ||
export declare type Decoder = (val: Uint8ArrayConsumer) => string | number | object | undefined; | ||
export type Decoder = (val: Uint8ArrayConsumer) => string | number | object | undefined; | ||
export declare const decoders: { | ||
[key: string]: Decoder; | ||
}; |
@@ -1,4 +0,4 @@ | ||
export declare type Encoder<T> = (val: T) => string; | ||
export type Encoder<T> = (val: T) => string; | ||
export declare const encoders: { | ||
[key: string]: Encoder<any>; | ||
}; |
@@ -0,0 +0,0 @@ import { ParameterValidationError } from '@taquito/core'; |
@@ -6,5 +6,5 @@ import { OperationContents } from '@taquito/rpc'; | ||
} | ||
export declare type ForgeResponse = string; | ||
export type ForgeResponse = string; | ||
export interface Forger { | ||
forge(params: ForgeParams): Promise<ForgeResponse>; | ||
} |
import { Decoder } from '../decoder'; | ||
import { Uint8ArrayConsumer } from '../uint8array-consumer'; | ||
import { Encoder } from '../taquito-local-forging'; | ||
export declare type PrimValue = { | ||
export type PrimValue = { | ||
prim: string; | ||
@@ -9,12 +9,12 @@ args?: MichelsonValue[]; | ||
}; | ||
export declare type BytesValue = { | ||
export type BytesValue = { | ||
bytes: string; | ||
}; | ||
export declare type StringValue = { | ||
export type StringValue = { | ||
string: string; | ||
}; | ||
export declare type IntValue = { | ||
export type IntValue = { | ||
int: string; | ||
}; | ||
export declare type MichelsonValue = PrimValue | BytesValue | StringValue | IntValue | (PrimValue | BytesValue | StringValue | IntValue)[]; | ||
export type MichelsonValue = PrimValue | BytesValue | StringValue | IntValue | (PrimValue | BytesValue | StringValue | IntValue)[]; | ||
export declare const isPrim: (value: MichelsonValue) => value is PrimValue; | ||
@@ -21,0 +21,0 @@ export declare const isBytes: (value: MichelsonValue) => value is BytesValue; |
@@ -18,5 +18,5 @@ export declare enum ProtocolsHash { | ||
PtNairobi = "PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf", | ||
ProxfordS = "ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8", | ||
ProxfordY = "ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH", | ||
ProtoALpha = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK" | ||
} | ||
export declare function ProtoInferiorTo(a: ProtocolsHash, b: ProtocolsHash): boolean; |
@@ -135,2 +135,3 @@ import { Decoder } from '../decoder'; | ||
parameters_ty: CODEC; | ||
whitelist: CODEC; | ||
}; | ||
@@ -168,4 +169,4 @@ export declare const SmartRollupAddMessagesSchema: { | ||
}; | ||
declare type Schema = Record<string, CODEC | CODEC[]>; | ||
export declare type Value = Record<keyof Schema, unknown[]>; | ||
type Schema = Record<string, CODEC | CODEC[]>; | ||
export type Value = Record<keyof Schema, unknown[]>; | ||
export declare const schemaEncoder: (encoders: { | ||
@@ -172,0 +173,0 @@ [key: string]: (val: object) => string; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ export declare class Uint8ArrayConsumer { |
export declare const concat: (...arr: Uint8Array[]) => Uint8Array; | ||
export declare const toHexString: (bytes: Uint8Array) => string; | ||
export declare const pad: (num: number, paddingLen?: number) => string; |
@@ -0,0 +0,0 @@ import { OpKind } from '@taquito/rpc'; |
@@ -0,0 +0,0 @@ export declare const VERSION: { |
{ | ||
"name": "@taquito/local-forging", | ||
"version": "18.0.0-RC.0", | ||
"version": "19.0.0-beta-RC.0", | ||
"description": "Provide local forging functionality to be with taquito", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=16" | ||
"node": ">=18" | ||
}, | ||
@@ -38,4 +38,4 @@ "scripts": { | ||
"version-stamp": "node ../taquito/version-stamping.js", | ||
"build": "tsc --project ./tsconfig.prod.json --module commonjs && rollup -c rollup.config.ts", | ||
"start": "rollup -c rollup.config.ts -w", | ||
"build": "tsc --project ./tsconfig.prod.json --module commonjs && rollup -c rollup.config.ts --bundleConfigAsCjs", | ||
"start": "rollup -c rollup.config.ts --bundleConfigAsCjs -w", | ||
"build-webpack": "webpack --progress --color" | ||
@@ -46,4 +46,3 @@ }, | ||
"prettier --write", | ||
"eslint --fix", | ||
"git add" | ||
"eslint --fix" | ||
] | ||
@@ -74,41 +73,40 @@ }, | ||
"dependencies": { | ||
"@taquito/core": "^18.0.0-RC.0", | ||
"@taquito/utils": "^18.0.0-RC.0", | ||
"bignumber.js": "^9.1.0" | ||
"@taquito/core": "^19.0.0-beta-RC.0", | ||
"@taquito/utils": "^19.0.0-beta-RC.0", | ||
"bignumber.js": "^9.1.2" | ||
}, | ||
"devDependencies": { | ||
"@taquito/rpc": "^18.0.0-RC.0", | ||
"@types/bluebird": "^3.5.36", | ||
"@types/estree": "^1.0.0", | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^16", | ||
"@typescript-eslint/eslint-plugin": "^5.28.0", | ||
"@typescript-eslint/parser": "^5.28.0", | ||
"@taquito/rpc": "^19.0.0-beta-RC.0", | ||
"@types/bluebird": "^3.5.40", | ||
"@types/estree": "^1.0.2", | ||
"@types/jest": "^29.5.5", | ||
"@types/node": "^20", | ||
"@typescript-eslint/eslint-plugin": "^6.8.0", | ||
"@typescript-eslint/parser": "^6.8.0", | ||
"colors": "^1.4.0", | ||
"coveralls": "^3.1.1", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.17.0", | ||
"jest": "^26.6.3", | ||
"jest-config": "^26.6.3", | ||
"lint-staged": "^13.0.1", | ||
"eslint": "^8.51.0", | ||
"jest": "^29.7.0", | ||
"jest-config": "^29.7.0", | ||
"lint-staged": "^14.0.1", | ||
"lodash.camelcase": "^4.3.0", | ||
"prettier": "^2.7.0", | ||
"prettier": "^3.0.3", | ||
"prompt": "^1.3.0", | ||
"replace-in-file": "^6.3.5", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.75.6", | ||
"replace-in-file": "^7.0.1", | ||
"rimraf": "^5.0.5", | ||
"rollup": "^4.1.4", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
"rollup-plugin-typescript2": "^0.32.1", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"shelljs": "^0.8.5", | ||
"stream-browserify": "^3.0.0", | ||
"ts-jest": "^26.4.4", | ||
"ts-loader": "^9.3.1", | ||
"ts-node": "^10.4.0", | ||
"ts-jest": "^29.1.1", | ||
"ts-loader": "^9.5.0", | ||
"ts-node": "^10.9.1", | ||
"ts-toolbelt": "^9.6.0", | ||
"typescript": "~4.1.5", | ||
"webpack": "^5.74.0", | ||
"webpack-cli": "^4.10.0" | ||
"typescript": "~5.2.2", | ||
"webpack": "^5.89.0", | ||
"webpack-cli": "^5.1.4" | ||
}, | ||
"gitHead": "998e588c7c72f45bb8d95bed54152b618aa18ec3" | ||
"gitHead": "959e385ba06d8932866503bb538252a3912acbc9" | ||
} |
@@ -202,3 +202,3 @@ { | ||
"engines": { | ||
"node": ">=16" | ||
"node": ">=18" | ||
}, | ||
@@ -218,4 +218,3 @@ "scripts": { | ||
"prettier --write", | ||
"tslint --fix", | ||
"git add" | ||
"tslint --fix" | ||
] | ||
@@ -252,3 +251,3 @@ }, | ||
"@types/jest": "^26.0.16", | ||
"@types/node": "^16", | ||
"@types/node": "^18", | ||
"colors": "^1.4.0", | ||
@@ -267,3 +266,2 @@ "coveralls": "^3.1.0", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
"rollup-plugin-typescript2": "^0.27.3", | ||
@@ -270,0 +268,0 @@ "shelljs": "^0.8.4", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31
5869
251775
36
+ Added@noble/hashes@1.5.0(transitive)
+ Added@taquito/core@19.2.1(transitive)
+ Added@taquito/utils@19.2.1(transitive)
+ Addedbase-x@4.0.0(transitive)
+ Addedbs58@5.0.0(transitive)
+ Addedbs58check@3.0.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
- Removed@taquito/core@18.0.0-RC.0(transitive)
- Removed@taquito/utils@18.0.0-RC.0(transitive)
- Removedbase-x@3.0.10(transitive)
- Removedbs58@4.0.1(transitive)
- Removedbs58check@2.1.2(transitive)
- Removedcipher-base@1.0.4(transitive)
- Removedcreate-hash@1.2.0(transitive)
- Removedhash-base@3.1.0(transitive)
- Removedmd5.js@1.3.5(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedripemd160@2.0.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsha.js@2.4.11(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updatedbignumber.js@^9.1.2