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

conseiljs

Package Overview
Dependencies
Maintainers
5
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.9-beta.4 to 5.0.9-beta.5

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

4

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

@@ -7,3 +7,3 @@ import { KeyStore, Signer } from '../../../types/ExternalInterfaces';

function getOperatorList(server: string, mapid: number): Promise<string[]>;
function getTokenMetadata(server: string, mapid: number): Promise<any>;
function getTokenMetadata(server: string, mapid?: number): Promise<any>;
function getSimpleStorage(server: string, address: string): Promise<{

@@ -13,2 +13,4 @@ mapid: number;

}>;
function getTokenSupply(server: string, mapid?: number): Promise<number>;
function getPaused(server: string, mapid?: number): Promise<boolean>;
function transferBalance(server: string, signer: Signer, keystore: KeyStore, contract: string, fee: number, source: string, destination: string, amount: number, gas?: number, freight?: number): Promise<string>;

@@ -15,0 +17,0 @@ function approveBalance(server: string, signer: Signer, keystore: KeyStore, contract: string, fee: number, destination: string, amount: number, gas?: number, freight?: number): Promise<string>;

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

const jsonpath_plus_1 = require("jsonpath-plus");
const TezosConstants_1 = require("../../../types/tezos/TezosConstants");
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes"));

@@ -57,3 +58,3 @@ const TezosLanguageUtil_1 = require("../TezosLanguageUtil");

TzbtcTokenHelper.getOperatorList = getOperatorList;
function getTokenMetadata(server, mapid) {
function getTokenMetadata(server, mapid = 31) {
return __awaiter(this, void 0, void 0, function* () {

@@ -74,6 +75,20 @@ return yield queryMap(server, mapid, '"tokenMetadata"');

TzbtcTokenHelper.getSimpleStorage = getSimpleStorage;
function getTokenSupply(server, mapid = 31) {
return __awaiter(this, void 0, void 0, function* () {
const r = yield queryMap(server, mapid, '"totalSupply"');
return Number(jsonpath_plus_1.JSONPath({ path: '$.int', json: r })[0]);
});
}
TzbtcTokenHelper.getTokenSupply = getTokenSupply;
function getPaused(server, mapid = 31) {
return __awaiter(this, void 0, void 0, function* () {
const r = yield queryMap(server, mapid, '"paused"');
return (jsonpath_plus_1.JSONPath({ path: '$.prim', json: r })[0]).toLowerCase().startsWith('t');
});
}
TzbtcTokenHelper.getPaused = getPaused;
function transferBalance(server, signer, keystore, contract, fee, source, destination, amount, gas = 250000, freight = 1000) {
return __awaiter(this, void 0, void 0, function* () {
const parameters = `(Pair "${source}" (Pair "${destination}" ${amount}))`;
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, 'transfer', parameters, TezosTypes.TezosParameterFormat.Michelson);
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, 'transfer', parameters, TezosTypes.TezosParameterFormat.Michelson, TezosConstants_1.TezosConstants.HeadBranchOffset, true);
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID);

@@ -86,3 +101,3 @@ });

const parameters = `(Right (Right (Right (Right (Left (Right (Right (Right (Pair "${destination}" ${amount})))))))))`;
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson);
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson, TezosConstants_1.TezosConstants.HeadBranchOffset, true);
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID);

@@ -89,0 +104,0 @@ });

