conseiljs
Advanced tools
Comparing version 5.0.0-alpha.1 to 5.0.0-alpha.2
@@ -33,3 +33,3 @@ "use strict"; | ||
baseInstruction: ['ABS', 'ADD', 'ADDRESS', 'AMOUNT', 'AND', 'BALANCE', 'BLAKE2B', 'CAR', 'CAST', 'CDR', 'CHECK_SIGNATURE', | ||
'COMPARE', 'CONCAT', 'CONS', 'CONTRACT', 'DIP', 'DUP', 'EDIV', | ||
'COMPARE', 'CONCAT', 'CONS', 'CONTRACT', 'DIP', 'EDIV', | ||
'EMPTY_SET', 'EQ', 'EXEC', 'FAIL', 'FAILWITH', 'GE', 'GET', 'GT', 'HASH_KEY', 'IF', 'IF_CONS', 'IF_LEFT', 'IF_NONE', | ||
@@ -136,4 +136,12 @@ 'IF_RIGHT', 'IMPLICIT_ACCOUNT', 'INT', 'ISNAT', 'ITER', 'LAMBDA', 'LE', 'LEFT', 'LOOP', 'LOOP_LEFT', 'LSL', 'LSR', 'LT', | ||
return `[{"prim":"NEQ"},{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"${annotation}}]]]}]`; | ||
case 'ASSERT_NONE': | ||
return '[{"prim":"IF_NONE","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"}]]]}]'; | ||
case 'ASSERT_SOME': | ||
return '[{"prim":"IF_NONE","args":[[[{"prim":"UNIT"},{"prim":"FAILWITH"}]],[]]}]'; | ||
case 'ASSERT_LEFT': | ||
return ''; | ||
case 'ASSERT_RIGHT': | ||
return ''; | ||
default: | ||
return ''; | ||
throw new Error(`Could not process ${assert}`); | ||
} | ||
@@ -181,3 +189,3 @@ }; | ||
default: | ||
return ''; | ||
throw new Error(`Could not process ${ifInstr}`); | ||
} | ||
@@ -414,2 +422,14 @@ }; | ||
const dipnToJson = d => (d.length > 4) ? `{ "prim": "${d[0]}", "args": [ { "int": "${d[2]}" }, [ ${d[4]} ] ] }` : `{ "prim": "${d[0]}", "args": [ ${d[2]} ] }`; | ||
const dupnToJson = d => { | ||
const n = Number(d[2]); | ||
if (n === 1) { | ||
return '{ "prim": "DUP" }'; | ||
} | ||
else if (n === 2) { | ||
return '[{ "prim": "DIP", "args": [[ {"prim": "DUP"} ]] }, { "prim": "SWAP" }]'; | ||
} | ||
else { | ||
return `[{ "prim": "DIP", "args": [ {"int": "${n - 1}"}, [{ "prim": "DUP" }] ] }, { "prim": "DIG", "args": [ {"int": "${n}"} ] }]`; | ||
} | ||
}; | ||
const dignToJson = d => `{ "prim": "${d[0]}", "args": [ { "int": "${d[2]}" } ] }`; | ||
@@ -555,30 +575,12 @@ const dropnToJson = d => `{ "prim": "${d[0]}", "args": [ { "int": "${d[2]}" } ] }`; | ||
{ "name": "subTypeElt$ebnf$1", "symbols": ["subTypeElt$ebnf$1", "subTypeElt$ebnf$1$subexpression$2"], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "subTypeElt", "symbols": [{ "literal": "{" }, "_", "subTypeElt$ebnf$1", { "literal": "}" }], "postprocess": instructionSetToJsonSemi }, | ||
{ "name": "subTypeElt", "symbols": [{ "literal": "[{" }, "_", "subTypeElt$ebnf$1", { "literal": "}]" }], "postprocess": instructionSetToJsonSemi }, | ||
{ "name": "subTypeElt$ebnf$2$subexpression$1$ebnf$1", "symbols": [{ "literal": ";" }], "postprocess": id }, | ||
{ "name": "subTypeElt$ebnf$2$subexpression$1$ebnf$1", "symbols": [], "postprocess": () => null }, | ||
{ "name": "subTypeElt$ebnf$2$subexpression$1", "symbols": ["typeElt", "subTypeElt$ebnf$2$subexpression$1$ebnf$1", "_"] }, | ||
{ "name": "subTypeElt$ebnf$2$subexpression$1", "symbols": ["typeElt", "_", "subTypeElt$ebnf$2$subexpression$1$ebnf$1", "_"] }, | ||
{ "name": "subTypeElt$ebnf$2", "symbols": ["subTypeElt$ebnf$2$subexpression$1"] }, | ||
{ "name": "subTypeElt$ebnf$2$subexpression$2$ebnf$1", "symbols": [{ "literal": ";" }], "postprocess": id }, | ||
{ "name": "subTypeElt$ebnf$2$subexpression$2$ebnf$1", "symbols": [], "postprocess": () => null }, | ||
{ "name": "subTypeElt$ebnf$2$subexpression$2", "symbols": ["typeElt", "subTypeElt$ebnf$2$subexpression$2$ebnf$1", "_"] }, | ||
{ "name": "subTypeElt$ebnf$2$subexpression$2", "symbols": ["typeElt", "_", "subTypeElt$ebnf$2$subexpression$2$ebnf$1", "_"] }, | ||
{ "name": "subTypeElt$ebnf$2", "symbols": ["subTypeElt$ebnf$2", "subTypeElt$ebnf$2$subexpression$2"], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "subTypeElt", "symbols": [{ "literal": "(" }, "_", "subTypeElt$ebnf$2", { "literal": ")" }], "postprocess": instructionSetToJsonSemi }, | ||
{ "name": "subTypeElt$ebnf$3$subexpression$1$ebnf$1", "symbols": [{ "literal": ";" }], "postprocess": id }, | ||
{ "name": "subTypeElt$ebnf$3$subexpression$1$ebnf$1", "symbols": [], "postprocess": () => null }, | ||
{ "name": "subTypeElt$ebnf$3$subexpression$1", "symbols": ["typeElt", "_", "subTypeElt$ebnf$3$subexpression$1$ebnf$1", "_"] }, | ||
{ "name": "subTypeElt$ebnf$3", "symbols": ["subTypeElt$ebnf$3$subexpression$1"] }, | ||
{ "name": "subTypeElt$ebnf$3$subexpression$2$ebnf$1", "symbols": [{ "literal": ";" }], "postprocess": id }, | ||
{ "name": "subTypeElt$ebnf$3$subexpression$2$ebnf$1", "symbols": [], "postprocess": () => null }, | ||
{ "name": "subTypeElt$ebnf$3$subexpression$2", "symbols": ["typeElt", "_", "subTypeElt$ebnf$3$subexpression$2$ebnf$1", "_"] }, | ||
{ "name": "subTypeElt$ebnf$3", "symbols": ["subTypeElt$ebnf$3", "subTypeElt$ebnf$3$subexpression$2"], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "subTypeElt", "symbols": [{ "literal": "{" }, "_", "subTypeElt$ebnf$3", { "literal": "}" }], "postprocess": instructionSetToJsonSemi }, | ||
{ "name": "subTypeElt$ebnf$4$subexpression$1$ebnf$1", "symbols": [{ "literal": ";" }], "postprocess": id }, | ||
{ "name": "subTypeElt$ebnf$4$subexpression$1$ebnf$1", "symbols": [], "postprocess": () => null }, | ||
{ "name": "subTypeElt$ebnf$4$subexpression$1", "symbols": ["typeElt", "_", "subTypeElt$ebnf$4$subexpression$1$ebnf$1", "_"] }, | ||
{ "name": "subTypeElt$ebnf$4", "symbols": ["subTypeElt$ebnf$4$subexpression$1"] }, | ||
{ "name": "subTypeElt$ebnf$4$subexpression$2$ebnf$1", "symbols": [{ "literal": ";" }], "postprocess": id }, | ||
{ "name": "subTypeElt$ebnf$4$subexpression$2$ebnf$1", "symbols": [], "postprocess": () => null }, | ||
{ "name": "subTypeElt$ebnf$4$subexpression$2", "symbols": ["typeElt", "_", "subTypeElt$ebnf$4$subexpression$2$ebnf$1", "_"] }, | ||
{ "name": "subTypeElt$ebnf$4", "symbols": ["subTypeElt$ebnf$4", "subTypeElt$ebnf$4$subexpression$2"], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "subTypeElt", "symbols": [{ "literal": "(" }, "_", "subTypeElt$ebnf$4", { "literal": ")" }], "postprocess": instructionSetToJsonSemi }, | ||
{ "name": "subTypeElt", "symbols": [{ "literal": "[{" }, "_", "subTypeElt$ebnf$2", { "literal": "}]" }], "postprocess": instructionSetToJsonSemi }, | ||
{ "name": "typeElt", "symbols": [(lexer.has("elt") ? { type: "elt" } : elt), "_", "typeData", "_", "typeData"], "postprocess": doubleArgKeywordToJson }, | ||
@@ -604,2 +606,3 @@ { "name": "subInstruction", "symbols": [(lexer.has("lbrace") ? { type: "lbrace" } : lbrace), "_", (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": d => "" }, | ||
{ "name": "instruction", "symbols": ["instructions"], "postprocess": keywordToJson }, | ||
{ "name": "instruction", "symbols": ["subInstruction"], "postprocess": id }, | ||
{ "name": "instruction$ebnf$1$subexpression$1", "symbols": ["_", (lexer.has("annot") ? { type: "annot" } : annot)] }, | ||
@@ -658,14 +661,19 @@ { "name": "instruction$ebnf$1", "symbols": ["instruction$ebnf$1$subexpression$1"] }, | ||
{ "name": "instruction$ebnf$10", "symbols": ["instruction$ebnf$10", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DUP" }, "_", "instruction$ebnf$10", "_", "subInstruction"], "postprocess": dipnToJson }, | ||
{ "name": "instruction$ebnf$11", "symbols": [/[0-9]/] }, | ||
{ "name": "instruction$ebnf$11", "symbols": ["instruction$ebnf$11", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DIG" }, "_", "instruction$ebnf$11"], "postprocess": dignToJson }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DUP" }, "_", "instruction$ebnf$10"], "postprocess": dupnToJson }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DUP" }], "postprocess": keywordToJson }, | ||
{ "name": "instruction$ebnf$11$subexpression$1", "symbols": ["_", (lexer.has("annot") ? { type: "annot" } : annot)] }, | ||
{ "name": "instruction$ebnf$11", "symbols": ["instruction$ebnf$11$subexpression$1"] }, | ||
{ "name": "instruction$ebnf$11$subexpression$2", "symbols": ["_", (lexer.has("annot") ? { type: "annot" } : annot)] }, | ||
{ "name": "instruction$ebnf$11", "symbols": ["instruction$ebnf$11", "instruction$ebnf$11$subexpression$2"], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DUP" }, "instruction$ebnf$11", "_"], "postprocess": keywordToJson }, | ||
{ "name": "instruction$ebnf$12", "symbols": [/[0-9]/] }, | ||
{ "name": "instruction$ebnf$12", "symbols": ["instruction$ebnf$12", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DUG" }, "_", "instruction$ebnf$12"], "postprocess": dignToJson }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DIG" }, "_", "instruction$ebnf$12"], "postprocess": dignToJson }, | ||
{ "name": "instruction$ebnf$13", "symbols": [/[0-9]/] }, | ||
{ "name": "instruction$ebnf$13", "symbols": ["instruction$ebnf$13", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DROP" }, "_", "instruction$ebnf$13"], "postprocess": dropnToJson }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DUG" }, "_", "instruction$ebnf$13"], "postprocess": dignToJson }, | ||
{ "name": "instruction$ebnf$14", "symbols": [/[0-9]/] }, | ||
{ "name": "instruction$ebnf$14", "symbols": ["instruction$ebnf$14", /[0-9]/], "postprocess": (d) => d[0].concat([d[1]]) }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DROP" }, "_", "instruction$ebnf$14"], "postprocess": dropnToJson }, | ||
{ "name": "instruction", "symbols": [{ "literal": "DROP" }], "postprocess": keywordToJson }, | ||
{ "name": "instruction", "symbols": [(lexer.has("lbrace") ? { type: "lbrace" } : lbrace), "_", (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": d => "" }, | ||
{ "name": "instruction", "symbols": [{ "literal": "CREATE_CONTRACT" }, "_", (lexer.has("lbrace") ? { type: "lbrace" } : lbrace), "_", "parameter", "_", "storage", "_", "code", "_", (lexer.has("rbrace") ? { type: "rbrace" } : rbrace)], "postprocess": subContractToJson }, | ||
@@ -672,0 +680,0 @@ { "name": "instruction", "symbols": [{ "literal": "EMPTY_MAP" }, "_", "type", "_", "type"], "postprocess": doubleArgKeywordToJson }, |
@@ -155,5 +155,3 @@ "use strict"; | ||
function translateParameterMichelsonToMicheline(code) { | ||
const parser = new nearley.Parser(nearley.Grammar.fromCompiled(Michelson.default)); | ||
preProcessMichelsonScript(code).forEach(p => { parser.feed(p); }); | ||
return parser.results[0]; | ||
return translateMichelsonToMicheline(code); | ||
} | ||
@@ -160,0 +158,0 @@ TezosLanguageUtil.translateParameterMichelsonToMicheline = translateParameterMichelsonToMicheline; |
@@ -14,3 +14,4 @@ import * as TezosRPCTypes from '../../types/tezos/TezosRPCResponseTypes'; | ||
function getMempoolOperation(server: string, operationGroupId: string, chainid?: string): Promise<any>; | ||
function estimateBranchTimeout(server: string, branch: string, chainid?: string): Promise<number>; | ||
function getMempoolOperationsForAccount(server: string, accountHash: string, chainid?: string): Promise<any>; | ||
} |
@@ -105,7 +105,15 @@ "use strict"; | ||
TezosNodeReader.getMempoolOperation = getMempoolOperation; | ||
function estimateBranchTimeout(server, branch, chainid = 'main') { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const refBlock = getBlock(server, branch, chainid); | ||
const headBlock = getBlock(server, 'head', chainid); | ||
var result = yield Promise.all([refBlock, headBlock]).then(blocks => Number(blocks[1]['header']['level']) - Number(blocks[0]['header']['level'])); | ||
return 64 - result; | ||
}); | ||
} | ||
TezosNodeReader.estimateBranchTimeout = estimateBranchTimeout; | ||
function getMempoolOperationsForAccount(server, accountHash, chainid = 'main') { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const mempoolContent = yield performGetRequest(server, `chains/${chainid}/mempool/pending_operations`).catch(() => undefined); | ||
const p = JSON.parse(mempoolContent); | ||
const a = p.applied.filter(g => g.contents.some(s => (s.source === accountHash || s.destination === accountHash))); | ||
const a = mempoolContent.applied.filter(g => g.contents.some(s => (s.source === accountHash || s.destination === accountHash))); | ||
const o = a.map(g => { g.contents = g.contents.filter(s => (s.source === accountHash || s.destination === accountHash)); return g; }); | ||
@@ -112,0 +120,0 @@ return o; |
@@ -13,3 +13,4 @@ export * from './chain/tezos/TezosContractIntrospector'; | ||
export * from './chain/tezos/contracts/Tzip7ReferenceTokenHelper'; | ||
export * from './chain/tezos/contracts/Tzip12ReferenceTokenHelper'; | ||
export * from './chain/tezos/contracts/tzip12/NFTReferenceTokenHelper'; | ||
export * from './chain/tezos/contracts/tzip12/SingleAssetTokenHelper'; | ||
export * from './chain/tezos/contracts/TzbtcTokenHelper'; | ||
@@ -16,0 +17,0 @@ export * from './reporting/tezos/TezosConseilClient'; |
@@ -25,3 +25,4 @@ "use strict"; | ||
__export(require("./chain/tezos/contracts/Tzip7ReferenceTokenHelper")); | ||
__export(require("./chain/tezos/contracts/Tzip12ReferenceTokenHelper")); | ||
__export(require("./chain/tezos/contracts/tzip12/NFTReferenceTokenHelper")); | ||
__export(require("./chain/tezos/contracts/tzip12/SingleAssetTokenHelper")); | ||
__export(require("./chain/tezos/contracts/TzbtcTokenHelper")); | ||
@@ -28,0 +29,0 @@ __export(require("./reporting/tezos/TezosConseilClient")); |
@@ -15,3 +15,4 @@ export declare function registerLogger(logger: any): void; | ||
export * from './chain/tezos/contracts/Tzip7ReferenceTokenHelper'; | ||
export * from './chain/tezos/contracts/Tzip12ReferenceTokenHelper'; | ||
export * from './chain/tezos/contracts/tzip12/NFTReferenceTokenHelper'; | ||
export * from './chain/tezos/contracts/tzip12/SingleAssetTokenHelper'; | ||
export * from './chain/tezos/contracts/TzbtcTokenHelper'; | ||
@@ -18,0 +19,0 @@ export * from "./reporting/tezos/TezosConseilClient"; |
@@ -31,3 +31,4 @@ "use strict"; | ||
__export(require("./chain/tezos/contracts/Tzip7ReferenceTokenHelper")); | ||
__export(require("./chain/tezos/contracts/Tzip12ReferenceTokenHelper")); | ||
__export(require("./chain/tezos/contracts/tzip12/NFTReferenceTokenHelper")); | ||
__export(require("./chain/tezos/contracts/tzip12/SingleAssetTokenHelper")); | ||
__export(require("./chain/tezos/contracts/TzbtcTokenHelper")); | ||
@@ -34,0 +35,0 @@ __export(require("./reporting/tezos/TezosConseilClient")); |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
publicKey: string; | ||
privateKey: string; | ||
secretKey: string; | ||
publicKeyHash: string; | ||
@@ -11,0 +11,0 @@ curve: KeyStoreCurve; |
{ | ||
"name": "conseiljs", | ||
"version": "5.0.0-alpha.1", | ||
"version": "5.0.0-alpha.2", | ||
"description": "Client-side library for dApp development.", | ||
@@ -5,0 +5,0 @@ "browser": "dist/index-web.js", |
@@ -40,3 +40,3 @@ # ConseilJS | ||
const keyStore = KeyStoreUtils.RestoreIdentityFromSecretKey ('edskRgu8wHxjwayvnmpLDDijzD3VZDoAH7ZLqJWuG4zg7LbxmSWZWhtkSyM5Uby41rGfsBGk4iPKWHSDniFyCRv3j7YFCknyHH'); | ||
signer = new SoftSigner(TezosMessageUtils.writeKeyWithHint(keyStore.privateKey, 'edsk')); | ||
signer = new SoftSigner(TezosMessageUtils.writeKeyWithHint(keyStore.secretKey, 'edsk')); | ||
``` | ||
@@ -43,0 +43,0 @@ |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
649247
124
6271
1