Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

conseiljs

Package Overview
Dependencies
Maintainers
3
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

conseiljs - npm Package Compare versions

Comparing version 5.0.6-1 to 5.0.6-2

dist/chain/tezos/contracts/DexterTokenHelper.d.ts

4

dist/chain/tezos/contracts/CryptonomicNameServiceHelper.js

@@ -49,3 +49,3 @@ "use strict";

}
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, operationFee, freight, gas, 'commit', parameters, TezosTypes.TezosParameterFormat.Michelson);
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, operationFee, 6000, 300000, 'commit', parameters, TezosTypes.TezosParameterFormat.Michelson);
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID);

@@ -67,3 +67,3 @@ });

}
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, registrationFee, operationFee, freight, gas, 'registerName', parameters, TezosTypes.TezosParameterFormat.Michelson);
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, registrationFee, operationFee, 6000, 300000, 'registerName', parameters, TezosTypes.TezosParameterFormat.Michelson);
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID);

@@ -70,0 +70,0 @@ });

@@ -1,5 +0,1 @@

export declare const DefaultMichelsonKeywords: string[];
export declare const setKeywordList: (list: any) => void;
export declare const getCodeForKeyword: (word: any) => number;
export declare const getKeywordForCode: (code: any) => string;
interface NearleyToken {

@@ -6,0 +2,0 @@ value: any;

@@ -6,14 +6,5 @@ "use strict";

const bigInt = require("big-integer");
exports.DefaultMichelsonKeywords = ['"parameter"', '"storage"', '"code"', '"False"', '"Elt"', '"Left"', '"None"', '"Pair"', '"Right"', '"Some"', '"True"', '"Unit"', '"PACK"', '"UNPACK"', '"BLAKE2B"', '"SHA256"', '"SHA512"', '"ABS"', '"ADD"', '"AMOUNT"', '"AND"', '"BALANCE"', '"CAR"', '"CDR"', '"CHECK_SIGNATURE"', '"COMPARE"', '"CONCAT"', '"CONS"', '"CREATE_ACCOUNT"', '"CREATE_CONTRACT"', '"IMPLICIT_ACCOUNT"', '"DIP"', '"DROP"', '"DUP"', '"EDIV"', '"EMPTY_MAP"', '"EMPTY_SET"', '"EQ"', '"EXEC"', '"FAILWITH"', '"GE"', '"GET"', '"GT"', '"HASH_KEY"', '"IF"', '"IF_CONS"', '"IF_LEFT"', '"IF_NONE"', '"INT"', '"LAMBDA"', '"LE"', '"LEFT"', '"LOOP"', '"LSL"', '"LSR"', '"LT"', '"MAP"', '"MEM"', '"MUL"', '"NEG"', '"NEQ"', '"NIL"', '"NONE"', '"NOT"', '"NOW"', '"OR"', '"PAIR"', '"PUSH"', '"RIGHT"', '"SIZE"', '"SOME"', '"SOURCE"', '"SENDER"', '"SELF"', '"STEPS_TO_QUOTA"', '"SUB"', '"SWAP"', '"TRANSFER_TOKENS"', '"SET_DELEGATE"', '"UNIT"', '"UPDATE"', '"XOR"', '"ITER"', '"LOOP_LEFT"', '"ADDRESS"', '"CONTRACT"', '"ISNAT"', '"CAST"', '"RENAME"', '"bool"', '"contract"', '"int"', '"key"', '"key_hash"', '"lambda"', '"list"', '"map"', '"big_map"', '"nat"', '"option"', '"or"', '"pair"', '"set"', '"signature"', '"string"', '"bytes"', '"mutez"', '"timestamp"', '"unit"', '"operation"', '"address"', '"SLICE"', '"DIG"', '"DUG"', '"EMPTY_BIG_MAP"', '"APPLY"', '"chain_id"', '"CHAIN_ID"'];
let _languageKeywords = [...exports.DefaultMichelsonKeywords];
exports.setKeywordList = list => {
_languageKeywords = list;
};
exports.getCodeForKeyword = word => {
return _languageKeywords.indexOf(word);
};
exports.getKeywordForCode = code => {
return _languageKeywords[code];
};
const MichelineKeywords = ['"parameter"', '"storage"', '"code"', '"False"', '"Elt"', '"Left"', '"None"', '"Pair"', '"Right"', '"Some"', '"True"', '"Unit"', '"PACK"', '"UNPACK"', '"BLAKE2B"', '"SHA256"', '"SHA512"', '"ABS"', '"ADD"', '"AMOUNT"', '"AND"', '"BALANCE"', '"CAR"', '"CDR"', '"CHECK_SIGNATURE"', '"COMPARE"', '"CONCAT"', '"CONS"', '"CREATE_ACCOUNT"', '"CREATE_CONTRACT"', '"IMPLICIT_ACCOUNT"', '"DIP"', '"DROP"', '"DUP"', '"EDIV"', '"EMPTY_MAP"', '"EMPTY_SET"', '"EQ"', '"EXEC"', '"FAILWITH"', '"GE"', '"GET"', '"GT"', '"HASH_KEY"', '"IF"', '"IF_CONS"', '"IF_LEFT"', '"IF_NONE"', '"INT"', '"LAMBDA"', '"LE"', '"LEFT"', '"LOOP"', '"LSL"', '"LSR"', '"LT"', '"MAP"', '"MEM"', '"MUL"', '"NEG"', '"NEQ"', '"NIL"', '"NONE"', '"NOT"', '"NOW"', '"OR"', '"PAIR"', '"PUSH"', '"RIGHT"', '"SIZE"', '"SOME"', '"SOURCE"', '"SENDER"', '"SELF"', '"STEPS_TO_QUOTA"', '"SUB"', '"SWAP"', '"TRANSFER_TOKENS"', '"SET_DELEGATE"', '"UNIT"', '"UPDATE"', '"XOR"', '"ITER"', '"LOOP_LEFT"', '"ADDRESS"', '"CONTRACT"', '"ISNAT"', '"CAST"', '"RENAME"', '"bool"', '"contract"', '"int"', '"key"', '"key_hash"', '"lambda"', '"list"', '"map"', '"big_map"', '"nat"', '"option"', '"or"', '"pair"', '"set"', '"signature"', '"string"', '"bytes"', '"mutez"', '"timestamp"', '"unit"', '"operation"', '"address"', '"SLICE"', '"DIG"', '"DUG"', '"EMPTY_BIG_MAP"', '"APPLY"', '"chain_id"', '"CHAIN_ID"'];
const lexer = moo.compile({
keyword: MichelineKeywords,
lbrace: '{',

@@ -26,3 +17,3 @@ rbrace: '}',

_: /[ \t]+/,
quotedValue: /"(?:\\["\\]|[^\n"\\])*"/s
quotedValue: /\"[\S\s]*?\"/
});

@@ -39,3 +30,2 @@ const staticIntToHex = d => {

text = text.substring(1, text.length - 1);
text = text.replace(/\\"/g, '"');
const len = encodeLength(text.length);

@@ -115,3 +105,3 @@ text = text.split('').map(c => c.charCodeAt(0).toString(16)).join('');

const encodePrimitive = p => {
return ('00' + exports.getCodeForKeyword(p).toString(16)).slice(-2);
return ('00' + MichelineKeywords.indexOf(p).toString(16)).slice(-2);
};

@@ -180,3 +170,3 @@ const encodeLength = l => {

{ "name": "primBare$ebnf$1", "symbols": ["primBare$ebnf$1", (lexer.has("_") ? { type: "_" } : _)], "postprocess": (d) => d[0].concat([d[1]]) },
{ "name": "primBare", "symbols": [(lexer.has("lbrace") ? { type: "lbrace" } : lbrace), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"prim\"" }, "primBare$ebnf$1", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("quotedValue") ? { type: "quotedValue" } : quotedValue), (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": primBareToHex },
{ "name": "primBare", "symbols": [(lexer.has("lbrace") ? { type: "lbrace" } : lbrace), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"prim\"" }, "primBare$ebnf$1", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("keyword") ? { type: "keyword" } : keyword), (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": primBareToHex },
{ "name": "primArg$ebnf$1", "symbols": [(lexer.has("_") ? { type: "_" } : _)], "postprocess": id },

@@ -198,3 +188,3 @@ { "name": "primArg$ebnf$1", "symbols": [], "postprocess": () => null },

{ "name": "primArg$ebnf$3", "symbols": ["primArg$ebnf$3", "primArg$ebnf$3$subexpression$2"], "postprocess": (d) => d[0].concat([d[1]]) },
{ "name": "primArg", "symbols": [(lexer.has("lbrace") ? { type: "lbrace" } : lbrace), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"prim\"" }, "primArg$ebnf$1", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("quotedValue") ? { type: "quotedValue" } : quotedValue), (lexer.has("comma") ? { type: "comma" } : comma), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"args\"" }, "primArg$ebnf$2", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("lbracket") ? { type: "lbracket" } : lbracket), (lexer.has("_") ? { type: "_" } : _), "primArg$ebnf$3", (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbracket") ? { type: "rbracket" } : rbracket), (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": primArgToHex },
{ "name": "primArg", "symbols": [(lexer.has("lbrace") ? { type: "lbrace" } : lbrace), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"prim\"" }, "primArg$ebnf$1", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("keyword") ? { type: "keyword" } : keyword), (lexer.has("comma") ? { type: "comma" } : comma), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"args\"" }, "primArg$ebnf$2", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("lbracket") ? { type: "lbracket" } : lbracket), (lexer.has("_") ? { type: "_" } : _), "primArg$ebnf$3", (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbracket") ? { type: "rbracket" } : rbracket), (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": primArgToHex },
{ "name": "primAnn$ebnf$1", "symbols": [(lexer.has("_") ? { type: "_" } : _)], "postprocess": id },

@@ -216,3 +206,3 @@ { "name": "primAnn$ebnf$1", "symbols": [], "postprocess": () => null },

{ "name": "primAnn$ebnf$3", "symbols": ["primAnn$ebnf$3", "primAnn$ebnf$3$subexpression$2"], "postprocess": (d) => d[0].concat([d[1]]) },
{ "name": "primAnn", "symbols": [(lexer.has("lbrace") ? { type: "lbrace" } : lbrace), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"prim\"" }, "primAnn$ebnf$1", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("quotedValue") ? { type: "quotedValue" } : quotedValue), (lexer.has("comma") ? { type: "comma" } : comma), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"annots\"" }, "primAnn$ebnf$2", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("lbracket") ? { type: "lbracket" } : lbracket), (lexer.has("_") ? { type: "_" } : _), "primAnn$ebnf$3", (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbracket") ? { type: "rbracket" } : rbracket), (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": primAnnToHex },
{ "name": "primAnn", "symbols": [(lexer.has("lbrace") ? { type: "lbrace" } : lbrace), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"prim\"" }, "primAnn$ebnf$1", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("keyword") ? { type: "keyword" } : keyword), (lexer.has("comma") ? { type: "comma" } : comma), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"annots\"" }, "primAnn$ebnf$2", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("lbracket") ? { type: "lbracket" } : lbracket), (lexer.has("_") ? { type: "_" } : _), "primAnn$ebnf$3", (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbracket") ? { type: "rbracket" } : rbracket), (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": primAnnToHex },
{ "name": "primArgAnn$ebnf$1", "symbols": [(lexer.has("_") ? { type: "_" } : _)], "postprocess": id },