import { KeyStore, Signer } from '../../../../types/ExternalInterfaces';
interface MultiAssetSimpleStorage {
import { Transaction } from '../../../../types/tezos/TezosP2PMessageTypes';
export interface MultiAssetSimpleStorage {
administrator: string;

@@ -10,14 +11,20 @@ tokens: number;

tokenMetadata: number;
totalSupply: number;
totalSupply?: number;
}
interface MultiAssetTokenDefinition {
export interface MultiAssetTokenDefinition {
tokenid: number;
metadata: Record<string, string>;
}
interface TransferPair {
address: string;
tokenid: number;
export interface TokenTransfer {
destination: string;
token_id: number;
amount: number;
}
interface UpdateOperator {
export declare function TokenTransactionMichelson(tx: TokenTransfer): string;
export interface TransferPair {
source: string;
txs: TokenTransfer[];
}
export declare function TransferPairMichelson(transfers: TransferPair[]): string;
export interface UpdateOperator {
owner: string;

@@ -37,7 +44,8 @@ operator: string;

function mint(server: string, address: string, signer: Signer, keystore: KeyStore, fee: number, destination: string, amount: number, metadata: Record<string, string>, tokenid: number, gas?: number, freight?: number): Promise<string>;
function transfer(server: string, address: string, signer: Signer, keystore: KeyStore, fee: number, source: string, transfers: TransferPair[], gas?: number, freight?: number): Promise<string>;
function transfer(server: string, address: string, signer: Signer, keystore: KeyStore, fee: number, transfers: TransferPair[], gas?: number, freight?: number): Promise<string>;
function AddOperatorsOperation(address: string, counter: number, keystore: KeyStore, fee: number, updateOps: UpdateOperator[], gas?: number, freight?: number): Transaction;
function addOperators(server: string, address: string, signer: Signer, keystore: KeyStore, fee: number, updateOps: UpdateOperator[], gas?: number, freight?: number): Promise<string>;
function RemoveOperatorsOperation(address: string, counter: number, keystore: KeyStore, fee: number, updateOps: UpdateOperator[], gas?: number, freight?: number): Transaction;
function removeOperators(server: string, address: string, signer: Signer, keystore: KeyStore, fee: number, updateOps: UpdateOperator[], gas?: number, freight?: number): Promise<string>;
function getAccountBalance(server: string, mapid: number, account: string, tokenid: number): Promise<number>;
}
export {};

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

const jsonpath_plus_1 = require("jsonpath-plus");
const TezosConstants_1 = require("../../../../types/tezos/TezosConstants");
const TezosTypes = __importStar(require("../../../../types/tezos/TezosChainTypes"));

@@ -26,2 +27,14 @@ const TezosMessageUtil_1 = require("../../TezosMessageUtil");

const TezosContractUtils_1 = require("../TezosContractUtils");
function TokenTransactionMichelson(tx) {
return `Pair "${tx.destination}" (Pair ${tx.token_id} ${tx.amount})`;
}
exports.TokenTransactionMichelson = TokenTransactionMichelson;
function TransferPairMichelson(transfers) {
const transferList = transfers.map((transfer) => {
const txList = transfer.txs.map((tx) => TokenTransactionMichelson(tx)).join("; ");
return `Pair "${transfer.source}" { ${txList} }`;
}).join("; ");
return `{ ${transferList} }`;
}
exports.TransferPairMichelson = TransferPairMichelson;
var MultiAssetTokenHelper;

@@ -55,10 +68,10 @@ (function (MultiAssetTokenHelper) {

return {
administrator: jsonpath_plus_1.JSONPath({ path: '$.args[0].args[0].args[0].string', json: storageResult })[0],
tokens: Number(jsonpath_plus_1.JSONPath({ path: '$.args[0].args[0].args[1].int', json: storageResult })[0]),
ledger: Number(jsonpath_plus_1.JSONPath({ path: '$.args[0].args[1].int', json: storageResult })[0]),
administrator: jsonpath_plus_1.JSONPath({ path: '$.args[0].args[0].string', json: storageResult })[0],
tokens: Number(jsonpath_plus_1.JSONPath({ path: '$.args[0].args[1].int', json: storageResult })[0]),
ledger: Number(jsonpath_plus_1.JSONPath({ path: '$.args[0].args[2].int', json: storageResult })[0]),
metadata: Number(jsonpath_plus_1.JSONPath({ path: '$.args[0].args[2].int', json: storageResult })[0]),
paused: (jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].prim', json: storageResult })[0]).toString().toLowerCase().startsWith('t'),
paused: (jsonpath_plus_1.JSONPath({ path: '$.args[2].prim', json: storageResult })[0]).toString().toLowerCase().startsWith('t'),
operators: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].int', json: storageResult })[0]),
tokenMetadata: Number(jsonpath_plus_1.JSONPath({ path: '$.args[2].int', json: storageResult })[0]),
totalSupply: Number(jsonpath_plus_1.JSONPath({ path: '$.args[3].int', json: storageResult })[0]),
totalSupply: Number(jsonpath_plus_1.JSONPath({ path: '$.args[3].int', json: storageResult })[0])
};

@@ -129,7 +142,7 @@ });

MultiAssetTokenHelper.mint = mint;
function transfer(server, address, signer, keystore, fee, source, transfers, gas = 800000, freight = 20000) {
function transfer(server, address, signer, keystore, fee, transfers, gas = 800000, freight = 20000) {
return __awaiter(this, void 0, void 0, function* () {
const entryPoint = 'transfer';
const parameters = `{ Pair "${source}" { ${transfers.map(t => '( Pair "' + t.address + '" ( Pair ' + t.tokenid + ' ' + t.amount + ' ) )').join(' ; ')} } }`;
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, address, 0, fee, freight, gas, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson);
const parameters = TransferPairMichelson(transfers);
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, address, 0, fee, freight, gas, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson, TezosConstants_1.TezosConstants.HeadBranchOffset, true);
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID);

@@ -139,2 +152,14 @@ });

MultiAssetTokenHelper.transfer = transfer;
function AddOperatorsOperation(address, counter, keystore, fee, updateOps, gas = 800000, freight = 20000) {
const entryPoint = 'update_operators';
let parameters = "{";
updateOps.forEach(op => {
if (parameters !== "{")
parameters += "; ";
parameters += `Left (Pair "${op.owner}" (Pair "${op.operator}" ${op.tokenid}))`;
});
parameters += "}";
return TezosNodeWriter_1.TezosNodeWriter.constructContractInvocationOperation(keystore.publicKeyHash, counter, address, 0, fee, freight, gas, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson);
}
MultiAssetTokenHelper.AddOperatorsOperation = AddOperatorsOperation;
function addOperators(server, address, signer, keystore, fee, updateOps, gas = 800000, freight = 20000) {

@@ -155,2 +180,14 @@ return __awaiter(this, void 0, void 0, function* () {

MultiAssetTokenHelper.addOperators = addOperators;
function RemoveOperatorsOperation(address, counter, keystore, fee, updateOps, gas = 800000, freight = 20000) {
const entryPoint = 'update_operators';
let parameters = "{";
updateOps.forEach(op => {
if (parameters !== "{")
parameters += "; ";
parameters += `Right (Pair "${op.owner}" (Pair "${op.operator}" ${op.tokenid}))`;
});
parameters += "}";
return TezosNodeWriter_1.TezosNodeWriter.constructContractInvocationOperation(keystore.publicKeyHash, counter, address, 0, fee, freight, gas, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson);
}
MultiAssetTokenHelper.RemoveOperatorsOperation = RemoveOperatorsOperation;
function removeOperators(server, address, signer, keystore, fee, updateOps, gas = 800000, freight = 20000) {

@@ -157,0 +194,0 @@ return __awaiter(this, void 0, void 0, function* () {

@@ -37,4 +37,4 @@ import { KeyStore, Signer } from '../../../../types/ExternalInterfaces';

function removeOperators(server: string, address: string, signer: Signer, keystore: KeyStore, fee: number, updateOps: UpdateOperator[], gas?: number, freight?: number): Promise<string>;
function getAccountBalance(server: string, mapid: number, account: string): Promise<number>;
function getAccountBalance(server: string, mapid: number, account: string, balancePath?: string): Promise<number>;
}
export {};

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

const TezosContractUtils_1 = require("../TezosContractUtils");
const TezosConstants_1 = require("../../../../types/tezos/TezosConstants");
var SingleAssetTokenHelper;

@@ -130,4 +131,4 @@ (function (SingleAssetTokenHelper) {

const entryPoint = 'transfer';
const parameters = `{ Pair "${source}" { ${transfers.map(t => '( Pair "' + t.address + '" ( Pair ' + 0 + ' ' + t.amount + ' ) )').join(' ; ')} } }`;
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, address, 0, fee, freight, gas, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson);
const parameters = `{ Pair 0x${TezosMessageUtil_1.TezosMessageUtils.writeAddress(source)} { ${transfers.map(t => '( Pair 0x' + TezosMessageUtil_1.TezosMessageUtils.writeAddress(t.address) + ' ( Pair ' + 0 + ' ' + t.amount + ' ) )').join(' ; ')} } }`;
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, address, 0, fee, freight, gas, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson, TezosConstants_1.TezosConstants.HeadBranchOffset, true);
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID);

@@ -167,3 +168,3 @@ });

SingleAssetTokenHelper.removeOperators = removeOperators;
function getAccountBalance(server, mapid, account) {
function getAccountBalance(server, mapid, account, balancePath = '$.int') {
return __awaiter(this, void 0, void 0, function* () {

@@ -175,4 +176,4 @@ const packedKey = TezosMessageUtil_1.TezosMessageUtils.encodeBigMapKey(Buffer.from(TezosMessageUtil_1.TezosMessageUtils.writePackedData(account, "address"), 'hex'));

}
const jsonresult = jsonpath_plus_1.JSONPath({ path: '$.int', json: mapResult });
return Number(jsonresult[0]);
const balance = Number(jsonpath_plus_1.JSONPath({ path: balancePath, json: mapResult })[0]);
return balance;
});

@@ -179,0 +180,0 @@ }

import { KeyStore, Signer } from '../../../types/ExternalInterfaces';
import { Transaction } from '../../../types/tezos/TezosP2PMessageTypes';
export declare namespace Tzip7ReferenceTokenHelper {

@@ -6,3 +7,3 @@ function verifyDestination(server: string, address: string): Promise<boolean>;

function deployContract(server: string, signer: Signer, keystore: KeyStore, fee: number, administrator: string, pause?: boolean, supply?: number, gas?: number, freight?: number): Promise<string>;
function getAccountBalance(server: string, mapid: number, account: string): Promise<number>;
function getAccountBalance(server: string, mapid: number, account: string, balancePath?: string): Promise<number>;
function getAccountAllowance(server: string, mapid: number, account: string, source: string): Promise<any>;

@@ -19,2 +20,3 @@ function getSimpleStorage(server: string, address: string): Promise<{

function transferBalance(server: string, signer: Signer, keystore: KeyStore, contract: string, fee: number, source: string, destination: string, amount: number, gas: number, freight: number): Promise<string>;
function ApproveBalanceOperation(amount: number, spender: string, counter: number, address: string, keystore: KeyStore, fee: number, gas: number | undefined, freight: number): Transaction;
function approveBalance(server: string, signer: Signer, keystore: KeyStore, contract: string, fee: number, destination: string, amount: number, gas: number, freight: number): Promise<string>;

@@ -21,0 +23,0 @@ function activateLedger(server: string, signer: Signer, keystore: KeyStore, contract: string, fee: number, gas: number, freight: number): Promise<string>;

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

Tzip7ReferenceTokenHelper.deployContract = deployContract;
function getAccountBalance(server, mapid, account) {
function getAccountBalance(server, mapid, account, balancePath = '$.args[0].int') {
return __awaiter(this, void 0, void 0, function* () {

@@ -57,3 +57,3 @@ const packedKey = TezosMessageUtil_1.TezosMessageUtils.encodeBigMapKey(Buffer.from(TezosMessageUtil_1.TezosMessageUtils.writePackedData(account, 'address'), 'hex'));

}
const jsonresult = jsonpath_plus_1.JSONPath({ path: '$.args[0].int', json: mapResult });
const jsonresult = jsonpath_plus_1.JSONPath({ path: balancePath, json: mapResult });
return Number(jsonresult[0]);

@@ -111,4 +111,4 @@ });

return __awaiter(this, void 0, void 0, function* () {
const parameters = `(Left (Left (Left (Pair "${source}" (Pair "${destination}" ${amount})))))`;
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson, TezosConstants_1.TezosConstants.HeadBranchOffset, true);
const parameters = `(Pair "${source}" (Pair "${destination}" ${amount}))`;
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, 'transfer', parameters, TezosTypes.TezosParameterFormat.Michelson, TezosConstants_1.TezosConstants.HeadBranchOffset, true);
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID);

@@ -118,6 +118,12 @@ });

Tzip7ReferenceTokenHelper.transferBalance = transferBalance;
function ApproveBalanceOperation(amount, spender, counter, address, keystore, fee, gas = 800000, freight) {
const entrypoint = 'approve';
const parameters = `(Pair "${spender}" ${amount})`;
return TezosNodeWriter_1.TezosNodeWriter.constructContractInvocationOperation(keystore.publicKeyHash, counter, address, 0, fee, freight, gas, entrypoint, parameters, TezosTypes.TezosParameterFormat.Michelson);
}
Tzip7ReferenceTokenHelper.ApproveBalanceOperation = ApproveBalanceOperation;
function approveBalance(server, signer, keystore, contract, fee, destination, amount, gas, freight) {
return __awaiter(this, void 0, void 0, function* () {
const parameters = `(Left (Left (Right (Pair "${destination}" ${amount}))))`;
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson, TezosConstants_1.TezosConstants.HeadBranchOffset, true);
const parameters = `(Pair "${destination}" ${amount})`;
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, 'approve', parameters, TezosTypes.TezosParameterFormat.Michelson, TezosConstants_1.TezosConstants.HeadBranchOffset, true);
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID);

@@ -124,0 +130,0 @@ });

@@ -42,5 +42,5 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
const tokenMatched = TezosContractUtils_1.TezosContractUtils.verifyDestination(nodeUrl, tokenContractAddress, CONTRACT_CHECKSUMS.token);
const ovenMatched = TezosContractUtils_1.TezosContractUtils.verifyDestination(nodeUrl, ovenContractAddress, CONTRACT_CHECKSUMS.oven);
const coreMatched = TezosContractUtils_1.TezosContractUtils.verifyDestination(nodeUrl, coreContractAddress, CONTRACT_CHECKSUMS.core);
const tokenMatched = yield TezosContractUtils_1.TezosContractUtils.verifyDestination(nodeUrl, tokenContractAddress, CONTRACT_CHECKSUMS.token);
const ovenMatched = yield TezosContractUtils_1.TezosContractUtils.verifyDestination(nodeUrl, ovenContractAddress, CONTRACT_CHECKSUMS.oven);
const coreMatched = yield TezosContractUtils_1.TezosContractUtils.verifyDestination(nodeUrl, coreContractAddress, CONTRACT_CHECKSUMS.core);
return tokenMatched && ovenMatched && coreMatched;

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

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

const moo = __importStar(require("moo"));
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"', '"LEVEL"', '"SELF_ADDRESS"', '"never"', '"NEVER"', '"UNPAIR"', '"VOTING_POWER"', '"TOTAL_VOTING_POWER"', '"KECCAK"', '"SHA3"', '"PAIRING_CHECK"', '"bls12_381_g1"', '"bls12_381_g2"', '"bls12_381_fr"', '"sapling_state"', '"sapling_transaction"', '"SAPLING_EMPTY_STATE"', '"SAPLING_VERIFY_UPDATE"', '"ticket"', '"TICKET"', '"READ_TICKET"', '"SPLIT_TICKET"', '"JOIN_TICKETS"', '"GET_AND_UPDATE"'];
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"', '"LEVEL"', '"SELF_ADDRESS"', '"never"', '"NEVER"', '"UNPAIR"', '"VOTING_POWER"', '"TOTAL_VOTING_POWER"', '"KECCAK"', '"SHA3"', '"PAIRING_CHECK"', '"bls12_381_g1"', '"bls12_381_g2"', '"bls12_381_fr"', '"sapling_state"', '"sapling_transaction"', '"SAPLING_EMPTY_STATE"', '"SAPLING_VERIFY_UPDATE"', '"ticket"', '"TICKET"', '"READ_TICKET"', '"SPLIT_TICKET"', '"JOIN_TICKETS"', '"GET_AND_UPDATE"', '"chest"', '"chest_key"', '"OPEN_CHEST"', '"VIEW"', '"view"', '"constant"'];
let _languageKeywords = [...exports.DefaultMichelsonKeywords];

@@ -16,0 +16,0 @@ exports.setKeywordList = list => {

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

function readBufferWithHint(b: Buffer | Uint8Array, hint: string): string;
function writeBufferWithHint(b: string, hint?: string): Buffer;
function writeBufferWithHint(b: string): Buffer;
function computeOperationHash(signedOpGroup: SignedOperationGroup): string;

@@ -33,0 +33,0 @@ function computeKeyHash(key: Buffer, prefix?: string): string;

@@ -299,5 +299,2 @@ "use strict";

}
else if (hint === 'chain_id') {
return bs58check_1.default.encode(Buffer.from('575200' + buffer.toString('hex'), 'hex'));
}
else if (hint === '') {

@@ -311,10 +308,4 @@ return bs58check_1.default.encode(buffer);

TezosMessageUtils.readBufferWithHint = readBufferWithHint;
function writeBufferWithHint(b, hint = '') {
if (hint === '') {
return bs58check_1.default.decode(b);
}
if (hint === 'chain_id') {
return bs58check_1.default.decode(b).slice("Net".length);
}
throw new Error(`Unsupported hint, '${hint}'`);
function writeBufferWithHint(b) {
return bs58check_1.default.decode(b);
}

@@ -321,0 +312,0 @@ TezosMessageUtils.writeBufferWithHint = writeBufferWithHint;

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

const TezosErrorTypes_1 = require("../../types/tezos/TezosErrorTypes");
const TezosConstants_1 = require("../../types/tezos/TezosConstants");
const FetchSelector_1 = __importDefault(require("../../utils/FetchSelector"));

@@ -130,3 +131,3 @@ const LoggerSelector_1 = __importDefault(require("../../utils/LoggerSelector"));

var result = yield Promise.all([refBlock, headBlock]).then(blocks => Number(blocks[1]['header']['level']) - Number(blocks[0]['header']['level']));
return 64 - result;
return TezosConstants_1.TezosConstants.MaxBranchOffset - result;
});

@@ -133,0 +134,0 @@ }

@@ -44,3 +44,4 @@ import { KeyStore, Signer } from '../../types/ExternalInterfaces';

function dryRunOperation(server: string, chainid: string, ...operations: TezosP2PMessageTypes.Operation[]): Promise<any>;
function prepareOperationGroup(server: string, keyStore: KeyStore, counter: number, operations: TezosP2PMessageTypes.StackableOperation[], optimizeFee?: boolean): Promise<(TezosP2PMessageTypes.Transaction | TezosP2PMessageTypes.Delegation | TezosP2PMessageTypes.Reveal)[]>;
function parseRPCError(response: string): void;
}

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

