@taquito/local-forging
Advanced tools
Comparing version 12.1.1 to 13.0.0-beta-RC.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.valueParameterDecoder = exports.valueParameterEncoder = exports.parametersEncoder = exports.entrypointEncoder = exports.parametersDecoder = exports.entrypointDecoder = exports.zarithDecoder = exports.zarithEncoder = exports.addressDecoder = exports.publicKeyDecoder = exports.addressEncoder = exports.publicKeyEncoder = exports.pkhEncoder = exports.delegateDecoder = exports.boolDecoder = exports.int16Decoder = exports.int16Encoder = exports.int32Decoder = exports.int32Encoder = exports.delegateEncoder = 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.blockPayloadHashDecoder = exports.blockPayloadHashEncoder = exports.valueParameterDecoder = exports.valueParameterEncoder = exports.parametersEncoder = exports.entrypointEncoder = exports.parametersDecoder = exports.entrypointDecoder = exports.zarithDecoder = exports.zarithEncoder = exports.addressDecoder = exports.publicKeyDecoder = exports.addressEncoder = exports.publicKeyEncoder = exports.pkhEncoder = exports.delegateDecoder = exports.boolDecoder = exports.int16Decoder = exports.int16Encoder = exports.int32Decoder = exports.int32Encoder = exports.delegateEncoder = 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; | ||
const utils_1 = require("@taquito/utils"); | ||
@@ -321,2 +321,4 @@ const error_1 = require("./error"); | ||
exports.valueParameterDecoder = valueParameterDecoder; | ||
exports.blockPayloadHashEncoder = exports.prefixEncoder(utils_1.Prefix.VH); | ||
exports.blockPayloadHashDecoder = exports.prefixDecoder(utils_1.Prefix.VH); | ||
//# sourceMappingURL=codec.js.map |
@@ -29,2 +29,6 @@ "use strict"; | ||
CODEC["ADDRESS"] = "address"; | ||
CODEC["VALUE"] = "value"; | ||
CODEC["MANAGER"] = "manager"; | ||
CODEC["BLOCK_PAYLOAD_HASH"] = "blockPayloadHash"; | ||
CODEC["ENTRYPOINT"] = "entrypoint"; | ||
CODEC["OPERATION"] = "operation"; | ||
@@ -41,5 +45,9 @@ CODEC["OP_ACTIVATE_ACCOUNT"] = "activate_account"; | ||
CODEC["OP_REGISTER_GLOBAL_CONSTANT"] = "register_global_constant"; | ||
CODEC["VALUE"] = "value"; | ||
CODEC["MANAGER"] = "manager"; | ||
CODEC["BLOCK_PAYLOAD_HASH"] = "blockPayloadHash"; | ||
CODEC["OP_TRANSFER_TICKET"] = "transfer_ticket"; | ||
CODEC["OP_TX_ROLLUP_ORIGINATION"] = "tx_rollup_origination"; | ||
CODEC["OP_TX_ROLLUP_SUBMIT_BATCH"] = "tx_rollup_submit_batch"; | ||
CODEC["BURN_LIMIT"] = "burn_limit"; | ||
CODEC["TX_ROLLUP_ORIGINATION_PARAM"] = "tx_rollup_origination_param"; | ||
CODEC["TX_ROLLUP_ID"] = "tx_rollup_id"; | ||
CODEC["TX_ROLLUP_BATCH_CONTENT"] = "tx_rollup_batch_content"; | ||
})(CODEC = exports.CODEC || (exports.CODEC = {})); | ||
@@ -212,6 +220,9 @@ // See https://tezos.gitlab.io/whitedoc/michelson.html#full-grammar | ||
0x06: 'ballot', | ||
0x00: 'endorsement', | ||
0x15: 'endorsement', | ||
0x01: 'seed_nonce_revelation', | ||
0x05: 'proposals', | ||
0x6f: 'register_global_constant', | ||
0x96: 'tx_rollup_origination', | ||
0x97: 'tx_rollup_submit_batch', | ||
0x9e: 'transfer_ticket', | ||
}; | ||
@@ -218,0 +229,0 @@ exports.kindMappingReverse = (() => { |
@@ -26,2 +26,4 @@ "use strict"; | ||
[constants_1.CODEC.VALUE]: codec_1.valueParameterDecoder, | ||
[constants_1.CODEC.INT16]: codec_1.int16Decoder, | ||
[constants_1.CODEC.BLOCK_PAYLOAD_HASH]: codec_1.blockPayloadHashDecoder, | ||
}; | ||
@@ -28,0 +30,0 @@ exports.decoders[constants_1.CODEC.OPERATION] = operation_1.operationDecoder(exports.decoders); |
@@ -24,3 +24,5 @@ "use strict"; | ||
[constants_1.CODEC.ADDRESS]: codec_1.addressEncoder, | ||
[constants_1.CODEC.VALUE]: codec_1.valueParameterEncoder | ||
[constants_1.CODEC.VALUE]: codec_1.valueParameterEncoder, | ||
[constants_1.CODEC.INT16]: codec_1.int16Encoder, | ||
[constants_1.CODEC.BLOCK_PAYLOAD_HASH]: codec_1.blockPayloadHashEncoder, | ||
}; | ||
@@ -27,0 +29,0 @@ exports.encoders[constants_1.CODEC.OPERATION] = operation_1.operationEncoder(exports.encoders); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.valueParameterEncoderProto13 = exports.parametersEncoderProto13 = exports.entrypointEncoderProto13 = exports.valueParameterDecoderProto13 = exports.parametersDecoderProto13 = void 0; | ||
exports.burnLimitDecoder = exports.burnLimitEncoder = exports.txRollupBatchContentDecoderProto13 = exports.txRollupBatchContentEncoderProto13 = exports.txRollupIdDecoderProto13 = exports.txRollupIdEncoderProto13 = exports.txRollupOriginationParamDecoderProto13 = exports.txRollupOriginationParamEncoderProto13 = exports.valueParameterEncoderProto13 = exports.parametersEncoderProto13 = exports.entrypointNameDecoderProto13 = exports.entrypointNameEncoderProto13 = exports.entrypointEncoderProto13 = exports.valueParameterDecoderProto13 = exports.parametersDecoderProto13 = void 0; | ||
const utils_1 = require("@taquito/utils"); | ||
const codec_1 = require("../codec"); | ||
@@ -9,3 +10,3 @@ const constants_1 = require("../constants"); | ||
const uint8array_consumer_1 = require("../uint8array-consumer"); | ||
const utils_1 = require("../utils"); | ||
const utils_2 = require("../utils"); | ||
const codec_proto13_1 = require("./michelson-proto13/codec-proto13"); | ||
@@ -46,2 +47,12 @@ const parametersDecoderProto13 = (val) => { | ||
exports.entrypointEncoderProto13 = entrypointEncoderProto13; | ||
const entrypointNameEncoderProto13 = (entrypoint) => { | ||
const value = { string: entrypoint }; | ||
return `${codec_proto13_1.valueEncoderProto13(value).slice(2)}`; | ||
}; | ||
exports.entrypointNameEncoderProto13 = entrypointNameEncoderProto13; | ||
const entrypointNameDecoderProto13 = (val) => { | ||
const entry = codec_2.extractRequiredLen(val); | ||
return Buffer.from(entry).toString('utf8'); | ||
}; | ||
exports.entrypointNameDecoderProto13 = entrypointNameDecoderProto13; | ||
const parametersEncoderProto13 = (val) => { | ||
@@ -59,5 +70,35 @@ if (!val || (val.entrypoint === 'default' && 'prim' in val.value && val.value.prim === 'Unit')) { | ||
const valueEncoded = codec_proto13_1.valueEncoderProto13(value); | ||
return `${utils_1.pad(valueEncoded.length / 2)}${valueEncoded}`; | ||
return `${utils_2.pad(valueEncoded.length / 2)}${valueEncoded}`; | ||
}; | ||
exports.valueParameterEncoderProto13 = valueParameterEncoderProto13; | ||
const txRollupOriginationParamEncoderProto13 = (_value) => { | ||
return ''; | ||
}; | ||
exports.txRollupOriginationParamEncoderProto13 = txRollupOriginationParamEncoderProto13; | ||
const txRollupOriginationParamDecoderProto13 = (_val) => { | ||
return {}; | ||
}; | ||
exports.txRollupOriginationParamDecoderProto13 = txRollupOriginationParamDecoderProto13; | ||
exports.txRollupIdEncoderProto13 = codec_1.prefixEncoder(utils_1.Prefix.TXR1); | ||
exports.txRollupIdDecoderProto13 = codec_1.prefixDecoder(utils_1.Prefix.TXR1); | ||
const txRollupBatchContentEncoderProto13 = (value) => { | ||
return `${utils_2.pad(value.length / 2)}${value}`; | ||
}; | ||
exports.txRollupBatchContentEncoderProto13 = txRollupBatchContentEncoderProto13; | ||
const txRollupBatchContentDecoderProto13 = (val) => { | ||
const value = codec_2.extractRequiredLen(val); | ||
return Buffer.from(value).toString('hex'); | ||
}; | ||
exports.txRollupBatchContentDecoderProto13 = txRollupBatchContentDecoderProto13; | ||
const burnLimitEncoder = (val) => { | ||
return !val ? '00' : `ff${codec_1.zarithEncoder(val)}`; | ||
}; | ||
exports.burnLimitEncoder = burnLimitEncoder; | ||
const burnLimitDecoder = (value) => { | ||
const prefix = value.consume(1); | ||
if (Buffer.from(prefix).toString('hex') !== '00') { | ||
return codec_1.zarithDecoder(value); | ||
} | ||
}; | ||
exports.burnLimitDecoder = burnLimitDecoder; | ||
//# sourceMappingURL=codec-proto13.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.decodersProto13 = void 0; | ||
const decoder_1 = require("../proto12-ithaca/decoder"); | ||
const decoder_1 = require("../decoder"); | ||
const constants_1 = require("../constants"); | ||
const schema_1 = require("../proto12-ithaca/schema"); | ||
const codec_proto13_1 = require("./codec-proto13"); | ||
const operation_1 = require("../schema/operation"); | ||
const codec_proto13_2 = require("./michelson-proto13/codec-proto13"); | ||
exports.decodersProto13 = Object.assign(Object.assign({}, decoder_1.decodersProto12), { [constants_1.CODEC.SCRIPT]: codec_proto13_2.scriptDecoderProto13, [constants_1.CODEC.PARAMETERS]: codec_proto13_1.parametersDecoderProto13, [constants_1.CODEC.VALUE]: codec_proto13_1.valueParameterDecoderProto13 }); | ||
exports.decodersProto13[constants_1.CODEC.OPERATION] = schema_1.operationDecoderProto12(exports.decodersProto13); | ||
const operation_proto13_1 = require("./schema/operation-proto13"); | ||
exports.decodersProto13 = Object.assign(Object.assign({}, decoder_1.decoders), { [constants_1.CODEC.SCRIPT]: codec_proto13_2.scriptDecoderProto13, [constants_1.CODEC.PARAMETERS]: codec_proto13_1.parametersDecoderProto13, [constants_1.CODEC.VALUE]: codec_proto13_1.valueParameterDecoderProto13, [constants_1.CODEC.ENTRYPOINT]: codec_proto13_1.entrypointNameDecoderProto13, [constants_1.CODEC.TX_ROLLUP_ORIGINATION_PARAM]: codec_proto13_1.txRollupOriginationParamDecoderProto13, [constants_1.CODEC.TX_ROLLUP_ID]: codec_proto13_1.txRollupIdDecoderProto13, [constants_1.CODEC.TX_ROLLUP_BATCH_CONTENT]: codec_proto13_1.txRollupBatchContentDecoderProto13, [constants_1.CODEC.BURN_LIMIT]: codec_proto13_1.burnLimitDecoder }); | ||
exports.decodersProto13[constants_1.CODEC.OPERATION] = operation_1.operationDecoder(exports.decodersProto13); | ||
exports.decodersProto13[constants_1.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(operation_1.ActivationSchema)(val); | ||
@@ -17,3 +17,3 @@ exports.decodersProto13[constants_1.CODEC.OP_DELEGATION] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(operation_1.DelegationSchema)(val); | ||
exports.decodersProto13[constants_1.CODEC.OP_BALLOT] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(operation_1.BallotSchema)(val); | ||
exports.decodersProto13[constants_1.CODEC.OP_ENDORSEMENT] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(schema_1.EndorsementSchemaProto12)(val); | ||
exports.decodersProto13[constants_1.CODEC.OP_ENDORSEMENT] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(operation_1.EndorsementSchema)(val); | ||
exports.decodersProto13[constants_1.CODEC.OP_SEED_NONCE_REVELATION] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(operation_1.SeedNonceRevelationSchema)(val); | ||
@@ -23,3 +23,6 @@ exports.decodersProto13[constants_1.CODEC.OP_PROPOSALS] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(operation_1.ProposalsSchema)(val); | ||
exports.decodersProto13[constants_1.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(operation_1.RegisterGlobalConstantSchema)(val); | ||
exports.decodersProto13[constants_1.CODEC.OP_TRANSFER_TICKET] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(operation_proto13_1.TransferTicketSchema)(val); | ||
exports.decodersProto13[constants_1.CODEC.OP_TX_ROLLUP_ORIGINATION] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(operation_proto13_1.TxRollupOriginationSchema)(val); | ||
exports.decodersProto13[constants_1.CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val) => operation_1.schemaDecoder(exports.decodersProto13)(operation_proto13_1.TxRollupSubmitBatchSchema)(val); | ||
exports.decodersProto13[constants_1.CODEC.MANAGER] = operation_1.schemaDecoder(exports.decodersProto13)(operation_1.ManagerOperationSchema); | ||
//# sourceMappingURL=decoder-proto13.js.map |
@@ -5,9 +5,9 @@ "use strict"; | ||
const constants_1 = require("../constants"); | ||
const encoder_1 = require("../proto12-ithaca/encoder"); | ||
const schema_1 = require("../proto12-ithaca/schema"); | ||
const encoder_1 = require("../encoder"); | ||
const operation_1 = require("../schema/operation"); | ||
const codec_proto13_1 = require("./codec-proto13"); | ||
const codec_proto13_2 = require("./michelson-proto13/codec-proto13"); | ||
exports.encodersProto13 = Object.assign(Object.assign({}, encoder_1.encodersProto12), { [constants_1.CODEC.SCRIPT]: codec_proto13_2.scriptEncoderProto13, [constants_1.CODEC.PARAMETERS]: codec_proto13_1.parametersEncoderProto13, [constants_1.CODEC.VALUE]: codec_proto13_1.valueParameterEncoderProto13 }); | ||
exports.encodersProto13[constants_1.CODEC.OPERATION] = schema_1.operationEncoderProto12(exports.encodersProto13); | ||
const operation_proto13_1 = require("./schema/operation-proto13"); | ||
exports.encodersProto13 = Object.assign(Object.assign({}, encoder_1.encoders), { [constants_1.CODEC.SCRIPT]: codec_proto13_2.scriptEncoderProto13, [constants_1.CODEC.PARAMETERS]: codec_proto13_1.parametersEncoderProto13, [constants_1.CODEC.VALUE]: codec_proto13_1.valueParameterEncoderProto13, [constants_1.CODEC.ENTRYPOINT]: codec_proto13_1.entrypointNameEncoderProto13, [constants_1.CODEC.TX_ROLLUP_ORIGINATION_PARAM]: codec_proto13_1.txRollupOriginationParamEncoderProto13, [constants_1.CODEC.TX_ROLLUP_ID]: codec_proto13_1.txRollupIdEncoderProto13, [constants_1.CODEC.TX_ROLLUP_BATCH_CONTENT]: codec_proto13_1.txRollupBatchContentEncoderProto13, [constants_1.CODEC.BURN_LIMIT]: codec_proto13_1.burnLimitEncoder }); | ||
exports.encodersProto13[constants_1.CODEC.OPERATION] = operation_1.operationEncoder(exports.encodersProto13); | ||
exports.encodersProto13[constants_1.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(operation_1.ActivationSchema)(val); | ||
@@ -18,3 +18,3 @@ exports.encodersProto13[constants_1.CODEC.OP_DELEGATION] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(operation_1.DelegationSchema)(val); | ||
exports.encodersProto13[constants_1.CODEC.OP_BALLOT] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(operation_1.BallotSchema)(val); | ||
exports.encodersProto13[constants_1.CODEC.OP_ENDORSEMENT] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(schema_1.EndorsementSchemaProto12)(val); | ||
exports.encodersProto13[constants_1.CODEC.OP_ENDORSEMENT] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(operation_1.EndorsementSchema)(val); | ||
exports.encodersProto13[constants_1.CODEC.OP_SEED_NONCE_REVELATION] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(operation_1.SeedNonceRevelationSchema)(val); | ||
@@ -24,3 +24,6 @@ exports.encodersProto13[constants_1.CODEC.OP_PROPOSALS] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(operation_1.ProposalsSchema)(val); | ||
exports.encodersProto13[constants_1.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(operation_1.RegisterGlobalConstantSchema)(val); | ||
exports.encodersProto13[constants_1.CODEC.OP_TRANSFER_TICKET] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(operation_proto13_1.TransferTicketSchema)(val); | ||
exports.encodersProto13[constants_1.CODEC.OP_TX_ROLLUP_ORIGINATION] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(operation_proto13_1.TxRollupOriginationSchema)(val); | ||
exports.encodersProto13[constants_1.CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val) => operation_1.schemaEncoder(exports.encodersProto13)(operation_proto13_1.TxRollupSubmitBatchSchema)(val); | ||
exports.encodersProto13[constants_1.CODEC.MANAGER] = operation_1.schemaEncoder(exports.encodersProto13)(operation_1.ManagerOperationSchema); | ||
//# sourceMappingURL=encoder-proto13.js.map |
@@ -8,70 +8,73 @@ "use strict"; | ||
exports.ManagerOperationSchema = { | ||
branch: 'branch', | ||
contents: ['operation'], | ||
branch: constants_1.CODEC.BRANCH, | ||
contents: [constants_1.CODEC.OPERATION], | ||
}; | ||
exports.ActivationSchema = { | ||
pkh: 'tz1', | ||
secret: 'secret', | ||
pkh: constants_1.CODEC.TZ1, | ||
secret: constants_1.CODEC.SECRET, | ||
}; | ||
exports.RevealSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
public_key: 'public_key', | ||
source: constants_1.CODEC.PKH, | ||
fee: constants_1.CODEC.ZARITH, | ||
counter: constants_1.CODEC.ZARITH, | ||
gas_limit: constants_1.CODEC.ZARITH, | ||
storage_limit: constants_1.CODEC.ZARITH, | ||
public_key: constants_1.CODEC.PUBLIC_KEY, | ||
}; | ||
exports.DelegationSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
delegate: 'delegate', | ||
source: constants_1.CODEC.PKH, | ||
fee: constants_1.CODEC.ZARITH, | ||
counter: constants_1.CODEC.ZARITH, | ||
gas_limit: constants_1.CODEC.ZARITH, | ||
storage_limit: constants_1.CODEC.ZARITH, | ||
delegate: constants_1.CODEC.DELEGATE, | ||
}; | ||
exports.TransactionSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
amount: 'zarith', | ||
destination: 'address', | ||
parameters: 'parameters', | ||
source: constants_1.CODEC.PKH, | ||
fee: constants_1.CODEC.ZARITH, | ||
counter: constants_1.CODEC.ZARITH, | ||
gas_limit: constants_1.CODEC.ZARITH, | ||
storage_limit: constants_1.CODEC.ZARITH, | ||
amount: constants_1.CODEC.ZARITH, | ||
destination: constants_1.CODEC.ADDRESS, | ||
parameters: constants_1.CODEC.PARAMETERS, | ||
}; | ||
exports.OriginationSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
balance: 'zarith', | ||
delegate: 'delegate', | ||
script: 'script', | ||
source: constants_1.CODEC.PKH, | ||
fee: constants_1.CODEC.ZARITH, | ||
counter: constants_1.CODEC.ZARITH, | ||
gas_limit: constants_1.CODEC.ZARITH, | ||
storage_limit: constants_1.CODEC.ZARITH, | ||
balance: constants_1.CODEC.ZARITH, | ||
delegate: constants_1.CODEC.DELEGATE, | ||
script: constants_1.CODEC.SCRIPT, | ||
}; | ||
exports.BallotSchema = { | ||
source: 'pkh', | ||
period: 'int32', | ||
proposal: 'proposal', | ||
ballot: 'ballotStmt', | ||
source: constants_1.CODEC.PKH, | ||
period: constants_1.CODEC.INT32, | ||
proposal: constants_1.CODEC.PROPOSAL, | ||
ballot: constants_1.CODEC.BALLOT_STATEMENT, | ||
}; | ||
exports.EndorsementSchema = { | ||
level: 'int32', | ||
slot: constants_1.CODEC.INT16, | ||
level: constants_1.CODEC.INT32, | ||
round: constants_1.CODEC.INT32, | ||
block_payload_hash: constants_1.CODEC.BLOCK_PAYLOAD_HASH, | ||
}; | ||
exports.SeedNonceRevelationSchema = { | ||
level: 'int32', | ||
nonce: 'raw', | ||
level: constants_1.CODEC.INT32, | ||
nonce: constants_1.CODEC.RAW, | ||
}; | ||
exports.ProposalsSchema = { | ||
source: 'pkh', | ||
period: 'int32', | ||
proposals: 'proposalArr', | ||
source: constants_1.CODEC.PKH, | ||
period: constants_1.CODEC.INT32, | ||
proposals: constants_1.CODEC.PROPOSAL_ARR, | ||
}; | ||
exports.RegisterGlobalConstantSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
value: 'value', | ||
source: constants_1.CODEC.PKH, | ||
fee: constants_1.CODEC.ZARITH, | ||
counter: constants_1.CODEC.ZARITH, | ||
gas_limit: constants_1.CODEC.ZARITH, | ||
storage_limit: constants_1.CODEC.ZARITH, | ||
value: constants_1.CODEC.VALUE, | ||
}; | ||
@@ -102,3 +105,3 @@ const operationEncoder = (encoders) => (operation) => { | ||
const valueToEncode = schema[key]; | ||
if (Array.isArray(valueToEncode)) { | ||
if (value && Array.isArray(valueToEncode)) { | ||
const encoder = encoders[valueToEncode[0]]; | ||
@@ -105,0 +108,0 @@ const values = value[key]; |
@@ -22,4 +22,2 @@ "use strict"; | ||
const uint8array_consumer_1 = require("./uint8array-consumer"); | ||
const decoder_2 = require("./proto12-ithaca/decoder"); | ||
const encoder_2 = require("./proto12-ithaca/encoder"); | ||
const utils_1 = require("@taquito/utils"); | ||
@@ -43,13 +41,4 @@ const error_1 = require("./error"); | ||
function getCodec(codec, proto) { | ||
if (proto === protocols_1.ProtocolsHash.Psithaca2) { | ||
if (proto === protocols_1.ProtocolsHash.Psithaca2 || protocols_1.ProtoInferiorTo(proto, protocols_1.ProtocolsHash.Psithaca2)) { | ||
return { | ||
encoder: encoder_2.encodersProto12[codec], | ||
decoder: (hex) => { | ||
const consumer = uint8array_consumer_1.Uint8ArrayConsumer.fromHexString(hex); | ||
return decoder_2.decodersProto12[codec](consumer); | ||
}, | ||
}; | ||
} | ||
else if (protocols_1.ProtoInferiorTo(proto, protocols_1.ProtocolsHash.Psithaca2)) { | ||
return { | ||
encoder: encoder_1.encoders[codec], | ||
@@ -97,2 +86,6 @@ decoder: (hex) => { | ||
} | ||
else if (content.kind === 'tx_rollup_submit_batch' && | ||
diff[0] === 'burn_limit') { | ||
continue; | ||
} | ||
else { | ||
@@ -99,0 +92,0 @@ throw new error_1.InvalidOperationSchemaError(`Missing properties: ${diff.join(', ').toString()}`); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateMissingProperty = exports.validateOperationKind = void 0; | ||
const operation_proto13_1 = require("./proto13-jakarta/schema/operation-proto13"); | ||
const operation_1 = require("./schema/operation"); | ||
@@ -16,2 +17,5 @@ const OperationKindMapping = { | ||
register_global_constant: operation_1.RegisterGlobalConstantSchema, | ||
transfer_ticket: operation_proto13_1.TransferTicketSchema, | ||
tx_rollup_origination: operation_proto13_1.TxRollupOriginationSchema, | ||
tx_rollup_submit_batch: operation_proto13_1.TxRollupSubmitBatchSchema, | ||
}; | ||
@@ -18,0 +22,0 @@ // Asymmetric difference: only account for things in arr2 that are not present in arr1, not vice versa |
@@ -6,5 +6,5 @@ "use strict"; | ||
exports.VERSION = { | ||
"commitHash": "38da814ec2bb4e81c7ad5a45b6b183a4d0b8dc25", | ||
"version": "12.1.1" | ||
commitHash: '38da814ec2bb4e81c7ad5a45b6b183a4d0b8dc25', | ||
version: '12.1.1', | ||
}; | ||
//# sourceMappingURL=version.js.map |
@@ -33,2 +33,6 @@ import { Prefix, prefixLength, b58cencode, prefix, buf2hex, b58cdecode, InvalidKeyHashError, InvalidPublicKeyError, InvalidAddressError, InvalidOperationKindError, validateBlock, ValidationResult } from '@taquito/utils'; | ||
CODEC["ADDRESS"] = "address"; | ||
CODEC["VALUE"] = "value"; | ||
CODEC["MANAGER"] = "manager"; | ||
CODEC["BLOCK_PAYLOAD_HASH"] = "blockPayloadHash"; | ||
CODEC["ENTRYPOINT"] = "entrypoint"; | ||
CODEC["OPERATION"] = "operation"; | ||
@@ -45,5 +49,9 @@ CODEC["OP_ACTIVATE_ACCOUNT"] = "activate_account"; | ||
CODEC["OP_REGISTER_GLOBAL_CONSTANT"] = "register_global_constant"; | ||
CODEC["VALUE"] = "value"; | ||
CODEC["MANAGER"] = "manager"; | ||
CODEC["BLOCK_PAYLOAD_HASH"] = "blockPayloadHash"; | ||
CODEC["OP_TRANSFER_TICKET"] = "transfer_ticket"; | ||
CODEC["OP_TX_ROLLUP_ORIGINATION"] = "tx_rollup_origination"; | ||
CODEC["OP_TX_ROLLUP_SUBMIT_BATCH"] = "tx_rollup_submit_batch"; | ||
CODEC["BURN_LIMIT"] = "burn_limit"; | ||
CODEC["TX_ROLLUP_ORIGINATION_PARAM"] = "tx_rollup_origination_param"; | ||
CODEC["TX_ROLLUP_ID"] = "tx_rollup_id"; | ||
CODEC["TX_ROLLUP_BATCH_CONTENT"] = "tx_rollup_batch_content"; | ||
})(CODEC || (CODEC = {})); | ||
@@ -216,6 +224,9 @@ // See https://tezos.gitlab.io/whitedoc/michelson.html#full-grammar | ||
0x06: 'ballot', | ||
0x00: 'endorsement', | ||
0x15: 'endorsement', | ||
0x01: 'seed_nonce_revelation', | ||
0x05: 'proposals', | ||
0x6f: 'register_global_constant', | ||
0x96: 'tx_rollup_origination', | ||
0x97: 'tx_rollup_submit_batch', | ||
0x9e: 'transfer_ticket', | ||
}; | ||
@@ -900,72 +911,77 @@ const kindMappingReverse = (() => { | ||
}; | ||
const blockPayloadHashEncoder = prefixEncoder(Prefix.VH); | ||
const blockPayloadHashDecoder = prefixDecoder(Prefix.VH); | ||
const ManagerOperationSchema = { | ||
branch: 'branch', | ||
contents: ['operation'], | ||
branch: CODEC.BRANCH, | ||
contents: [CODEC.OPERATION], | ||
}; | ||
const ActivationSchema = { | ||
pkh: 'tz1', | ||
secret: 'secret', | ||
pkh: CODEC.TZ1, | ||
secret: CODEC.SECRET, | ||
}; | ||
const RevealSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
public_key: 'public_key', | ||
source: CODEC.PKH, | ||
fee: CODEC.ZARITH, | ||
counter: CODEC.ZARITH, | ||
gas_limit: CODEC.ZARITH, | ||
storage_limit: CODEC.ZARITH, | ||
public_key: CODEC.PUBLIC_KEY, | ||
}; | ||
const DelegationSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
delegate: 'delegate', | ||
source: CODEC.PKH, | ||
fee: CODEC.ZARITH, | ||
counter: CODEC.ZARITH, | ||
gas_limit: CODEC.ZARITH, | ||
storage_limit: CODEC.ZARITH, | ||
delegate: CODEC.DELEGATE, | ||
}; | ||
const TransactionSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
amount: 'zarith', | ||
destination: 'address', | ||
parameters: 'parameters', | ||
source: CODEC.PKH, | ||
fee: CODEC.ZARITH, | ||
counter: CODEC.ZARITH, | ||
gas_limit: CODEC.ZARITH, | ||
storage_limit: CODEC.ZARITH, | ||
amount: CODEC.ZARITH, | ||
destination: CODEC.ADDRESS, | ||
parameters: CODEC.PARAMETERS, | ||
}; | ||
const OriginationSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
balance: 'zarith', | ||
delegate: 'delegate', | ||
script: 'script', | ||
source: CODEC.PKH, | ||
fee: CODEC.ZARITH, | ||
counter: CODEC.ZARITH, | ||
gas_limit: CODEC.ZARITH, | ||
storage_limit: CODEC.ZARITH, | ||
balance: CODEC.ZARITH, | ||
delegate: CODEC.DELEGATE, | ||
script: CODEC.SCRIPT, | ||
}; | ||
const BallotSchema = { | ||
source: 'pkh', | ||
period: 'int32', | ||
proposal: 'proposal', | ||
ballot: 'ballotStmt', | ||
source: CODEC.PKH, | ||
period: CODEC.INT32, | ||
proposal: CODEC.PROPOSAL, | ||
ballot: CODEC.BALLOT_STATEMENT, | ||
}; | ||
const EndorsementSchema = { | ||
level: 'int32', | ||
slot: CODEC.INT16, | ||
level: CODEC.INT32, | ||
round: CODEC.INT32, | ||
block_payload_hash: CODEC.BLOCK_PAYLOAD_HASH, | ||
}; | ||
const SeedNonceRevelationSchema = { | ||
level: 'int32', | ||
nonce: 'raw', | ||
level: CODEC.INT32, | ||
nonce: CODEC.RAW, | ||
}; | ||
const ProposalsSchema = { | ||
source: 'pkh', | ||
period: 'int32', | ||
proposals: 'proposalArr', | ||
source: CODEC.PKH, | ||
period: CODEC.INT32, | ||
proposals: CODEC.PROPOSAL_ARR, | ||
}; | ||
const RegisterGlobalConstantSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
value: 'value', | ||
source: CODEC.PKH, | ||
fee: CODEC.ZARITH, | ||
counter: CODEC.ZARITH, | ||
gas_limit: CODEC.ZARITH, | ||
storage_limit: CODEC.ZARITH, | ||
value: CODEC.VALUE, | ||
}; | ||
@@ -994,3 +1010,3 @@ const operationEncoder = (encoders) => (operation) => { | ||
const valueToEncode = schema[key]; | ||
if (Array.isArray(valueToEncode)) { | ||
if (value && Array.isArray(valueToEncode)) { | ||
const encoder = encoders[valueToEncode[0]]; | ||
@@ -1055,2 +1071,4 @@ const values = value[key]; | ||
[CODEC.VALUE]: valueParameterDecoder, | ||
[CODEC.INT16]: int16Decoder, | ||
[CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashDecoder, | ||
}; | ||
@@ -1086,3 +1104,5 @@ decoders[CODEC.OPERATION] = operationDecoder(decoders); | ||
[CODEC.ADDRESS]: addressEncoder, | ||
[CODEC.VALUE]: valueParameterEncoder | ||
[CODEC.VALUE]: valueParameterEncoder, | ||
[CODEC.INT16]: int16Encoder, | ||
[CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashEncoder, | ||
}; | ||
@@ -1102,96 +1122,34 @@ encoders[CODEC.OPERATION] = operationEncoder(encoders); | ||
const blockPayloadHashEncoder = prefixEncoder(Prefix.VH); | ||
const blockPayloadHashDecoder = prefixDecoder(Prefix.VH); | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function __rest(s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
} | ||
const kindMappingNoEndorsement = __rest(kindMapping, ["0"]); | ||
const kindMappingProto12 = Object.assign(Object.assign({}, kindMappingNoEndorsement), { 0x15: 'endorsement' }); | ||
const kindMappingReverseProto12 = (() => { | ||
const result = {}; | ||
Object.keys(kindMappingProto12).forEach((key) => { | ||
const keyNum = typeof key === 'string' ? parseInt(key, 10) : key; | ||
result[kindMappingProto12[keyNum]] = pad(keyNum, 2); | ||
}); | ||
return result; | ||
})(); | ||
const EndorsementSchemaProto12 = { | ||
slot: 'int16', | ||
level: 'int32', | ||
round: 'int32', | ||
block_payload_hash: 'blockPayloadHash', | ||
const TransferTicketSchema = { | ||
source: CODEC.PKH, | ||
fee: CODEC.ZARITH, | ||
counter: CODEC.ZARITH, | ||
gas_limit: CODEC.ZARITH, | ||
storage_limit: CODEC.ZARITH, | ||
ticket_contents: CODEC.VALUE, | ||
ticket_ty: CODEC.VALUE, | ||
ticket_ticketer: CODEC.ADDRESS, | ||
ticket_amount: CODEC.ZARITH, | ||
destination: CODEC.ADDRESS, | ||
entrypoint: CODEC.ENTRYPOINT, | ||
}; | ||
const operationEncoderProto12 = (encoders) => (operation) => { | ||
if (!(operation.kind in encoders) || !(operation.kind in kindMappingReverseProto12)) { | ||
throw new InvalidOperationKindError(operation.kind); | ||
} | ||
return kindMappingReverseProto12[operation.kind] + encoders[operation.kind](operation); | ||
const TxRollupOriginationSchema = { | ||
source: CODEC.PKH, | ||
fee: CODEC.ZARITH, | ||
counter: CODEC.ZARITH, | ||
gas_limit: CODEC.ZARITH, | ||
storage_limit: CODEC.ZARITH, | ||
tx_rollup_origination: CODEC.TX_ROLLUP_ORIGINATION_PARAM, | ||
}; | ||
const operationDecoderProto12 = (decoders) => (value) => { | ||
const op = value.consume(1); | ||
const operationName = kindMappingProto12[op[0]]; | ||
if (operationName === undefined) { | ||
throw new UnsupportedOperationError(op[0].toString()); | ||
} | ||
const decodedObj = decoders[operationName](value); | ||
if (typeof decodedObj !== 'object') { | ||
throw new OperationDecodingError('Decoded invalid operation'); | ||
} | ||
return Object.assign({ kind: operationName }, decodedObj); | ||
const TxRollupSubmitBatchSchema = { | ||
source: CODEC.PKH, | ||
fee: CODEC.ZARITH, | ||
counter: CODEC.ZARITH, | ||
gas_limit: CODEC.ZARITH, | ||
storage_limit: CODEC.ZARITH, | ||
rollup: CODEC.TX_ROLLUP_ID, | ||
content: CODEC.TX_ROLLUP_BATCH_CONTENT, | ||
burn_limit: CODEC.BURN_LIMIT, | ||
}; | ||
const decodersProto12 = Object.assign(Object.assign({}, decoders), { [CODEC.INT16]: int16Decoder, [CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashDecoder }); | ||
decodersProto12[CODEC.OPERATION] = operationDecoderProto12(decodersProto12); | ||
decodersProto12[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder(decodersProto12)(ActivationSchema)(val); | ||
decodersProto12[CODEC.OP_DELEGATION] = (val) => schemaDecoder(decodersProto12)(DelegationSchema)(val); | ||
decodersProto12[CODEC.OP_TRANSACTION] = (val) => schemaDecoder(decodersProto12)(TransactionSchema)(val); | ||
decodersProto12[CODEC.OP_ORIGINATION] = (val) => schemaDecoder(decodersProto12)(OriginationSchema)(val); | ||
decodersProto12[CODEC.OP_BALLOT] = (val) => schemaDecoder(decodersProto12)(BallotSchema)(val); | ||
decodersProto12[CODEC.OP_ENDORSEMENT] = (val) => schemaDecoder(decodersProto12)(EndorsementSchemaProto12)(val); | ||
decodersProto12[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder(decodersProto12)(SeedNonceRevelationSchema)(val); | ||
decodersProto12[CODEC.OP_PROPOSALS] = (val) => schemaDecoder(decodersProto12)(ProposalsSchema)(val); | ||
decodersProto12[CODEC.OP_REVEAL] = (val) => schemaDecoder(decodersProto12)(RevealSchema)(val); | ||
decodersProto12[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder(decodersProto12)(RegisterGlobalConstantSchema)(val); | ||
decodersProto12[CODEC.MANAGER] = schemaDecoder(decodersProto12)(ManagerOperationSchema); | ||
const encodersProto12 = Object.assign(Object.assign({}, encoders), { [CODEC.INT16]: int16Encoder, [CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashEncoder }); | ||
encodersProto12[CODEC.OPERATION] = operationEncoderProto12(encodersProto12); | ||
encodersProto12[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder(encodersProto12)(ActivationSchema)(val); | ||
encodersProto12[CODEC.OP_DELEGATION] = (val) => schemaEncoder(encodersProto12)(DelegationSchema)(val); | ||
encodersProto12[CODEC.OP_TRANSACTION] = (val) => schemaEncoder(encodersProto12)(TransactionSchema)(val); | ||
encodersProto12[CODEC.OP_ORIGINATION] = (val) => schemaEncoder(encodersProto12)(OriginationSchema)(val); | ||
encodersProto12[CODEC.OP_BALLOT] = (val) => schemaEncoder(encodersProto12)(BallotSchema)(val); | ||
encodersProto12[CODEC.OP_ENDORSEMENT] = (val) => schemaEncoder(encodersProto12)(EndorsementSchemaProto12)(val); | ||
encodersProto12[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder(encodersProto12)(SeedNonceRevelationSchema)(val); | ||
encodersProto12[CODEC.OP_PROPOSALS] = (val) => schemaEncoder(encodersProto12)(ProposalsSchema)(val); | ||
encodersProto12[CODEC.OP_REVEAL] = (val) => schemaEncoder(encodersProto12)(RevealSchema)(val); | ||
encodersProto12[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder(encodersProto12)(RegisterGlobalConstantSchema)(val); | ||
encodersProto12[CODEC.MANAGER] = schemaEncoder(encodersProto12)(ManagerOperationSchema); | ||
const OperationKindMapping = { | ||
@@ -1208,2 +1166,5 @@ activate_account: ActivationSchema, | ||
register_global_constant: RegisterGlobalConstantSchema, | ||
transfer_ticket: TransferTicketSchema, | ||
tx_rollup_origination: TxRollupOriginationSchema, | ||
tx_rollup_submit_batch: TxRollupSubmitBatchSchema, | ||
}; | ||
@@ -1445,2 +1406,10 @@ // Asymmetric difference: only account for things in arr2 that are not present in arr1, not vice versa | ||
}; | ||
const entrypointNameEncoderProto13 = (entrypoint) => { | ||
const value = { string: entrypoint }; | ||
return `${valueEncoderProto13(value).slice(2)}`; | ||
}; | ||
const entrypointNameDecoderProto13 = (val) => { | ||
const entry = extractRequiredLen(val); | ||
return Buffer.from(entry).toString('utf8'); | ||
}; | ||
const parametersEncoderProto13 = (val) => { | ||
@@ -1459,5 +1428,29 @@ if (!val || (val.entrypoint === 'default' && 'prim' in val.value && val.value.prim === 'Unit')) { | ||
}; | ||
const txRollupOriginationParamEncoderProto13 = (_value) => { | ||
return ''; | ||
}; | ||
const txRollupOriginationParamDecoderProto13 = (_val) => { | ||
return {}; | ||
}; | ||
const txRollupIdEncoderProto13 = prefixEncoder(Prefix.TXR1); | ||
const txRollupIdDecoderProto13 = prefixDecoder(Prefix.TXR1); | ||
const txRollupBatchContentEncoderProto13 = (value) => { | ||
return `${pad(value.length / 2)}${value}`; | ||
}; | ||
const txRollupBatchContentDecoderProto13 = (val) => { | ||
const value = extractRequiredLen(val); | ||
return Buffer.from(value).toString('hex'); | ||
}; | ||
const burnLimitEncoder = (val) => { | ||
return !val ? '00' : `ff${zarithEncoder(val)}`; | ||
}; | ||
const burnLimitDecoder = (value) => { | ||
const prefix = value.consume(1); | ||
if (Buffer.from(prefix).toString('hex') !== '00') { | ||
return zarithDecoder(value); | ||
} | ||
}; | ||
const encodersProto13 = Object.assign(Object.assign({}, encodersProto12), { [CODEC.SCRIPT]: scriptEncoderProto13, [CODEC.PARAMETERS]: parametersEncoderProto13, [CODEC.VALUE]: valueParameterEncoderProto13 }); | ||
encodersProto13[CODEC.OPERATION] = operationEncoderProto12(encodersProto13); | ||
const encodersProto13 = Object.assign(Object.assign({}, encoders), { [CODEC.SCRIPT]: scriptEncoderProto13, [CODEC.PARAMETERS]: parametersEncoderProto13, [CODEC.VALUE]: valueParameterEncoderProto13, [CODEC.ENTRYPOINT]: entrypointNameEncoderProto13, [CODEC.TX_ROLLUP_ORIGINATION_PARAM]: txRollupOriginationParamEncoderProto13, [CODEC.TX_ROLLUP_ID]: txRollupIdEncoderProto13, [CODEC.TX_ROLLUP_BATCH_CONTENT]: txRollupBatchContentEncoderProto13, [CODEC.BURN_LIMIT]: burnLimitEncoder }); | ||
encodersProto13[CODEC.OPERATION] = operationEncoder(encodersProto13); | ||
encodersProto13[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder(encodersProto13)(ActivationSchema)(val); | ||
@@ -1468,3 +1461,3 @@ encodersProto13[CODEC.OP_DELEGATION] = (val) => schemaEncoder(encodersProto13)(DelegationSchema)(val); | ||
encodersProto13[CODEC.OP_BALLOT] = (val) => schemaEncoder(encodersProto13)(BallotSchema)(val); | ||
encodersProto13[CODEC.OP_ENDORSEMENT] = (val) => schemaEncoder(encodersProto13)(EndorsementSchemaProto12)(val); | ||
encodersProto13[CODEC.OP_ENDORSEMENT] = (val) => schemaEncoder(encodersProto13)(EndorsementSchema)(val); | ||
encodersProto13[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder(encodersProto13)(SeedNonceRevelationSchema)(val); | ||
@@ -1474,6 +1467,9 @@ encodersProto13[CODEC.OP_PROPOSALS] = (val) => schemaEncoder(encodersProto13)(ProposalsSchema)(val); | ||
encodersProto13[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder(encodersProto13)(RegisterGlobalConstantSchema)(val); | ||
encodersProto13[CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder(encodersProto13)(TransferTicketSchema)(val); | ||
encodersProto13[CODEC.OP_TX_ROLLUP_ORIGINATION] = (val) => schemaEncoder(encodersProto13)(TxRollupOriginationSchema)(val); | ||
encodersProto13[CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val) => schemaEncoder(encodersProto13)(TxRollupSubmitBatchSchema)(val); | ||
encodersProto13[CODEC.MANAGER] = schemaEncoder(encodersProto13)(ManagerOperationSchema); | ||
const decodersProto13 = Object.assign(Object.assign({}, decodersProto12), { [CODEC.SCRIPT]: scriptDecoderProto13, [CODEC.PARAMETERS]: parametersDecoderProto13, [CODEC.VALUE]: valueParameterDecoderProto13 }); | ||
decodersProto13[CODEC.OPERATION] = operationDecoderProto12(decodersProto13); | ||
const decodersProto13 = Object.assign(Object.assign({}, decoders), { [CODEC.SCRIPT]: scriptDecoderProto13, [CODEC.PARAMETERS]: parametersDecoderProto13, [CODEC.VALUE]: valueParameterDecoderProto13, [CODEC.ENTRYPOINT]: entrypointNameDecoderProto13, [CODEC.TX_ROLLUP_ORIGINATION_PARAM]: txRollupOriginationParamDecoderProto13, [CODEC.TX_ROLLUP_ID]: txRollupIdDecoderProto13, [CODEC.TX_ROLLUP_BATCH_CONTENT]: txRollupBatchContentDecoderProto13, [CODEC.BURN_LIMIT]: burnLimitDecoder }); | ||
decodersProto13[CODEC.OPERATION] = operationDecoder(decodersProto13); | ||
decodersProto13[CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder(decodersProto13)(ActivationSchema)(val); | ||
@@ -1484,3 +1480,3 @@ decodersProto13[CODEC.OP_DELEGATION] = (val) => schemaDecoder(decodersProto13)(DelegationSchema)(val); | ||
decodersProto13[CODEC.OP_BALLOT] = (val) => schemaDecoder(decodersProto13)(BallotSchema)(val); | ||
decodersProto13[CODEC.OP_ENDORSEMENT] = (val) => schemaDecoder(decodersProto13)(EndorsementSchemaProto12)(val); | ||
decodersProto13[CODEC.OP_ENDORSEMENT] = (val) => schemaDecoder(decodersProto13)(EndorsementSchema)(val); | ||
decodersProto13[CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder(decodersProto13)(SeedNonceRevelationSchema)(val); | ||
@@ -1490,2 +1486,5 @@ decodersProto13[CODEC.OP_PROPOSALS] = (val) => schemaDecoder(decodersProto13)(ProposalsSchema)(val); | ||
decodersProto13[CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder(decodersProto13)(RegisterGlobalConstantSchema)(val); | ||
decodersProto13[CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder(decodersProto13)(TransferTicketSchema)(val); | ||
decodersProto13[CODEC.OP_TX_ROLLUP_ORIGINATION] = (val) => schemaDecoder(decodersProto13)(TxRollupOriginationSchema)(val); | ||
decodersProto13[CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val) => schemaDecoder(decodersProto13)(TxRollupSubmitBatchSchema)(val); | ||
decodersProto13[CODEC.MANAGER] = schemaDecoder(decodersProto13)(ManagerOperationSchema); | ||
@@ -1495,4 +1494,4 @@ | ||
const VERSION = { | ||
"commitHash": "38da814ec2bb4e81c7ad5a45b6b183a4d0b8dc25", | ||
"version": "12.1.1" | ||
commitHash: '38da814ec2bb4e81c7ad5a45b6b183a4d0b8dc25', | ||
version: '12.1.1', | ||
}; | ||
@@ -1506,13 +1505,4 @@ | ||
function getCodec(codec, proto) { | ||
if (proto === ProtocolsHash.Psithaca2) { | ||
if (proto === ProtocolsHash.Psithaca2 || ProtoInferiorTo(proto, ProtocolsHash.Psithaca2)) { | ||
return { | ||
encoder: encodersProto12[codec], | ||
decoder: (hex) => { | ||
const consumer = Uint8ArrayConsumer.fromHexString(hex); | ||
return decodersProto12[codec](consumer); | ||
}, | ||
}; | ||
} | ||
else if (ProtoInferiorTo(proto, ProtocolsHash.Psithaca2)) { | ||
return { | ||
encoder: encoders[codec], | ||
@@ -1559,2 +1549,6 @@ decoder: (hex) => { | ||
} | ||
else if (content.kind === 'tx_rollup_submit_batch' && | ||
diff[0] === 'burn_limit') { | ||
continue; | ||
} | ||
else { | ||
@@ -1561,0 +1555,0 @@ throw new InvalidOperationSchemaError(`Missing properties: ${diff.join(', ').toString()}`); |
@@ -40,2 +40,6 @@ (function (global, factory) { | ||
CODEC["ADDRESS"] = "address"; | ||
CODEC["VALUE"] = "value"; | ||
CODEC["MANAGER"] = "manager"; | ||
CODEC["BLOCK_PAYLOAD_HASH"] = "blockPayloadHash"; | ||
CODEC["ENTRYPOINT"] = "entrypoint"; | ||
CODEC["OPERATION"] = "operation"; | ||
@@ -52,5 +56,9 @@ CODEC["OP_ACTIVATE_ACCOUNT"] = "activate_account"; | ||
CODEC["OP_REGISTER_GLOBAL_CONSTANT"] = "register_global_constant"; | ||
CODEC["VALUE"] = "value"; | ||
CODEC["MANAGER"] = "manager"; | ||
CODEC["BLOCK_PAYLOAD_HASH"] = "blockPayloadHash"; | ||
CODEC["OP_TRANSFER_TICKET"] = "transfer_ticket"; | ||
CODEC["OP_TX_ROLLUP_ORIGINATION"] = "tx_rollup_origination"; | ||
CODEC["OP_TX_ROLLUP_SUBMIT_BATCH"] = "tx_rollup_submit_batch"; | ||
CODEC["BURN_LIMIT"] = "burn_limit"; | ||
CODEC["TX_ROLLUP_ORIGINATION_PARAM"] = "tx_rollup_origination_param"; | ||
CODEC["TX_ROLLUP_ID"] = "tx_rollup_id"; | ||
CODEC["TX_ROLLUP_BATCH_CONTENT"] = "tx_rollup_batch_content"; | ||
})(exports.CODEC || (exports.CODEC = {})); | ||
@@ -223,6 +231,9 @@ // See https://tezos.gitlab.io/whitedoc/michelson.html#full-grammar | ||
0x06: 'ballot', | ||
0x00: 'endorsement', | ||
0x15: 'endorsement', | ||
0x01: 'seed_nonce_revelation', | ||
0x05: 'proposals', | ||
0x6f: 'register_global_constant', | ||
0x96: 'tx_rollup_origination', | ||
0x97: 'tx_rollup_submit_batch', | ||
0x9e: 'transfer_ticket', | ||
}; | ||
@@ -907,72 +918,77 @@ const kindMappingReverse = (() => { | ||
}; | ||
const blockPayloadHashEncoder = prefixEncoder(utils.Prefix.VH); | ||
const blockPayloadHashDecoder = prefixDecoder(utils.Prefix.VH); | ||
const ManagerOperationSchema = { | ||
branch: 'branch', | ||
contents: ['operation'], | ||
branch: exports.CODEC.BRANCH, | ||
contents: [exports.CODEC.OPERATION], | ||
}; | ||
const ActivationSchema = { | ||
pkh: 'tz1', | ||
secret: 'secret', | ||
pkh: exports.CODEC.TZ1, | ||
secret: exports.CODEC.SECRET, | ||
}; | ||
const RevealSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
public_key: 'public_key', | ||
source: exports.CODEC.PKH, | ||
fee: exports.CODEC.ZARITH, | ||
counter: exports.CODEC.ZARITH, | ||
gas_limit: exports.CODEC.ZARITH, | ||
storage_limit: exports.CODEC.ZARITH, | ||
public_key: exports.CODEC.PUBLIC_KEY, | ||
}; | ||
const DelegationSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
delegate: 'delegate', | ||
source: exports.CODEC.PKH, | ||
fee: exports.CODEC.ZARITH, | ||
counter: exports.CODEC.ZARITH, | ||
gas_limit: exports.CODEC.ZARITH, | ||
storage_limit: exports.CODEC.ZARITH, | ||
delegate: exports.CODEC.DELEGATE, | ||
}; | ||
const TransactionSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
amount: 'zarith', | ||
destination: 'address', | ||
parameters: 'parameters', | ||
source: exports.CODEC.PKH, | ||
fee: exports.CODEC.ZARITH, | ||
counter: exports.CODEC.ZARITH, | ||
gas_limit: exports.CODEC.ZARITH, | ||
storage_limit: exports.CODEC.ZARITH, | ||
amount: exports.CODEC.ZARITH, | ||
destination: exports.CODEC.ADDRESS, | ||
parameters: exports.CODEC.PARAMETERS, | ||
}; | ||
const OriginationSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
balance: 'zarith', | ||
delegate: 'delegate', | ||
script: 'script', | ||
source: exports.CODEC.PKH, | ||
fee: exports.CODEC.ZARITH, | ||
counter: exports.CODEC.ZARITH, | ||
gas_limit: exports.CODEC.ZARITH, | ||
storage_limit: exports.CODEC.ZARITH, | ||
balance: exports.CODEC.ZARITH, | ||
delegate: exports.CODEC.DELEGATE, | ||
script: exports.CODEC.SCRIPT, | ||
}; | ||
const BallotSchema = { | ||
source: 'pkh', | ||
period: 'int32', | ||
proposal: 'proposal', | ||
ballot: 'ballotStmt', | ||
source: exports.CODEC.PKH, | ||
period: exports.CODEC.INT32, | ||
proposal: exports.CODEC.PROPOSAL, | ||
ballot: exports.CODEC.BALLOT_STATEMENT, | ||
}; | ||
const EndorsementSchema = { | ||
level: 'int32', | ||
slot: exports.CODEC.INT16, | ||
level: exports.CODEC.INT32, | ||
round: exports.CODEC.INT32, | ||
block_payload_hash: exports.CODEC.BLOCK_PAYLOAD_HASH, | ||
}; | ||
const SeedNonceRevelationSchema = { | ||
level: 'int32', | ||
nonce: 'raw', | ||
level: exports.CODEC.INT32, | ||
nonce: exports.CODEC.RAW, | ||
}; | ||
const ProposalsSchema = { | ||
source: 'pkh', | ||
period: 'int32', | ||
proposals: 'proposalArr', | ||
source: exports.CODEC.PKH, | ||
period: exports.CODEC.INT32, | ||
proposals: exports.CODEC.PROPOSAL_ARR, | ||
}; | ||
const RegisterGlobalConstantSchema = { | ||
source: 'pkh', | ||
fee: 'zarith', | ||
counter: 'zarith', | ||
gas_limit: 'zarith', | ||
storage_limit: 'zarith', | ||
value: 'value', | ||
source: exports.CODEC.PKH, | ||
fee: exports.CODEC.ZARITH, | ||
counter: exports.CODEC.ZARITH, | ||
gas_limit: exports.CODEC.ZARITH, | ||
storage_limit: exports.CODEC.ZARITH, | ||
value: exports.CODEC.VALUE, | ||
}; | ||
@@ -1001,3 +1017,3 @@ const operationEncoder = (encoders) => (operation) => { | ||
const valueToEncode = schema[key]; | ||
if (Array.isArray(valueToEncode)) { | ||
if (value && Array.isArray(valueToEncode)) { | ||
const encoder = encoders[valueToEncode[0]]; | ||
@@ -1062,2 +1078,4 @@ const values = value[key]; | ||
[exports.CODEC.VALUE]: valueParameterDecoder, | ||
[exports.CODEC.INT16]: int16Decoder, | ||
[exports.CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashDecoder, | ||
}; | ||
@@ -1093,3 +1111,5 @@ decoders[exports.CODEC.OPERATION] = operationDecoder(decoders); | ||
[exports.CODEC.ADDRESS]: addressEncoder, | ||
[exports.CODEC.VALUE]: valueParameterEncoder | ||
[exports.CODEC.VALUE]: valueParameterEncoder, | ||
[exports.CODEC.INT16]: int16Encoder, | ||
[exports.CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashEncoder, | ||
}; | ||
@@ -1109,96 +1129,34 @@ encoders[exports.CODEC.OPERATION] = operationEncoder(encoders); | ||
const blockPayloadHashEncoder = prefixEncoder(utils.Prefix.VH); | ||
const blockPayloadHashDecoder = prefixDecoder(utils.Prefix.VH); | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function __rest(s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
} | ||
const kindMappingNoEndorsement = __rest(kindMapping, ["0"]); | ||
const kindMappingProto12 = Object.assign(Object.assign({}, kindMappingNoEndorsement), { 0x15: 'endorsement' }); | ||
const kindMappingReverseProto12 = (() => { | ||
const result = {}; | ||
Object.keys(kindMappingProto12).forEach((key) => { | ||
const keyNum = typeof key === 'string' ? parseInt(key, 10) : key; | ||
result[kindMappingProto12[keyNum]] = pad(keyNum, 2); | ||
}); | ||
return result; | ||
})(); | ||
const EndorsementSchemaProto12 = { | ||
slot: 'int16', | ||
level: 'int32', | ||
round: 'int32', | ||
block_payload_hash: 'blockPayloadHash', | ||
const TransferTicketSchema = { | ||
source: exports.CODEC.PKH, | ||
fee: exports.CODEC.ZARITH, | ||
counter: exports.CODEC.ZARITH, | ||
gas_limit: exports.CODEC.ZARITH, | ||
storage_limit: exports.CODEC.ZARITH, | ||
ticket_contents: exports.CODEC.VALUE, | ||
ticket_ty: exports.CODEC.VALUE, | ||
ticket_ticketer: exports.CODEC.ADDRESS, | ||
ticket_amount: exports.CODEC.ZARITH, | ||
destination: exports.CODEC.ADDRESS, | ||
entrypoint: exports.CODEC.ENTRYPOINT, | ||
}; | ||
const operationEncoderProto12 = (encoders) => (operation) => { | ||
if (!(operation.kind in encoders) || !(operation.kind in kindMappingReverseProto12)) { | ||
throw new utils.InvalidOperationKindError(operation.kind); | ||
} | ||
return kindMappingReverseProto12[operation.kind] + encoders[operation.kind](operation); | ||
const TxRollupOriginationSchema = { | ||
source: exports.CODEC.PKH, | ||
fee: exports.CODEC.ZARITH, | ||
counter: exports.CODEC.ZARITH, | ||
gas_limit: exports.CODEC.ZARITH, | ||
storage_limit: exports.CODEC.ZARITH, | ||
tx_rollup_origination: exports.CODEC.TX_ROLLUP_ORIGINATION_PARAM, | ||
}; | ||
const operationDecoderProto12 = (decoders) => (value) => { | ||
const op = value.consume(1); | ||
const operationName = kindMappingProto12[op[0]]; | ||
if (operationName === undefined) { | ||
throw new UnsupportedOperationError(op[0].toString()); | ||
} | ||
const decodedObj = decoders[operationName](value); | ||
if (typeof decodedObj !== 'object') { | ||
throw new OperationDecodingError('Decoded invalid operation'); | ||
} | ||
return Object.assign({ kind: operationName }, decodedObj); | ||
const TxRollupSubmitBatchSchema = { | ||
source: exports.CODEC.PKH, | ||
fee: exports.CODEC.ZARITH, | ||
counter: exports.CODEC.ZARITH, | ||
gas_limit: exports.CODEC.ZARITH, | ||
storage_limit: exports.CODEC.ZARITH, | ||
rollup: exports.CODEC.TX_ROLLUP_ID, | ||
content: exports.CODEC.TX_ROLLUP_BATCH_CONTENT, | ||
burn_limit: exports.CODEC.BURN_LIMIT, | ||
}; | ||
const decodersProto12 = Object.assign(Object.assign({}, decoders), { [exports.CODEC.INT16]: int16Decoder, [exports.CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashDecoder }); | ||
decodersProto12[exports.CODEC.OPERATION] = operationDecoderProto12(decodersProto12); | ||
decodersProto12[exports.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder(decodersProto12)(ActivationSchema)(val); | ||
decodersProto12[exports.CODEC.OP_DELEGATION] = (val) => schemaDecoder(decodersProto12)(DelegationSchema)(val); | ||
decodersProto12[exports.CODEC.OP_TRANSACTION] = (val) => schemaDecoder(decodersProto12)(TransactionSchema)(val); | ||
decodersProto12[exports.CODEC.OP_ORIGINATION] = (val) => schemaDecoder(decodersProto12)(OriginationSchema)(val); | ||
decodersProto12[exports.CODEC.OP_BALLOT] = (val) => schemaDecoder(decodersProto12)(BallotSchema)(val); | ||
decodersProto12[exports.CODEC.OP_ENDORSEMENT] = (val) => schemaDecoder(decodersProto12)(EndorsementSchemaProto12)(val); | ||
decodersProto12[exports.CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder(decodersProto12)(SeedNonceRevelationSchema)(val); | ||
decodersProto12[exports.CODEC.OP_PROPOSALS] = (val) => schemaDecoder(decodersProto12)(ProposalsSchema)(val); | ||
decodersProto12[exports.CODEC.OP_REVEAL] = (val) => schemaDecoder(decodersProto12)(RevealSchema)(val); | ||
decodersProto12[exports.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder(decodersProto12)(RegisterGlobalConstantSchema)(val); | ||
decodersProto12[exports.CODEC.MANAGER] = schemaDecoder(decodersProto12)(ManagerOperationSchema); | ||
const encodersProto12 = Object.assign(Object.assign({}, encoders), { [exports.CODEC.INT16]: int16Encoder, [exports.CODEC.BLOCK_PAYLOAD_HASH]: blockPayloadHashEncoder }); | ||
encodersProto12[exports.CODEC.OPERATION] = operationEncoderProto12(encodersProto12); | ||
encodersProto12[exports.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder(encodersProto12)(ActivationSchema)(val); | ||
encodersProto12[exports.CODEC.OP_DELEGATION] = (val) => schemaEncoder(encodersProto12)(DelegationSchema)(val); | ||
encodersProto12[exports.CODEC.OP_TRANSACTION] = (val) => schemaEncoder(encodersProto12)(TransactionSchema)(val); | ||
encodersProto12[exports.CODEC.OP_ORIGINATION] = (val) => schemaEncoder(encodersProto12)(OriginationSchema)(val); | ||
encodersProto12[exports.CODEC.OP_BALLOT] = (val) => schemaEncoder(encodersProto12)(BallotSchema)(val); | ||
encodersProto12[exports.CODEC.OP_ENDORSEMENT] = (val) => schemaEncoder(encodersProto12)(EndorsementSchemaProto12)(val); | ||
encodersProto12[exports.CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder(encodersProto12)(SeedNonceRevelationSchema)(val); | ||
encodersProto12[exports.CODEC.OP_PROPOSALS] = (val) => schemaEncoder(encodersProto12)(ProposalsSchema)(val); | ||
encodersProto12[exports.CODEC.OP_REVEAL] = (val) => schemaEncoder(encodersProto12)(RevealSchema)(val); | ||
encodersProto12[exports.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder(encodersProto12)(RegisterGlobalConstantSchema)(val); | ||
encodersProto12[exports.CODEC.MANAGER] = schemaEncoder(encodersProto12)(ManagerOperationSchema); | ||
const OperationKindMapping = { | ||
@@ -1215,2 +1173,5 @@ activate_account: ActivationSchema, | ||
register_global_constant: RegisterGlobalConstantSchema, | ||
transfer_ticket: TransferTicketSchema, | ||
tx_rollup_origination: TxRollupOriginationSchema, | ||
tx_rollup_submit_batch: TxRollupSubmitBatchSchema, | ||
}; | ||
@@ -1452,2 +1413,10 @@ // Asymmetric difference: only account for things in arr2 that are not present in arr1, not vice versa | ||
}; | ||
const entrypointNameEncoderProto13 = (entrypoint) => { | ||
const value = { string: entrypoint }; | ||
return `${valueEncoderProto13(value).slice(2)}`; | ||
}; | ||
const entrypointNameDecoderProto13 = (val) => { | ||
const entry = extractRequiredLen(val); | ||
return Buffer.from(entry).toString('utf8'); | ||
}; | ||
const parametersEncoderProto13 = (val) => { | ||
@@ -1466,5 +1435,29 @@ if (!val || (val.entrypoint === 'default' && 'prim' in val.value && val.value.prim === 'Unit')) { | ||
}; | ||
const txRollupOriginationParamEncoderProto13 = (_value) => { | ||
return ''; | ||
}; | ||
const txRollupOriginationParamDecoderProto13 = (_val) => { | ||
return {}; | ||
}; | ||
const txRollupIdEncoderProto13 = prefixEncoder(utils.Prefix.TXR1); | ||
const txRollupIdDecoderProto13 = prefixDecoder(utils.Prefix.TXR1); | ||
const txRollupBatchContentEncoderProto13 = (value) => { | ||
return `${pad(value.length / 2)}${value}`; | ||
}; | ||
const txRollupBatchContentDecoderProto13 = (val) => { | ||
const value = extractRequiredLen(val); | ||
return Buffer.from(value).toString('hex'); | ||
}; | ||
const burnLimitEncoder = (val) => { | ||
return !val ? '00' : `ff${zarithEncoder(val)}`; | ||
}; | ||
const burnLimitDecoder = (value) => { | ||
const prefix = value.consume(1); | ||
if (Buffer.from(prefix).toString('hex') !== '00') { | ||
return zarithDecoder(value); | ||
} | ||
}; | ||
const encodersProto13 = Object.assign(Object.assign({}, encodersProto12), { [exports.CODEC.SCRIPT]: scriptEncoderProto13, [exports.CODEC.PARAMETERS]: parametersEncoderProto13, [exports.CODEC.VALUE]: valueParameterEncoderProto13 }); | ||
encodersProto13[exports.CODEC.OPERATION] = operationEncoderProto12(encodersProto13); | ||
const encodersProto13 = Object.assign(Object.assign({}, encoders), { [exports.CODEC.SCRIPT]: scriptEncoderProto13, [exports.CODEC.PARAMETERS]: parametersEncoderProto13, [exports.CODEC.VALUE]: valueParameterEncoderProto13, [exports.CODEC.ENTRYPOINT]: entrypointNameEncoderProto13, [exports.CODEC.TX_ROLLUP_ORIGINATION_PARAM]: txRollupOriginationParamEncoderProto13, [exports.CODEC.TX_ROLLUP_ID]: txRollupIdEncoderProto13, [exports.CODEC.TX_ROLLUP_BATCH_CONTENT]: txRollupBatchContentEncoderProto13, [exports.CODEC.BURN_LIMIT]: burnLimitEncoder }); | ||
encodersProto13[exports.CODEC.OPERATION] = operationEncoder(encodersProto13); | ||
encodersProto13[exports.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaEncoder(encodersProto13)(ActivationSchema)(val); | ||
@@ -1475,3 +1468,3 @@ encodersProto13[exports.CODEC.OP_DELEGATION] = (val) => schemaEncoder(encodersProto13)(DelegationSchema)(val); | ||
encodersProto13[exports.CODEC.OP_BALLOT] = (val) => schemaEncoder(encodersProto13)(BallotSchema)(val); | ||
encodersProto13[exports.CODEC.OP_ENDORSEMENT] = (val) => schemaEncoder(encodersProto13)(EndorsementSchemaProto12)(val); | ||
encodersProto13[exports.CODEC.OP_ENDORSEMENT] = (val) => schemaEncoder(encodersProto13)(EndorsementSchema)(val); | ||
encodersProto13[exports.CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaEncoder(encodersProto13)(SeedNonceRevelationSchema)(val); | ||
@@ -1481,6 +1474,9 @@ encodersProto13[exports.CODEC.OP_PROPOSALS] = (val) => schemaEncoder(encodersProto13)(ProposalsSchema)(val); | ||
encodersProto13[exports.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaEncoder(encodersProto13)(RegisterGlobalConstantSchema)(val); | ||
encodersProto13[exports.CODEC.OP_TRANSFER_TICKET] = (val) => schemaEncoder(encodersProto13)(TransferTicketSchema)(val); | ||
encodersProto13[exports.CODEC.OP_TX_ROLLUP_ORIGINATION] = (val) => schemaEncoder(encodersProto13)(TxRollupOriginationSchema)(val); | ||
encodersProto13[exports.CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val) => schemaEncoder(encodersProto13)(TxRollupSubmitBatchSchema)(val); | ||
encodersProto13[exports.CODEC.MANAGER] = schemaEncoder(encodersProto13)(ManagerOperationSchema); | ||
const decodersProto13 = Object.assign(Object.assign({}, decodersProto12), { [exports.CODEC.SCRIPT]: scriptDecoderProto13, [exports.CODEC.PARAMETERS]: parametersDecoderProto13, [exports.CODEC.VALUE]: valueParameterDecoderProto13 }); | ||
decodersProto13[exports.CODEC.OPERATION] = operationDecoderProto12(decodersProto13); | ||
const decodersProto13 = Object.assign(Object.assign({}, decoders), { [exports.CODEC.SCRIPT]: scriptDecoderProto13, [exports.CODEC.PARAMETERS]: parametersDecoderProto13, [exports.CODEC.VALUE]: valueParameterDecoderProto13, [exports.CODEC.ENTRYPOINT]: entrypointNameDecoderProto13, [exports.CODEC.TX_ROLLUP_ORIGINATION_PARAM]: txRollupOriginationParamDecoderProto13, [exports.CODEC.TX_ROLLUP_ID]: txRollupIdDecoderProto13, [exports.CODEC.TX_ROLLUP_BATCH_CONTENT]: txRollupBatchContentDecoderProto13, [exports.CODEC.BURN_LIMIT]: burnLimitDecoder }); | ||
decodersProto13[exports.CODEC.OPERATION] = operationDecoder(decodersProto13); | ||
decodersProto13[exports.CODEC.OP_ACTIVATE_ACCOUNT] = (val) => schemaDecoder(decodersProto13)(ActivationSchema)(val); | ||
@@ -1491,3 +1487,3 @@ decodersProto13[exports.CODEC.OP_DELEGATION] = (val) => schemaDecoder(decodersProto13)(DelegationSchema)(val); | ||
decodersProto13[exports.CODEC.OP_BALLOT] = (val) => schemaDecoder(decodersProto13)(BallotSchema)(val); | ||
decodersProto13[exports.CODEC.OP_ENDORSEMENT] = (val) => schemaDecoder(decodersProto13)(EndorsementSchemaProto12)(val); | ||
decodersProto13[exports.CODEC.OP_ENDORSEMENT] = (val) => schemaDecoder(decodersProto13)(EndorsementSchema)(val); | ||
decodersProto13[exports.CODEC.OP_SEED_NONCE_REVELATION] = (val) => schemaDecoder(decodersProto13)(SeedNonceRevelationSchema)(val); | ||
@@ -1497,2 +1493,5 @@ decodersProto13[exports.CODEC.OP_PROPOSALS] = (val) => schemaDecoder(decodersProto13)(ProposalsSchema)(val); | ||
decodersProto13[exports.CODEC.OP_REGISTER_GLOBAL_CONSTANT] = (val) => schemaDecoder(decodersProto13)(RegisterGlobalConstantSchema)(val); | ||
decodersProto13[exports.CODEC.OP_TRANSFER_TICKET] = (val) => schemaDecoder(decodersProto13)(TransferTicketSchema)(val); | ||
decodersProto13[exports.CODEC.OP_TX_ROLLUP_ORIGINATION] = (val) => schemaDecoder(decodersProto13)(TxRollupOriginationSchema)(val); | ||
decodersProto13[exports.CODEC.OP_TX_ROLLUP_SUBMIT_BATCH] = (val) => schemaDecoder(decodersProto13)(TxRollupSubmitBatchSchema)(val); | ||
decodersProto13[exports.CODEC.MANAGER] = schemaDecoder(decodersProto13)(ManagerOperationSchema); | ||
@@ -1502,4 +1501,4 @@ | ||
const VERSION = { | ||
"commitHash": "38da814ec2bb4e81c7ad5a45b6b183a4d0b8dc25", | ||
"version": "12.1.1" | ||
commitHash: '38da814ec2bb4e81c7ad5a45b6b183a4d0b8dc25', | ||
version: '12.1.1', | ||
}; | ||
@@ -1513,13 +1512,4 @@ | ||
function getCodec(codec, proto) { | ||
if (proto === exports.ProtocolsHash.Psithaca2) { | ||
if (proto === exports.ProtocolsHash.Psithaca2 || ProtoInferiorTo(proto, exports.ProtocolsHash.Psithaca2)) { | ||
return { | ||
encoder: encodersProto12[codec], | ||
decoder: (hex) => { | ||
const consumer = Uint8ArrayConsumer.fromHexString(hex); | ||
return decodersProto12[codec](consumer); | ||
}, | ||
}; | ||
} | ||
else if (ProtoInferiorTo(proto, exports.ProtocolsHash.Psithaca2)) { | ||
return { | ||
encoder: encoders[codec], | ||
@@ -1566,2 +1556,6 @@ decoder: (hex) => { | ||
} | ||
else if (content.kind === 'tx_rollup_submit_batch' && | ||
diff[0] === 'burn_limit') { | ||
continue; | ||
} | ||
else { | ||
@@ -1568,0 +1562,0 @@ throw new InvalidOperationSchemaError(`Missing properties: ${diff.join(', ').toString()}`); |
@@ -44,1 +44,3 @@ import { Prefix } from '@taquito/utils'; | ||
export declare const valueParameterDecoder: (val: Uint8ArrayConsumer) => string | number | object | undefined; | ||
export declare const blockPayloadHashEncoder: (str: string) => string; | ||
export declare const blockPayloadHashDecoder: (str: Uint8ArrayConsumer) => string; |
@@ -19,2 +19,6 @@ export declare const ENTRYPOINT_MAX_LENGTH = 31; | ||
ADDRESS = "address", | ||
VALUE = "value", | ||
MANAGER = "manager", | ||
BLOCK_PAYLOAD_HASH = "blockPayloadHash", | ||
ENTRYPOINT = "entrypoint", | ||
OPERATION = "operation", | ||
@@ -31,5 +35,9 @@ OP_ACTIVATE_ACCOUNT = "activate_account", | ||
OP_REGISTER_GLOBAL_CONSTANT = "register_global_constant", | ||
VALUE = "value", | ||
MANAGER = "manager", | ||
BLOCK_PAYLOAD_HASH = "blockPayloadHash" | ||
OP_TRANSFER_TICKET = "transfer_ticket", | ||
OP_TX_ROLLUP_ORIGINATION = "tx_rollup_origination", | ||
OP_TX_ROLLUP_SUBMIT_BATCH = "tx_rollup_submit_batch", | ||
BURN_LIMIT = "burn_limit", | ||
TX_ROLLUP_ORIGINATION_PARAM = "tx_rollup_origination_param", | ||
TX_ROLLUP_ID = "tx_rollup_id", | ||
TX_ROLLUP_BATCH_CONTENT = "tx_rollup_batch_content" | ||
} | ||
@@ -36,0 +44,0 @@ export declare const opMapping: { |
@@ -9,2 +9,4 @@ import { MichelsonValue } from '../michelson/codec'; | ||
export declare const entrypointEncoderProto13: (entrypoint: string) => string; | ||
export declare const entrypointNameEncoderProto13: (entrypoint: string) => string; | ||
export declare const entrypointNameDecoderProto13: (val: Uint8ArrayConsumer) => string; | ||
export declare const parametersEncoderProto13: (val: { | ||
@@ -15,1 +17,9 @@ entrypoint: string; | ||
export declare const valueParameterEncoderProto13: (value: MichelsonValue) => string; | ||
export declare const txRollupOriginationParamEncoderProto13: (_value: string) => string; | ||
export declare const txRollupOriginationParamDecoderProto13: (_val: Uint8ArrayConsumer) => {}; | ||
export declare const txRollupIdEncoderProto13: (str: string) => string; | ||
export declare const txRollupIdDecoderProto13: (str: Uint8ArrayConsumer) => string; | ||
export declare const txRollupBatchContentEncoderProto13: (value: string) => string; | ||
export declare const txRollupBatchContentDecoderProto13: (val: Uint8ArrayConsumer) => string; | ||
export declare const burnLimitEncoder: (val: string) => string; | ||
export declare const burnLimitDecoder: (value: Uint8ArrayConsumer) => string | undefined; |
import { Decoder } from '../decoder'; | ||
import { Uint8ArrayConsumer } from '../uint8array-consumer'; | ||
import { CODEC } from '../constants'; | ||
export declare const ManagerOperationSchema: { | ||
branch: string; | ||
contents: string[]; | ||
branch: CODEC; | ||
contents: CODEC[]; | ||
}; | ||
export declare const ActivationSchema: { | ||
pkh: string; | ||
secret: string; | ||
pkh: CODEC; | ||
secret: CODEC; | ||
}; | ||
export declare const RevealSchema: { | ||
source: string; | ||
fee: string; | ||
counter: string; | ||
gas_limit: string; | ||
storage_limit: string; | ||
public_key: string; | ||
source: CODEC; | ||
fee: CODEC; | ||
counter: CODEC; | ||
gas_limit: CODEC; | ||
storage_limit: CODEC; | ||
public_key: CODEC; | ||
}; | ||
export declare const DelegationSchema: { | ||
source: string; | ||
fee: string; | ||
counter: string; | ||
gas_limit: string; | ||
storage_limit: string; | ||
delegate: string; | ||
source: CODEC; | ||
fee: CODEC; | ||
counter: CODEC; | ||
gas_limit: CODEC; | ||
storage_limit: CODEC; | ||
delegate: CODEC; | ||
}; | ||
export declare const TransactionSchema: { | ||
source: string; | ||
fee: string; | ||
counter: string; | ||
gas_limit: string; | ||
storage_limit: string; | ||
amount: string; | ||
destination: string; | ||
parameters: string; | ||
source: CODEC; | ||
fee: CODEC; | ||
counter: CODEC; | ||
gas_limit: CODEC; | ||
storage_limit: CODEC; | ||
amount: CODEC; | ||
destination: CODEC; | ||
parameters: CODEC; | ||
}; | ||
export declare const OriginationSchema: { | ||
source: string; | ||
fee: string; | ||
counter: string; | ||
gas_limit: string; | ||
storage_limit: string; | ||
balance: string; | ||
delegate: string; | ||
script: string; | ||
source: CODEC; | ||
fee: CODEC; | ||
counter: CODEC; | ||
gas_limit: CODEC; | ||
storage_limit: CODEC; | ||
balance: CODEC; | ||
delegate: CODEC; | ||
script: CODEC; | ||
}; | ||
export declare const BallotSchema: { | ||
source: string; | ||
period: string; | ||
proposal: string; | ||
ballot: string; | ||
source: CODEC; | ||
period: CODEC; | ||
proposal: CODEC; | ||
ballot: CODEC; | ||
}; | ||
export declare const EndorsementSchema: { | ||
level: string; | ||
slot: CODEC; | ||
level: CODEC; | ||
round: CODEC; | ||
block_payload_hash: CODEC; | ||
}; | ||
export declare const SeedNonceRevelationSchema: { | ||
level: string; | ||
nonce: string; | ||
level: CODEC; | ||
nonce: CODEC; | ||
}; | ||
export declare const ProposalsSchema: { | ||
source: string; | ||
period: string; | ||
proposals: string; | ||
source: CODEC; | ||
period: CODEC; | ||
proposals: CODEC; | ||
}; | ||
export declare const RegisterGlobalConstantSchema: { | ||
source: string; | ||
fee: string; | ||
counter: string; | ||
gas_limit: string; | ||
storage_limit: string; | ||
value: string; | ||
source: CODEC; | ||
fee: CODEC; | ||
counter: CODEC; | ||
gas_limit: CODEC; | ||
storage_limit: CODEC; | ||
value: CODEC; | ||
}; | ||
@@ -83,9 +87,7 @@ export declare const operationEncoder: (encoders: { | ||
}; | ||
declare type Schema = Record<string, CODEC | CODEC[]>; | ||
export declare type Value = Record<keyof Schema, unknown[]>; | ||
export declare const schemaEncoder: (encoders: { | ||
[key: string]: (val: object) => string; | ||
}) => (schema: { | ||
[key: string]: string | string[]; | ||
}) => <T extends { | ||
[key: string]: any; | ||
}>(value: T) => string; | ||
}) => (schema: Schema) => (value: Value) => string; | ||
export declare const schemaDecoder: (decoders: { | ||
@@ -96,1 +98,2 @@ [key: string]: Decoder; | ||
}) => (value: Uint8ArrayConsumer) => {}; | ||
export {}; |
{ | ||
"name": "@taquito/local-forging", | ||
"version": "12.1.1", | ||
"version": "13.0.0-beta-RC.0", | ||
"description": "Provide local forging functionality to be with taquito", | ||
@@ -70,7 +70,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@taquito/utils": "^12.1.1", | ||
"@taquito/utils": "^13.0.0-beta-RC.0", | ||
"bignumber.js": "^9.0.2" | ||
}, | ||
"devDependencies": { | ||
"@taquito/rpc": "^12.1.1", | ||
"@taquito/rpc": "^13.0.0-beta-RC.0", | ||
"@types/bluebird": "^3.5.36", | ||
@@ -101,6 +101,5 @@ "@types/jest": "^26.0.23", | ||
"ts-toolbelt": "^9.6.0", | ||
"typedoc": "^0.20.36", | ||
"typescript": "~4.1.5" | ||
}, | ||
"gitHead": "e97d6f77d990f91b4e407f4e7b7f8f3785edb2ba" | ||
"gitHead": "d9034944abf0efab2478e61f35614b1aef397cec" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
27
5664
536403
68
2
1
+ Added@taquito/utils@13.0.1(transitive)
- Removed@taquito/utils@12.1.1(transitive)