@@ -248,3 +238,3 @@ { "name": "primArgAnn$ebnf$1", "symbols": [], "postprocess": () => null },

{ "name": "primArgAnn$ebnf$5", "symbols": ["primArgAnn$ebnf$5", "primArgAnn$ebnf$5$subexpression$2"], "postprocess": (d) => d[0].concat([d[1]]) },
{ "name": "primArgAnn", "symbols": [(lexer.has("lbrace") ? { type: "lbrace" } : lbrace), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"prim\"" }, "primArgAnn$ebnf$1", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("quotedValue") ? { type: "quotedValue" } : quotedValue), (lexer.has("comma") ? { type: "comma" } : comma), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"args\"" }, "primArgAnn$ebnf$2", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("lbracket") ? { type: "lbracket" } : lbracket), (lexer.has("_") ? { type: "_" } : _), "primArgAnn$ebnf$3", (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbracket") ? { type: "rbracket" } : rbracket), (lexer.has("comma") ? { type: "comma" } : comma), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"annots\"" }, "primArgAnn$ebnf$4", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("lbracket") ? { type: "lbracket" } : lbracket), (lexer.has("_") ? { type: "_" } : _), "primArgAnn$ebnf$5", (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbracket") ? { type: "rbracket" } : rbracket), (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": primArgAnnToHex },
{ "name": "primArgAnn", "symbols": [(lexer.has("lbrace") ? { type: "lbrace" } : lbrace), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"prim\"" }, "primArgAnn$ebnf$1", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("keyword") ? { type: "keyword" } : keyword), (lexer.has("comma") ? { type: "comma" } : comma), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"args\"" }, "primArgAnn$ebnf$2", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("lbracket") ? { type: "lbracket" } : lbracket), (lexer.has("_") ? { type: "_" } : _), "primArgAnn$ebnf$3", (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbracket") ? { type: "rbracket" } : rbracket), (lexer.has("comma") ? { type: "comma" } : comma), (lexer.has("_") ? { type: "_" } : _), { "literal": "\"annots\"" }, "primArgAnn$ebnf$4", (lexer.has("colon") ? { type: "colon" } : colon), (lexer.has("_") ? { type: "_" } : _), (lexer.has("lbracket") ? { type: "lbracket" } : lbracket), (lexer.has("_") ? { type: "_" } : _), "primArgAnn$ebnf$5", (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbracket") ? { type: "rbracket" } : rbracket), (lexer.has("_") ? { type: "_" } : _), (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": primArgAnnToHex },
{ "name": "primAny", "symbols": ["primBare"], "postprocess": id },

@@ -251,0 +241,0 @@ { "name": "primAny", "symbols": ["primArg"], "postprocess": id },

@@ -55,3 +55,3 @@ "use strict";

word: /[a-zA-Z_0-9]+/,
string: /"(?:\\["\\]|[^\n"\\])*"/s
string: /"(?:\\["\\]|[^\n"\\])*"/
});