log.debug(`TezosNodeWriter.performPostRequest sending ${payloadStr}\n->\n${url}`);
return fetch(url, { method: 'post', body: payloadStr, headers: { 'content-type': 'application/json' } });
return fetch(url, { method: 'post', body: payloadStr, headers: { 'Content-Type': 'application/json' } });
}

@@ -196,3 +196,5 @@ function forgeOperations(branch, operations) {

}
return operations;
else {
return operations.map((o, i) => { return Object.assign(Object.assign({}, o), { counter: `${counter + i}` }); });
}
});

@@ -371,3 +373,3 @@ }

const currentTransactions = operations.slice(0, i + 1);
const currentConsumedResources = yield TezosNodeWriter.estimateOperation(server, chainid, ...currentTransactions);
const currentConsumedResources = yield estimateOperation(server, chainid, ...currentTransactions);
const gasLimitDelta = currentConsumedResources.gas - priorConsumedResources.gas;

@@ -398,3 +400,4 @@ const storageLimitDelta = currentConsumedResources.storageCost - priorConsumedResources.storageCost;

return __awaiter(this, void 0, void 0, function* () {
const localOperations = [...operations].map(o => { return Object.assign(Object.assign({}, o), { gas_limit: TezosConstants_1.TezosConstants.OperationGasCap.toString(), storage_limit: TezosConstants_1.TezosConstants.OperationStorageCap.toString() }); });
const naiveOperationGasCap = Math.floor(TezosConstants_1.TezosConstants.BlockGasCap / operations.length).toString();
const localOperations = [...operations].map(o => { return Object.assign({ gas_limit: naiveOperationGasCap, storage_limit: TezosConstants_1.TezosConstants.OperationStorageCap.toString() }, o); });
const responseJSON = yield dryRunOperation(server, chainid, ...localOperations);

@@ -442,3 +445,3 @@ let gas = 0;

const fake_signature = 'edsigu6xFLH2NpJ1VcYshpjW99Yc1TAL1m2XBqJyXrxcZQgBMo8sszw2zm626yjpA3pWMhjpsahLrWdmvX9cqhd4ZEUchuBuFYy';
const fake_chainid = 'NetXz969SFaFn8k';
const fake_chainid = 'NetXdQprcVkpaWU';
const fake_branch = 'BL94i2ShahPx3BoNs6tJdXDdGeoJ9ukwujUA2P8WJwULYNdimmq';

@@ -467,2 +470,17 @@ 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 } });

}
function prepareOperationGroup(server, keyStore, counter, operations, optimizeFee = false) {
return __awaiter(this, void 0, void 0, function* () {
const operationGroup = yield appendRevealOperation(server, keyStore.publicKey, keyStore.publicKeyHash, counter, operations);
if (optimizeFee) {
const estimate = yield estimateOperationGroup(server, 'main', operationGroup);
operationGroup[0].fee = estimate.estimatedFee.toString();
for (let i = 0; i < operationGroup.length; i++) {
operationGroup[i].gas_limit = estimate.operationResources[i].gas.toString();
operationGroup[i].storage_limit = estimate.operationResources[i].storageCost.toString();
}
}
return operationGroup;
});
}
TezosNodeWriter.prepareOperationGroup = prepareOperationGroup;
function parseRPCError(response) {

@@ -469,0 +487,0 @@ let errors = '';

export * from './chain/tezos/TezosContractIntrospector';
export * from './chain/tezos/TezosMessageCodec';
export * from './chain/tezos/TezosLanguageUtil';

@@ -11,2 +10,3 @@ export * from './chain/tezos/TezosMessageUtil';

export * from './chain/tezos/contracts/DexterPoolHelper';
export * from './chain/tezos/contracts/HicNFT';
export * from './chain/tezos/contracts/KolibriTokenHelper';

@@ -13,0 +13,0 @@ export * from './chain/tezos/contracts/MurbardMultisigHelper';

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

__export(require("./chain/tezos/TezosContractIntrospector"));
__export(require("./chain/tezos/TezosMessageCodec"));
__export(require("./chain/tezos/TezosLanguageUtil"));

@@ -24,2 +23,3 @@ __export(require("./chain/tezos/TezosMessageUtil"));

__export(require("./chain/tezos/contracts/DexterPoolHelper"));
__export(require("./chain/tezos/contracts/HicNFT"));
__export(require("./chain/tezos/contracts/KolibriTokenHelper"));

@@ -26,0 +26,0 @@ __export(require("./chain/tezos/contracts/MurbardMultisigHelper"));

export declare function registerLogger(logger: any): void;
export declare function registerFetch(fetch: any): void;
export * from './chain/tezos/TezosContractIntrospector';
export * from './chain/tezos/TezosMessageCodec';
export * from './chain/tezos/TezosLanguageUtil';

@@ -13,2 +12,4 @@ export * from './chain/tezos/TezosMessageUtil';

export * from './chain/tezos/contracts/DexterPoolHelper';
export * from './chain/tezos/contracts/HicNFT';
export * from './chain/tezos/contracts/Kalamint';
export * from './chain/tezos/contracts/KolibriTokenHelper';

@@ -15,0 +16,0 @@ export * from './chain/tezos/contracts/MurbardMultisigHelper';

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

__export(require("./chain/tezos/TezosContractIntrospector"));
__export(require("./chain/tezos/TezosMessageCodec"));
__export(require("./chain/tezos/TezosLanguageUtil"));

@@ -30,2 +29,4 @@ __export(require("./chain/tezos/TezosMessageUtil"));

__export(require("./chain/tezos/contracts/DexterPoolHelper"));
__export(require("./chain/tezos/contracts/HicNFT"));
__export(require("./chain/tezos/contracts/Kalamint"));
__export(require("./chain/tezos/contracts/KolibriTokenHelper"));

@@ -32,0 +33,0 @@ __export(require("./chain/tezos/contracts/MurbardMultisigHelper"));

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

method: 'post',
headers: { 'apiKey': serverInfo.apiKey, 'Content-Type': 'application/json' },
headers: { 'apiKey': serverInfo.apiKey, 'Content-Type': 'application/json', Referrer: FetchSelector_1.default.Referrer },
cache: 'no-store',

@@ -31,0 +31,0 @@ body: JSON.stringify(query)

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

method: 'GET',
headers: { 'apiKey': serverInfo.apiKey }
headers: { 'apiKey': serverInfo.apiKey, Referrer: FetchSelector_1.default.Referrer }
})