@@ -329,3 +329,3 @@ const checkC_R = c_r => {

if (checkKeyword(word)) {
return expandKeyword(word, null);
return [expandKeyword(word, null)];
}

@@ -332,0 +332,0 @@ else {

@@ -8,4 +8,2 @@ export declare namespace TezosLanguageUtil {

export function translateMichelineToHex(code: string): string;
export function overrideKeywordList(list: string[]): void;
export function restoreKeywordList(): void;
export function preProcessMichelsonScript(code: string): string[];

@@ -12,0 +10,0 @@ export function normalizeMichelineWhiteSpace(fragment: string): string;

@@ -14,2 +14,3 @@ "use strict";

const TezosMessageUtil_1 = require("./TezosMessageUtil");
const MichelineKeywords = ['"parameter"', '"storage"', '"code"', '"False"', '"Elt"', '"Left"', '"None"', '"Pair"', '"Right"', '"Some"', '"True"', '"Unit"', '"PACK"', '"UNPACK"', '"BLAKE2B"', '"SHA256"', '"SHA512"', '"ABS"', '"ADD"', '"AMOUNT"', '"AND"', '"BALANCE"', '"CAR"', '"CDR"', '"CHECK_SIGNATURE"', '"COMPARE"', '"CONCAT"', '"CONS"', '"CREATE_ACCOUNT"', '"CREATE_CONTRACT"', '"IMPLICIT_ACCOUNT"', '"DIP"', '"DROP"', '"DUP"', '"EDIV"', '"EMPTY_MAP"', '"EMPTY_SET"', '"EQ"', '"EXEC"', '"FAILWITH"', '"GE"', '"GET"', '"GT"', '"HASH_KEY"', '"IF"', '"IF_CONS"', '"IF_LEFT"', '"IF_NONE"', '"INT"', '"LAMBDA"', '"LE"', '"LEFT"', '"LOOP"', '"LSL"', '"LSR"', '"LT"', '"MAP"', '"MEM"', '"MUL"', '"NEG"', '"NEQ"', '"NIL"', '"NONE"', '"NOT"', '"NOW"', '"OR"', '"PAIR"', '"PUSH"', '"RIGHT"', '"SIZE"', '"SOME"', '"SOURCE"', '"SENDER"', '"SELF"', '"STEPS_TO_QUOTA"', '"SUB"', '"SWAP"', '"TRANSFER_TOKENS"', '"SET_DELEGATE"', '"UNIT"', '"UPDATE"', '"XOR"', '"ITER"', '"LOOP_LEFT"', '"ADDRESS"', '"CONTRACT"', '"ISNAT"', '"CAST"', '"RENAME"', '"bool"', '"contract"', '"int"', '"key"', '"key_hash"', '"lambda"', '"list"', '"map"', '"big_map"', '"nat"', '"option"', '"or"', '"pair"', '"set"', '"signature"', '"string"', '"bytes"', '"mutez"', '"timestamp"', '"unit"', '"operation"', '"address"', '"SLICE"', '"DEFAULT_ACCOUNT"', '"tez"'];
var TezosLanguageUtil;

@@ -25,128 +26,122 @@ (function (TezosLanguageUtil) {

offset += 2;
try {
switch (fieldType) {
case '00': {
const value = TezosMessageUtil_1.TezosMessageUtils.findInt(hex.substring(offset), 0, true);
code += `{ "int": "${value.value}" }`;
offset += value.length;
break;
}
case '01': {
const stringEnvelope = michelineHexToString(hex.substring(offset));
code += `{ "string": "${stringEnvelope.code}" }`;
offset += stringEnvelope.consumed;
break;
}
case '02': {
const length = parseInt(hex.substring(offset, offset + 8), 16);
offset += 8;
let buffer = [];
let consumed = 0;
while (consumed < length) {
let envelope = hexToMicheline(hex.substring(offset));
buffer.push(envelope.code);
consumed += envelope.consumed / 2;
offset += envelope.consumed;
}
if (length === 0) {
code += '[]';
}
else {
code += `[ ${buffer.join(', ')} ]`;
}
break;
}
case '03': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)} }`;
offset += 2;
break;
}
case '04': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
const annEnvelope = hexToAnnotations(hex.substring(offset));
code += `"annots": [ ${annEnvelope.code} ] }`;
offset += annEnvelope.consumed;
break;
}
case '05': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
const envelope = hexToMicheline(hex.substring(offset));
code += `"args": [ ${envelope.code} ] }`;
offset += envelope.consumed;
break;
}
case '06': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
const args = hexToMicheline(hex.substring(offset));
code += `"args": [ ${args.code} ], `;
offset += args.consumed;
const anns = hexToAnnotations(hex.substring(offset));
code += `"annots": [ ${anns.code} ] }`;
offset += anns.consumed;
break;
}
case '07': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
let buffer = [];
switch (fieldType) {
case '00': {
const value = TezosMessageUtil_1.TezosMessageUtils.findInt(hex.substring(offset), 0, true);
code += `{ "int": "${value.value}" }`;
offset += value.length;
break;
}
case '01': {
const stringEnvelope = michelineHexToString(hex.substring(offset));
code += `{ "string": "${stringEnvelope.code}" }`;
offset += stringEnvelope.consumed;
break;
}
case '02': {
const length = parseInt(hex.substring(offset, offset + 8), 16);
offset += 8;
let buffer = [];
let consumed = 0;
while (consumed < length) {
let envelope = hexToMicheline(hex.substring(offset));
buffer.push(envelope.code);
consumed += envelope.consumed / 2;
offset += envelope.consumed;
envelope = hexToMicheline(hex.substring(offset));
buffer.push(envelope.code);
offset += envelope.consumed;
code += `"args": [ ${buffer.join(', ')} ] }`;
break;
}
case '08': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
const arg0 = hexToMicheline(hex.substring(offset));
offset += arg0.consumed;
const arg1 = hexToMicheline(hex.substring(offset));
offset += arg1.consumed;
code += `"args": [ ${arg0.code}, ${arg1.code} ], `;
const anns = hexToAnnotations(hex.substring(offset));
code += `"annots": [ ${anns.code} ] }`;
offset += anns.consumed;
break;
if (length === 0) {
code += '[]';
}
case '09': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
let envelope = hexToMicheline('02' + hex.substring(offset));
code += `"args": ${envelope.code}`;
offset += envelope.consumed - 2;
if (hex.substring(offset, offset + 8) !== '00000000') {
const annEnvelope = hexToAnnotations(hex.substring(offset));
if (annEnvelope.code.length > 2) {
code += `, "annots": [ ${annEnvelope.code} ] }`;
}
offset += annEnvelope.consumed;
else {
code += `[ ${buffer.join(', ')} ]`;
}
break;
}
case '03': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)} }`;
offset += 2;
break;
}
case '04': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
const annEnvelope = michelineHexToAnnotations(hex.substring(offset));
code += `"annots": [ ${annEnvelope.code} ] }`;
offset += annEnvelope.consumed;
break;
}
case '05': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
const envelope = hexToMicheline(hex.substring(offset));
code += `"args": [ ${envelope.code} ] }`;
offset += envelope.consumed;
break;
}
case '06': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
const args = hexToMicheline(hex.substring(offset));
code += `"args": [ ${args.code} ], `;
offset += args.consumed;
const anns = michelineHexToAnnotations(hex.substring(offset));
code += `"annots": [ ${anns.code} ] }`;
offset += anns.consumed;
break;
}
case '07': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
let buffer = [];
let envelope = hexToMicheline(hex.substring(offset));
buffer.push(envelope.code);
offset += envelope.consumed;
envelope = hexToMicheline(hex.substring(offset));
buffer.push(envelope.code);
offset += envelope.consumed;
code += `"args": [ ${buffer.join(', ')} ] }`;
break;
}
case '08': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
const arg0 = hexToMicheline(hex.substring(offset));
offset += arg0.consumed;
const arg1 = hexToMicheline(hex.substring(offset));
offset += arg1.consumed;
code += `"args": [ ${arg0.code}, ${arg1.code} ], `;
const anns = michelineHexToAnnotations(hex.substring(offset));
code += `"annots": [ ${anns.code} ] }`;
offset += anns.consumed;
break;
}
case '09': {
code += `{ "prim": ${hexToMichelineKeyword(hex, offset)}, `;
offset += 2;
let envelope = hexToMicheline('02' + hex.substring(offset));
code += `"args": ${envelope.code}`;
offset += envelope.consumed - 2;
if (hex.substring(offset, offset + 8) !== '00000000') {
const annEnvelope = michelineHexToAnnotations(hex.substring(offset));
if (annEnvelope.code.length > 2) {
code += `, "annots": [ ${annEnvelope.code} ] }`;
}
else {
code += ' }';
offset += 8;
}
break;
offset += annEnvelope.consumed;
}
case '0a': {
const length = parseInt(hex.substring(offset, offset + 8), 16);
else {
code += ' }';
offset += 8;
code += `{ "bytes": "${hex.substring(offset, offset + length * 2)}" }`;
offset += length * 2;
break;
}
default: {
throw new Error(`Unknown Micheline field type '${fieldType}' at offset ${offset} of '${hex}'`);
}
break;
}
case '0a': {
const length = parseInt(hex.substring(offset, offset + 8), 16);
offset += 8;
code += `{ "bytes": "${hex.substring(offset, offset + length * 2)}" }`;
offset += length * 2;
break;
}
default: {
throw new Error(`Unknown Micheline field type '${fieldType}'`);
}
}
catch (err) {
const m = `Nested hex parsing error (${err.message}) after: ${hex}, ${offset}, ${code}`;
throw new Error(m);
}
return { code: code, consumed: offset };

@@ -163,128 +158,122 @@ }

offset += 2;
try {
switch (fieldType) {
case '00': {
const value = TezosMessageUtil_1.TezosMessageUtils.findInt(hex.substring(offset), 0, true);
code += `${value.value}`;
offset += value.length;
break;
}
case '01': {
const stringEnvelope = michelineHexToString(hex.substring(offset));
code += `"${stringEnvelope.code}"`;
offset += stringEnvelope.consumed;
break;
}
case '02': {
const length = parseInt(hex.substring(offset, offset + 8), 16);
offset += 8;
let buffer = [];
let consumed = 0;
while (consumed < length) {
let envelope = hexToMichelson(hex.substring(offset));
buffer.push(envelope.code);
consumed += envelope.consumed / 2;
offset += envelope.consumed;
}
if (length === 0) {
code += '[]';
}
else {
code += `[ ${buffer.join(' ')} ]`;
}
break;
}
case '03': {
code += `( ${hexToMichelsonKeyword(hex, offset)} )`;
offset += 2;
break;
}
case '04': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
const annEnvelope = hexToAnnotations(hex.substring(offset), false);
code += ` ${annEnvelope.code} )`;
offset += annEnvelope.consumed;
break;
}
case '05': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
const envelope = hexToMichelson(hex.substring(offset));
code += ` ${envelope.code} )`;
offset += envelope.consumed;
break;
}
case '06': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
const args = hexToMichelson(hex.substring(offset));
code += ` ${args.code} `;
offset += args.consumed;
const anns = hexToAnnotations(hex.substring(offset), false);
code += ` ${anns.code} )`;
offset += anns.consumed;
break;
}
case '07': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
let buffer = [];
switch (fieldType) {
case '00': {
const value = TezosMessageUtil_1.TezosMessageUtils.findInt(hex.substring(offset), 0, true);
code += ` ${value.value} `;
offset += value.length;
break;
}
case '01': {
const stringEnvelope = michelineHexToString(hex.substring(offset));
code += ` "${stringEnvelope.code}" `;
offset += stringEnvelope.consumed;
break;
}
case '02': {
const length = parseInt(hex.substring(offset, offset + 8), 16);
offset += 8;
let buffer = [];
let consumed = 0;
while (consumed < length) {
let envelope = hexToMichelson(hex.substring(offset));
buffer.push(envelope.code);
consumed += envelope.consumed / 2;
offset += envelope.consumed;
envelope = hexToMichelson(hex.substring(offset));
buffer.push(envelope.code);
offset += envelope.consumed;
code += ` ${buffer.join(' ')} )`;
break;
}
case '08': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
const arg0 = hexToMichelson(hex.substring(offset));
offset += arg0.consumed;
const arg1 = hexToMichelson(hex.substring(offset));
offset += arg1.consumed;
code += ` ${arg0.code} ${arg1.code} `;
const anns = hexToAnnotations(hex.substring(offset), false);
code += ` ${anns.code} )`;
offset += anns.consumed;
break;
if (length === 0) {
code += '[]';
}
case '09': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
let envelope = hexToMichelson('02' + hex.substring(offset));
code += `"args": ${envelope.code}`;
offset += envelope.consumed - 2;
if (hex.substring(offset, offset + 8) !== '00000000') {
const annEnvelope = hexToAnnotations(hex.substring(offset), false);
if (annEnvelope.code.length > 2) {
code += ` ${annEnvelope.code} )`;
}
offset += annEnvelope.consumed;
else {
code += `[ ${buffer.join(' ')} ]`;
}
break;
}
case '03': {
code += `( ${hexToMichelsonKeyword(hex, offset)} )`;
offset += 2;
break;
}
case '04': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
const annEnvelope = michelineHexToAnnotations(hex.substring(offset));
code += ` ${annEnvelope.code} )`;
offset += annEnvelope.consumed;
break;
}
case '05': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
const envelope = hexToMichelson(hex.substring(offset));
code += ` ${envelope.code} )`;
offset += envelope.consumed;
break;
}
case '06': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
const args = hexToMichelson(hex.substring(offset));
code += ` ${args.code} `;
offset += args.consumed;
const anns = michelineHexToAnnotations(hex.substring(offset));
code += ` ${anns.code} )`;
offset += anns.consumed;
break;
}
case '07': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
let buffer = [];
let envelope = hexToMichelson(hex.substring(offset));
buffer.push(envelope.code);
offset += envelope.consumed;
envelope = hexToMichelson(hex.substring(offset));
buffer.push(envelope.code);
offset += envelope.consumed;
code += ` ${buffer.join(' ')} )`;
break;
}
case '08': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
const arg0 = hexToMichelson(hex.substring(offset));
offset += arg0.consumed;
const arg1 = hexToMichelson(hex.substring(offset));
offset += arg1.consumed;
code += ` ${arg0.code} ${arg1.code} `;
const anns = michelineHexToAnnotations(hex.substring(offset));
code += ` ${anns.code} )`;
offset += anns.consumed;
break;
}
case '09': {
code += `( ${hexToMichelsonKeyword(hex, offset)} `;
offset += 2;
let envelope = hexToMichelson('02' + hex.substring(offset));
code += `"args": ${envelope.code}`;
offset += envelope.consumed - 2;
if (hex.substring(offset, offset + 8) !== '00000000') {
const annEnvelope = michelineHexToAnnotations(hex.substring(offset));
if (annEnvelope.code.length > 2) {
code += ` ${annEnvelope.code} )`;
}
else {
code += ' )';
offset += 8;
}
break;
offset += annEnvelope.consumed;
}
case '0a': {
const length = parseInt(hex.substring(offset, offset + 8), 16);
else {
code += ' )';
offset += 8;
code += `0x${hex.substring(offset, offset + length * 2)}`;
offset += length * 2;
break;
}
default: {
throw new Error(`Unknown Michelson field type '${fieldType}' at offset ${offset} of '${hex}'`);
}
break;
}
case '0a': {
const length = parseInt(hex.substring(offset, offset + 8), 16);
offset += 8;
code += ` 0x${hex.substring(offset, offset + length * 2)} `;
offset += length * 2;
break;
}
default: {
throw new Error(`Unknown Micheline field type '${fieldType}'`);
}
}
catch (err) {
const m = `Nested hex parsing error (${err.message}) after: ${hex}, ${offset}, ${code}`;
throw new Error(m);
}
return { code: code, consumed: offset };