@@ -29,0 +29,0 @@ .then(r => {

@@ -20,3 +20,3 @@ import { ConseilQuery, ConseilServerInfo } from "../../types/conseil/QueryTypes";

function getBallots(serverInfo: ConseilServerInfo, network: string, query: ConseilQuery): Promise<any[]>;
function awaitOperationConfirmation(serverInfo: ConseilServerInfo, network: string, hash: string, duration?: number, blocktime?: number): Promise<any>;
function awaitOperationConfirmation(serverInfo: ConseilServerInfo, network: string, hash: string, duration: number, blocktime?: number): Promise<any>;
function awaitOperationForkConfirmation(serverInfo: ConseilServerInfo, network: string, hash: string, duration: number, depth: number): Promise<boolean>;

@@ -23,0 +23,0 @@ function getBigMapData(serverInfo: ConseilServerInfo, contract: string): Promise<ContractMapDetails | undefined>;

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

TezosConseilClient.getBallots = getBallots;
function awaitOperationConfirmation(serverInfo, network, hash, duration = 10, blocktime = 30) {
function awaitOperationConfirmation(serverInfo, network, hash, duration, blocktime = 60) {
return __awaiter(this, void 0, void 0, function* () {

@@ -142,0 +142,0 @@ if (duration <= 0) {

@@ -22,12 +22,18 @@ export declare namespace TezosConstants {

const BaseOperationFee = 100;
const P009BlockGasCap = 10400000;
const P010BlockGasCap = 5200000;
const P007OperationGasCap = 1040000;
const OperationGasCap = 1040000;
const OperationStorageCap = 60000;
const BlockGasCap = 5200000;
const P010OperationStorageCap = 60000;
const P011OperationStorageCap = 32768;
const OperationStorageCap = 32768;
const EmptyAccountStorageBurn = 257;
const DefaultBakerVig = 100;
const GasLimitPadding = 100;
const StorageLimitPadding = 20;
const DefaultBakerVig = 200;
const GasLimitPadding = 1000;
const StorageLimitPadding = 25;
const HeadBranchOffset = 54;
const MaxBranchOffset = 64;
const DefaultBatchDelay = 25;
const DefaultBlockTime = 60;
}

@@ -25,10 +25,16 @@ "use strict";

TezosConstants.BaseOperationFee = 100;
TezosConstants.P009BlockGasCap = 10400000;
TezosConstants.P010BlockGasCap = 5200000;
TezosConstants.P007OperationGasCap = 1040000;
TezosConstants.OperationGasCap = TezosConstants.P007OperationGasCap;
TezosConstants.OperationStorageCap = 60000;
TezosConstants.BlockGasCap = TezosConstants.P010BlockGasCap;
TezosConstants.P010OperationStorageCap = 60000;
TezosConstants.P011OperationStorageCap = 32768;
TezosConstants.OperationStorageCap = TezosConstants.P011OperationStorageCap;
TezosConstants.EmptyAccountStorageBurn = 257;
TezosConstants.DefaultBakerVig = 100;
TezosConstants.GasLimitPadding = 100;
TezosConstants.StorageLimitPadding = 20;
TezosConstants.DefaultBakerVig = 200;
TezosConstants.GasLimitPadding = 1000;
TezosConstants.StorageLimitPadding = 25;
TezosConstants.HeadBranchOffset = 54;
TezosConstants.MaxBranchOffset = 64;
TezosConstants.DefaultBatchDelay = 25;

@@ -35,0 +41,0 @@ TezosConstants.DefaultBlockTime = 60;

@@ -5,2 +5,4 @@ export default class FetchSelector {

static fetch: (url: string, options: any | undefined) => any;
static Referrer: string;
static UserAgent: string;
}

@@ -10,2 +10,4 @@ "use strict";

FetchSelector.fetch = (url, options) => FetchSelector.actualFetch(url, options);
FetchSelector.Referrer = 'conseiljs://5.0.9-beta.5';
FetchSelector.UserAgent = 'ConseilJS/5.0.9-beta.5';
//# sourceMappingURL=FetchSelector.js.map
{
"name": "conseiljs",
"version": "5.0.9-beta.4",
"version": "5.0.9-beta.5",
"description": "Client-side library for Tezos dApp development.",

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

"scripts": {
"test": "mocha --require ts-node/register \"test/**/TezosMessageUtil.spec.ts\"",
"test": "mocha --require ts-node/register \"test/**/*.spec.ts\"",
"integration-test": "mocha --require ts-node/register --full-trace -t 600000 -b false \"integration_test/**/*.spec.ts\"",

@@ -71,6 +71,7 @@ "format": "eslint --fix-dry-run src/*/*.ts",

"dependencies": {
"big-integer": "1.6.48",
"big-integer": "1.6.49",
"bignumber.js": "9.0.1",
"blakejs": "1.1.0",
"bs58check": "2.1.2",
"jsonpath-plus": "5.0.2",
"jsonpath-plus": "5.0.7",
"moo": "0.5.0",

@@ -85,3 +86,3 @@ "nearley": "2.19.1"

"@types/node": "14.0.13",
"@types/node-fetch": "2.5.7",
"@types/node-fetch": "3.0.3",
"@typescript-eslint/parser": "3.7.1",

@@ -91,11 +92,11 @@ "awesome-typescript-loader": "5.2.1",

"chai-as-promised": "7.1.1",
"conseiljs-softsigner": "5.0.3",
"conseiljs-softsigner": "5.0.4-1",
"copyfiles": "2.3.0",
"coveralls": "3.1.0",
"eslint": "7.18.0",
"glob": "7.1.6",
"glob": "7.2.0",
"loglevel": "1.7.1",
"mocha": "8.2.1",
"nock": "13.0.6",
"node-fetch": "2.6.1",
"mocha": "8.4.0",
"nock": "13.1.3",
"node-fetch": "3.0.0",
"nyc": "15.1.0",

@@ -105,3 +106,3 @@ "terser-webpack-plugin": "3.0.8",

"tsconfig-paths-webpack-plugin": "3.3.0",
"typedoc": "^0.21.4",
"typedoc": "^0.20.36",
"typedoc-plugin-markdown": "2.4.2",

@@ -108,0 +109,0 @@ "typescript": "3.8.3",

@@ -62,3 +62,3 @@ # ConseilJS-core

<script src="https://cdn.jsdelivr.net/gh/cryptonomic/conseiljs/dist-web/conseiljs.min.js"
integrity="sha384-SsRXHGf4K9vVeThlcxeMkYVAxrxPyalCDZHt/BzJQuZNFkLki3HS3PNE4zRdJyTL"
integrity="sha384-DjXLEoLEdFo6jPdh1zcRkGNn5RI1IopzprUpIbFE5AxlCeGrU5WoLhQ8VNUXWscG"
crossorigin="anonymous"></script>

@@ -65,0 +65,0 @@ <script src="https://cdn.jsdelivr.net/gh/cryptonomic/conseiljs-softsigner/dist-web/conseiljs-softsigner.min.js"

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