@@ -307,3 +296,3 @@ }

.map(p => translateMichelineToHex(p))
.reduce((m, p) => { return m + ('0000000' + (p.length / 2).toString(16)).slice(-8) + p; }, '');
.reduce((m, p) => { return m += ('0000000' + (p.length / 2).toString(16)).slice(-8) + p; }, '');
}

@@ -345,22 +334,11 @@ TezosLanguageUtil.translateMichelsonToHex = translateMichelsonToHex;

function hexToMichelineKeyword(hex, offset) {
return Micheline.getKeywordForCode(parseInt(hex.substring(offset, offset + 2), 16));
return MichelineKeywords[parseInt(hex.substring(offset, offset + 2), 16)];
}
function hexToMichelsonKeyword(hex, offset) {
return hexToMichelineKeyword(hex, offset).slice(1, -1);
return MichelineKeywords[parseInt(hex.substring(offset, offset + 2), 16)].slice(1, -1);
}
function hexToAnnotations(hex, quote = true) {
function michelineHexToAnnotations(hex) {
const stringEnvelope = michelineHexToString(hex);
return {
code: (quote ? stringEnvelope.code.split(' ').map(s => `"${s}"`).join(', ') : stringEnvelope.code),
consumed: stringEnvelope.consumed
};
return { code: stringEnvelope.code.split(' ').map(s => `"${s}"`).join(', '), consumed: stringEnvelope.consumed };
}
function overrideKeywordList(list) {
Micheline.setKeywordList(list);
}
TezosLanguageUtil.overrideKeywordList = overrideKeywordList;
function restoreKeywordList() {
Micheline.setKeywordList(Micheline.DefaultMichelsonKeywords);
}
TezosLanguageUtil.restoreKeywordList = restoreKeywordList;
function preProcessMichelsonScript(code) {

@@ -367,0 +345,0 @@ let sections = new Map();

@@ -364,3 +364,8 @@ "use strict";

}
hex += ('0000000' + (result.length / 2).toString(16)).slice(-8) + result;
if (result === '030b') {
hex += '00';
}
else {
hex += ('0000000' + (result.length / 2).toString(16)).slice(-8) + result;
}
}

@@ -498,3 +503,3 @@ }

.map(p => TezosLanguageUtil_1.TezosLanguageUtil.translateMichelineToHex(p))
.reduce((m, p) => { return m + ('0000000' + (p.length / 2).toString(16)).slice(-8) + p; }, '');
.reduce((m, p) => { return m += ('0000000' + (p.length / 2).toString(16)).slice(-8) + p; }, '');
}

@@ -501,0 +506,0 @@ return hex;

@@ -37,3 +37,2 @@ /// <reference types="node" />

function simpleHash(payload: Buffer, length: number): Buffer;
function calculateContractAddress(operationHash: string, index: number): string;
}

@@ -66,3 +66,3 @@ "use strict";

}
return arr.map(w => ('0' + w.toString(16)).slice(-2)).join('');
return arr.map(v => ('0' + v.toString(16)).slice(-2)).join('');
}

@@ -91,3 +91,3 @@ TezosMessageUtils.writeSignedInt = writeSignedInt;

function findInt(hex, offset, signed = false) {
let buffer = '';
let buffer = "";
let i = 0;

@@ -100,3 +100,3 @@ while (offset + i * 2 < hex.length) {

i += 1;
if (parseInt(part, 16) < 128) {
if (parseInt(part, 16) < 127) {
break;

@@ -241,8 +241,2 @@ }

}
else if (hint === 'sppk') {
return readPublicKey(`01${key.toString('hex')}`);
}
else if (hint === 'p2pk') {
return readPublicKey(`02${key.toString('hex')}`);
}
else {

@@ -254,3 +248,3 @@ throw new Error(`Unrecognized key hint, '${hint}'`);

function writeKeyWithHint(key, hint) {
if (hint === 'edsk' || hint === 'edpk' || hint === 'sppk' || hint === 'p2pk') {
if (hint === 'edsk' || hint === 'edpk') {
return bs58check_1.default.decode(key).slice(4);

@@ -448,27 +442,3 @@ }

}
function calculateContractAddress(operationHash, index) {
const decoded = bs58check_1.default.decode(operationHash).slice(2);
let decodedAndOperationPrefix = [];
for (let i = 0; i < decoded.length; i++) {
decodedAndOperationPrefix.push(decoded[i]);
}
decodedAndOperationPrefix = decodedAndOperationPrefix.concat([
(index & 0xff000000) >> 24,
(index & 0x00ff0000) >> 16,
(index & 0x0000ff00) >> 8,
index & 0x000000ff,
]);
const hash = blakejs.blake2b(new Uint8Array(decodedAndOperationPrefix), null, 20);
const smartContractAddressPrefix = new Uint8Array([2, 90, 121]);
const prefixedBytes = mergeBytes(smartContractAddressPrefix, hash);
return bs58check_1.default.encode(prefixedBytes);
}
TezosMessageUtils.calculateContractAddress = calculateContractAddress;
function mergeBytes(a, b) {
const merged = new Uint8Array(a.length + b.length);
merged.set(a);
merged.set(b, a.length);
return merged;
}
})(TezosMessageUtils = exports.TezosMessageUtils || (exports.TezosMessageUtils = {}));
//# sourceMappingURL=TezosMessageUtil.js.map
import * as TezosRPCTypes from '../../types/tezos/TezosRPCResponseTypes';
export declare namespace TezosNodeReader {
function getDelegate(server: string, accountHash: string): Promise<string | undefined>;
function getBlock(server: string, hash?: string, chainid?: string): Promise<TezosRPCTypes.TezosBlock>;

@@ -5,0 +4,0 @@ function getBlockHead(server: string): Promise<TezosRPCTypes.TezosBlock>;

@@ -39,9 +39,2 @@ "use strict";

}
function getDelegate(server, accountHash) {
return __awaiter(this, void 0, void 0, function* () {
const contractData = yield getAccountForBlock(server, 'head', accountHash);
return contractData.delegate;
});
}
TezosNodeReader.getDelegate = getDelegate;
function getBlock(server, hash = 'head', chainid = 'main') {

@@ -48,0 +41,0 @@ return performGetRequest(server, `chains/${chainid}/blocks/${hash}`).then(json => { return json; });

@@ -31,8 +31,6 @@ import { KeyStore, Signer } from '../../types/ExternalInterfaces';

}>;
function estimateOperation(server: string, chainid: string, ...operations: TezosP2PMessageTypes.Operation[]): Promise<{
function estimateOperation(server: string, chainid: string, operation: TezosP2PMessageTypes.Operation): Promise<{
gas: number;
storageCost: number;
}>;
function dryRunOperation(server: string, chainid: string, ...operations: TezosP2PMessageTypes.Operation[]): Promise<Response>;
function parseRPCError(response: string): void;
}

@@ -25,3 +25,2 @@ "use strict";

const TezosConstants_1 = require("../../types/tezos/TezosConstants");
const ErrorTypes_1 = require("../../types/ErrorTypes");
const TezosNodeReader_1 = require("./TezosNodeReader");

@@ -46,6 +45,6 @@ const TezosMessageCodec_1 = require("./TezosMessageCodec");

function forgeOperations(branch, operations) {
log.debug(`TezosNodeWriter.forgeOperations: ${JSON.stringify(operations)}`);
log.debug('TezosNodeWriter.forgeOperations:');
log.debug(JSON.stringify(operations));
let encoded = TezosMessageUtil_1.TezosMessageUtils.writeBranch(branch);
operations.forEach(m => encoded += TezosMessageCodec_1.TezosMessageCodec.encodeOperation(m));
log.debug(`TezosNodeWriter.forgeOperations: ${encoded}`);
return encoded;

@@ -132,4 +131,3 @@ }

const blockHead = yield TezosNodeReader_1.TezosNodeReader.getBlockAtOffset(server, offset);
const blockHash = blockHead.hash.slice(0, 51);
const forgedOperationGroup = forgeOperations(blockHash, operations);
const forgedOperationGroup = forgeOperations(blockHead.hash, operations);
const opSignature = yield signer.signOperation(Buffer.from(TezosConstants_1.TezosConstants.OperationGroupWatermark + forgedOperationGroup, 'hex'));

@@ -139,3 +137,3 @@ const signedOpGroup = Buffer.concat([Buffer.from(forgedOperationGroup, 'hex'), opSignature]);

const opPair = { bytes: signedOpGroup, signature: base58signature };
const appliedOp = yield preapplyOperation(server, blockHash, blockHead.protocol, operations, opPair);
const appliedOp = yield preapplyOperation(server, blockHead.hash, blockHead.protocol, operations, opPair);
const injectedOperation = yield injectOperation(server, opPair);

@@ -350,5 +348,11 @@ return { results: appliedOp[0], operationGroupID: injectedOperation };

TezosNodeWriter.testContractDeployOperation = testContractDeployOperation;
function estimateOperation(server, chainid, ...operations) {
function estimateOperation(server, chainid, operation) {
return __awaiter(this, void 0, void 0, function* () {
const responseJSON = yield dryRunOperation(server, chainid, ...operations);
const fake_signature = 'edsigu6xFLH2NpJ1VcYshpjW99Yc1TAL1m2XBqJyXrxcZQgBMo8sszw2zm626yjpA3pWMhjpsahLrWdmvX9cqhd4ZEUchuBuFYy';
const fake_chainid = 'NetXdQprcVkpaWU';
const fake_branch = 'BL94i2ShahPx3BoNs6tJdXDdGeoJ9ukwujUA2P8WJwULYNdimmq';
const response = yield performPostRequest(server, `chains/${chainid}/blocks/head/helpers/scripts/run_operation`, { chain_id: fake_chainid, operation: { branch: fake_branch, contents: [operation], signature: fake_signature } });
const responseText = yield response.text();
parseRPCError(responseText);
const responseJSON = JSON.parse(responseText);
let gas = 0;

@@ -376,15 +380,2 @@ let storageCost = 0;

TezosNodeWriter.estimateOperation = estimateOperation;
function dryRunOperation(server, chainid, ...operations) {
return __awaiter(this, void 0, void 0, function* () {
const fake_signature = 'edsigu6xFLH2NpJ1VcYshpjW99Yc1TAL1m2XBqJyXrxcZQgBMo8sszw2zm626yjpA3pWMhjpsahLrWdmvX9cqhd4ZEUchuBuFYy';
const fake_chainid = 'NetXdQprcVkpaWU';
const fake_branch = 'BL94i2ShahPx3BoNs6tJdXDdGeoJ9ukwujUA2P8WJwULYNdimmq';
const response = yield performPostRequest(server, `chains/${chainid}/blocks/head/helpers/scripts/run_operation`, { chain_id: fake_chainid, operation: { branch: fake_branch, contents: operations, signature: fake_signature } });
const responseText = yield response.text();
parseRPCError(responseText);
const responseJSON = JSON.parse(responseText);
return responseJSON;
});
}
TezosNodeWriter.dryRunOperation = dryRunOperation;
function parseRPCError(response) {

@@ -396,3 +387,3 @@ let errors = '';

if ('kind' in arr[0]) {
errors = arr.map(e => `(${e.kind}: ${e.id})`).join(', ');
errors = arr.map(e => `(${e.kind}: ${e.id})`).join('');
}

@@ -404,7 +395,5 @@ else if (arr.length === 1 && arr[0].contents.length === 1 && arr[0].contents[0].kind === 'activate_account') {

.map(o => o.map(c => c.metadata.operation_result)
.concat(o.flatMap(c => c.metadata.internal_operation_results).filter(c => !!c).map(c => c.result))
.map(r => parseRPCOperationResult(r))
.filter(i => i.length > 0)
.join(', '))
.join(', ');
.filter(r => r.status !== 'applied')
.map(r => `${r.status}: ${r.errors.map(e => `(${e.kind}: ${e.id})`).join(', ')}\n`))
.join('');
}

@@ -427,20 +416,6 @@ }

log.debug(`errors found in response:\n${response}`);
let e = new ErrorTypes_1.ServiceResponseError(200, '', '', '', response);
e.message = errors;
throw e;
throw new Error(errors);
}
}
TezosNodeWriter.parseRPCError = parseRPCError;
function parseRPCOperationResult(result) {
if (result.status === 'failed') {
return `${result.status}: ${result.errors.map(e => `(${e.kind}: ${e.id})`).join(', ')}`;
}
else if (result.status === 'applied') {
return '';
}
else {
return result.status;
}
}
})(TezosNodeWriter = exports.TezosNodeWriter || (exports.TezosNodeWriter = {}));
//# sourceMappingURL=TezosNodeWriter.js.map

@@ -6,6 +6,5 @@ export * from './chain/tezos/TezosContractIntrospector';

export * from './chain/tezos/TezosNodeWriter';
export * from './chain/tezos/contracts/TezosContractUtils';
export * from './chain/tezos/contracts/BabylonDelegationHelper';
export * from './chain/tezos/contracts/CryptonomicNameServiceHelper';
export * from './chain/tezos/contracts/DexterPoolHelper';
export * from './chain/tezos/contracts/DexterTokenHelper';
export * from './chain/tezos/contracts/MurbardMultisigHelper';

@@ -15,7 +14,5 @@ export * from './chain/tezos/contracts/StakerDAOTokenHelper';

export * from './chain/tezos/contracts/Tzip7ReferenceTokenHelper';
export * from './chain/tezos/contracts/tzip12/ChainlinkTokenHelper';
export * from './chain/tezos/contracts/tzip12/MultiAssetTokenHelper';
export * from './chain/tezos/contracts/tzip12/SingleAssetTokenHelper';
export * from './chain/tezos/contracts/TzbtcTokenHelper';
export * from './chain/tezos/contracts/WrappedTezosHelper';
export * from './reporting/tezos/TezosConseilClient';

@@ -22,0 +19,0 @@ export * from './reporting/ConseilDataClient';

@@ -18,6 +18,5 @@ "use strict";

__export(require("./chain/tezos/TezosNodeWriter"));
__export(require("./chain/tezos/contracts/TezosContractUtils"));
__export(require("./chain/tezos/contracts/BabylonDelegationHelper"));
__export(require("./chain/tezos/contracts/CryptonomicNameServiceHelper"));
__export(require("./chain/tezos/contracts/DexterPoolHelper"));
__export(require("./chain/tezos/contracts/DexterTokenHelper"));
__export(require("./chain/tezos/contracts/MurbardMultisigHelper"));

@@ -27,7 +26,5 @@ __export(require("./chain/tezos/contracts/StakerDAOTokenHelper"));

__export(require("./chain/tezos/contracts/Tzip7ReferenceTokenHelper"));
__export(require("./chain/tezos/contracts/tzip12/ChainlinkTokenHelper"));
__export(require("./chain/tezos/contracts/tzip12/MultiAssetTokenHelper"));
__export(require("./chain/tezos/contracts/tzip12/SingleAssetTokenHelper"));
__export(require("./chain/tezos/contracts/TzbtcTokenHelper"));
__export(require("./chain/tezos/contracts/WrappedTezosHelper"));
__export(require("./reporting/tezos/TezosConseilClient"));

@@ -34,0 +31,0 @@ __export(require("./reporting/ConseilDataClient"));

@@ -8,6 +8,5 @@ export declare function registerLogger(logger: any): void;

export * from "./chain/tezos/TezosNodeWriter";
export * from './chain/tezos/contracts/TezosContractUtils';
export * from './chain/tezos/contracts/BabylonDelegationHelper';
export * from './chain/tezos/contracts/CryptonomicNameServiceHelper';
export * from './chain/tezos/contracts/DexterPoolHelper';
export * from './chain/tezos/contracts/DexterTokenHelper';
export * from './chain/tezos/contracts/MurbardMultisigHelper';

@@ -17,7 +16,5 @@ export * from './chain/tezos/contracts/StakerDAOTokenHelper';

export * from './chain/tezos/contracts/Tzip7ReferenceTokenHelper';
export * from './chain/tezos/contracts/tzip12/ChainlinkTokenHelper';
export * from './chain/tezos/contracts/tzip12/MultiAssetTokenHelper';
export * from './chain/tezos/contracts/tzip12/SingleAssetTokenHelper';
export * from './chain/tezos/contracts/TzbtcTokenHelper';
export * from './chain/tezos/contracts/WrappedTezosHelper';
export * from "./reporting/tezos/TezosConseilClient";

@@ -24,0 +21,0 @@ export * from './reporting/ConseilDataClient';

@@ -24,6 +24,5 @@ "use strict";

__export(require("./chain/tezos/TezosNodeWriter"));
__export(require("./chain/tezos/contracts/TezosContractUtils"));
__export(require("./chain/tezos/contracts/BabylonDelegationHelper"));
__export(require("./chain/tezos/contracts/CryptonomicNameServiceHelper"));
__export(require("./chain/tezos/contracts/DexterPoolHelper"));
__export(require("./chain/tezos/contracts/DexterTokenHelper"));
__export(require("./chain/tezos/contracts/MurbardMultisigHelper"));

@@ -33,7 +32,5 @@ __export(require("./chain/tezos/contracts/StakerDAOTokenHelper"));

__export(require("./chain/tezos/contracts/Tzip7ReferenceTokenHelper"));
__export(require("./chain/tezos/contracts/tzip12/ChainlinkTokenHelper"));
__export(require("./chain/tezos/contracts/tzip12/MultiAssetTokenHelper"));
__export(require("./chain/tezos/contracts/tzip12/SingleAssetTokenHelper"));
__export(require("./chain/tezos/contracts/TzbtcTokenHelper"));
__export(require("./chain/tezos/contracts/WrappedTezosHelper"));
__export(require("./reporting/tezos/TezosConseilClient"));

@@ -40,0 +37,0 @@ __export(require("./reporting/ConseilDataClient"));

@@ -29,3 +29,2 @@ "use strict";

headers: { 'apiKey': serverInfo.apiKey, 'Content-Type': 'application/json' },
cache: 'no-store',
body: JSON.stringify(query)

@@ -32,0 +31,0 @@ })

@@ -10,4 +10,2 @@ import { ConseilQuery, ConseilOperator, ConseilSortDirection, ConseilFunction, ConseilOutput } from "../types/conseil/QueryTypes";

function addAggregationFunction(query: ConseilQuery, field: string, aggregationFunction: ConseilFunction): ConseilQuery;
function addExtendedParameter(query: ConseilQuery, parameter: string, value: any): ConseilQuery;
function removeParameter(query: ConseilQuery, parameter: string): ConseilQuery;
}

@@ -69,15 +69,3 @@ "use strict";

ConseilQueryBuilder.addAggregationFunction = addAggregationFunction;
function addExtendedParameter(query, parameter, value) {
query[parameter] = value;
return query;
}
ConseilQueryBuilder.addExtendedParameter = addExtendedParameter;
function removeParameter(query, parameter) {
if (query.hasOwnProperty(parameter)) {
delete query[parameter];
}
return query;
}
ConseilQueryBuilder.removeParameter = removeParameter;
})(ConseilQueryBuilder = exports.ConseilQueryBuilder || (exports.ConseilQueryBuilder = {}));
//# sourceMappingURL=ConseilQueryBuilder.js.map

@@ -11,11 +11,6 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ConseilQueryBuilder_1 = require("../ConseilQueryBuilder");
const QueryTypes_1 = require("../../types/conseil/QueryTypes");
const LoggerSelector_1 = __importDefault(require("../../utils/LoggerSelector"));
const ConseilDataClient_1 = require("../ConseilDataClient");
const ConseilQueryBuilder_1 = require("../ConseilQueryBuilder");
const log = LoggerSelector_1.default.log;
var TezosConseilClient;

@@ -146,10 +141,6 @@ (function (TezosConseilClient) {

const initialLevel = (yield getBlockHead(serverInfo, network))['level'];
const timeOffset = 180000;
const startTime = (new Date).getTime() - timeOffset;
const estimatedEndTime = startTime + timeOffset + duration * blocktime * 1000;
log.debug(`TezosConseilClient.awaitOperationConfirmation looking for ${hash} since ${initialLevel} at ${(new Date(startTime).toUTCString())}, +${duration}`);
let currentLevel = initialLevel;
let operationQuery = ConseilQueryBuilder_1.ConseilQueryBuilder.blankQuery();
operationQuery = ConseilQueryBuilder_1.ConseilQueryBuilder.addPredicate(operationQuery, 'operation_group_hash', QueryTypes_1.ConseilOperator.EQ, [hash], false);
operationQuery = ConseilQueryBuilder_1.ConseilQueryBuilder.addPredicate(operationQuery, 'timestamp', QueryTypes_1.ConseilOperator.AFTER, [startTime], false);
operationQuery = ConseilQueryBuilder_1.ConseilQueryBuilder.addPredicate(operationQuery, 'timestamp', QueryTypes_1.ConseilOperator.AFTER, [(new Date).getTime() - 60000], false);
operationQuery = ConseilQueryBuilder_1.ConseilQueryBuilder.setLimit(operationQuery, 1);

@@ -165,5 +156,2 @@ while (initialLevel + duration > currentLevel) {

}
if ((new Date).getTime() > estimatedEndTime) {
break;
}
yield new Promise(resolve => setTimeout(resolve, blocktime * 1000));

@@ -170,0 +158,0 @@ }

@@ -5,4 +5,4 @@ export declare class ServiceRequestError extends Error {

serverURL: string;
request: string | null;
constructor(httpStatus: number, httpMessage: string, serverURL: string, request: string | null);
data: string | null;
constructor(httpStatus: number, httpMessage: string, serverURL: string, data: string | null);
}

@@ -13,5 +13,5 @@ export declare class ServiceResponseError extends Error {

serverURL: string;
request: string | null;
data: string | null;
response: any;
constructor(httpStatus: number, httpMessage: string, serverURL: string, request: string | null, response: any);
constructor(httpStatus: number, httpMessage: string, serverURL: string, data: string | null, response: any);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class ServiceRequestError extends Error {
constructor(httpStatus, httpMessage, serverURL, request) {
constructor(httpStatus, httpMessage, serverURL, data) {
super();

@@ -9,3 +9,3 @@ this.httpStatus = httpStatus;

this.serverURL = serverURL;
this.request = request;
this.data = data;
}

@@ -15,3 +15,3 @@ }

class ServiceResponseError extends Error {
constructor(httpStatus, httpMessage, serverURL, request, response) {
constructor(httpStatus, httpMessage, serverURL, data, response) {
super();

@@ -21,3 +21,3 @@ this.httpStatus = httpStatus;

this.serverURL = serverURL;
this.request = request;
this.data = data;
this.response = response;

@@ -24,0 +24,0 @@ }

@@ -9,5 +9,5 @@ /// <reference types="node" />

getSignerCurve: () => SignerCurve;
signOperation: (bytes: Buffer, password?: string) => Promise<Buffer>;
signText: (message: string, password?: string) => Promise<string>;
signTextHash: (message: string, password?: string) => Promise<string>;
signOperation: (bytes: Buffer) => Promise<Buffer>;
signText: (message: string) => Promise<string>;
signTextHash: (message: string) => Promise<string>;
}

@@ -14,0 +14,0 @@ export interface KeyStore {

@@ -6,3 +6,3 @@ export declare namespace TezosConstants {

const DefaultDelegationStorageLimit = 0;
const DefaultDelegationGasLimit = 1101;
const DefaultDelegationGasLimit = 10000;
const DefaultAccountOriginationStorageLimit = 496;

@@ -9,0 +9,0 @@ const DefaultAccountOriginationGasLimit = 10600;

@@ -9,3 +9,3 @@ "use strict";

TezosConstants.DefaultDelegationStorageLimit = 0;
TezosConstants.DefaultDelegationGasLimit = 1101;
TezosConstants.DefaultDelegationGasLimit = 10000;
TezosConstants.DefaultAccountOriginationStorageLimit = 496;

@@ -12,0 +12,0 @@ TezosConstants.DefaultAccountOriginationGasLimit = 10600;

@@ -8,2 +8,3 @@ import { ServiceRequestError, ServiceResponseError } from '../ErrorTypes';

export declare class TezosResponseError extends ServiceResponseError {
requestBody: string | null;
kind: TezosResponseErrorKind;

@@ -10,0 +11,0 @@ constructor(httpStatus: number, httpMessage: string, serverURL: string, requestBody: string | null, response: any, kind: TezosResponseErrorKind);

@@ -16,4 +16,5 @@ "use strict";

constructor(httpStatus, httpMessage, serverURL, requestBody, response, kind) {
super(httpStatus, httpMessage, serverURL, requestBody, response);
super(httpStatus, httpMessage, serverURL, null, response);
this.kind = kind;
this.requestBody = requestBody;
}

@@ -20,0 +21,0 @@ }

@@ -102,5 +102,9 @@ export interface TezosBlock {

balance: string;
delegate?: string;
delegate?: ContractDelegate;
script?: any;
counter: string;
}
export interface ContractDelegate {
setable: boolean;
value: string;
}
{
"name": "conseiljs",
"version": "5.0.6-1",
"version": "5.0.6-2",
"description": "Client-side library for Tezos dApp development.",

@@ -73,3 +73,3 @@ "browser": "dist/index-web.js",

"bs58check": "2.1.2",
"jsonpath-plus": "4.0.0",
"jsonpath-plus": "5.0.2",
"moo": "0.5.0",

@@ -79,5 +79,5 @@ "nearley": "2.19.1"

"devDependencies": {
"@types/chai": "4.2.12",
"@types/chai": "4.2.14",
"@types/chai-as-promised": "7.1.3",
"@types/mocha": "8.0.3",
"@types/mocha": "8.2.0",
"@types/nock": "11.1.0",

@@ -93,7 +93,7 @@ "@types/node": "14.0.13",

"coveralls": "3.1.0",
"eslint": "7.9.0",
"eslint": "7.18.0",
"glob": "7.1.6",
"loglevel": "1.7.0",
"mocha": "8.1.3",
"nock": "13.0.4",
"loglevel": "1.7.1",
"mocha": "8.2.1",
"nock": "13.0.6",
"node-fetch": "2.6.1",

@@ -104,4 +104,4 @@ "nyc": "15.1.0",

"tsconfig-paths-webpack-plugin": "3.3.0",
"typedoc": "0.19.2",
"typedoc-plugin-markdown": "3.0.3",
"typedoc": "0.18.0",
"typedoc-plugin-markdown": "2.4.2",
"typescript": "3.8.3",

@@ -108,0 +108,0 @@ "webpack": "4.44.2",

@@ -8,7 +8,7 @@ # ConseilJS-core

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Cryptonomic_ConseilJS&metric=alert_status)](https://sonarcloud.io/dashboard?id=Cryptonomic_ConseilJS)
[![dependencies](https://david-dm.org/Cryptonomic/ConseilJS/status.svg)](https://david-dm.org/Cryptonomic/ConseilJS)
[![conseiljs](https://snyk.io/advisor/npm-package/conseiljs/badge.svg)](https://snyk.io/advisor/npm-package/conseiljs)
A library for building decentralized applications in Typescript and Javascript, currently focused on the [Tezos](http://tezos.com/) platform.
ConseilJS connects to Tezos nodes for live chain data and operations and to [Conseil](https://github.com/Cryptonomic/Conseil) servers for high-performance analytics on blockchain data. Internally, Cryptonomic uses [Nautilus](https://github.com/Cryptonomic/Nautilus) for infrastructure deployments of these services. This is the library at the core of our products, [Periscope](https://periscope.arronax.io), [Harpoon](https://harpoon.arronax.io) and certainly [Galleon](https://cryptonomic.tech/galleon.html). There are [ReasonML bindings](https://github.com/Cryptonomic/ConseilJS-ReasonML-Bindings) as well.
ConseilJS connects to Tezos nodes for live chain data and operations and to [Conseil](https://github.com/Cryptonomic/Conseil) servers for high-performance analytics on blockchain data. Internally, Cryptonomic uses [Nautilus](https://github.com/Cryptonomic/Nautilus) for infrastructure deployments of these services. This is the library at the core of our products – [Arronax](https://arronax.io), [Periscope](https://periscope.arronax.io), [Harpoon](https://harpoon.arronax.io) and certainly [Galleon](https://cryptonomic.tech/galleon.html). There are [ReasonML bindings](https://github.com/Cryptonomic/ConseilJS-ReasonML-Bindings) as well.

@@ -15,0 +15,0 @@ Cryptonomic offers an infrastructure service - [Nautilus Cloud](https://nautilus.cloud) which enables quick access to the Tezos platform along with products that make it easier build on it.

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc