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-beta.2 to 5.0.6-beta.3

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

37

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

@@ -1,3 +0,1 @@

import { KeyStore, Signer } from '../../../types/ExternalInterfaces';
import { ConseilServerInfo } from 'types/conseil/QueryTypes';
export declare type OpenOvenResult = {

@@ -7,20 +5,2 @@ operationHash: string;

};
export interface WrappedTezosStorage {
balanceMap: number;
approvalsMap: number;
supply: number;
administrator: string;
paused: boolean;
pauseGuardian: string;
outcomeMap: number;
swapMap: number;
}
export interface WrappedTezosBalanceRecord {
}
export interface WrappedTezosApprovalRecord {
}
export interface WrappedTezosOutcomeRecord {
}
export interface WrappedTezosSwapRecord {
}
export declare type OvenMapSchema = {

@@ -30,14 +10,5 @@ key: string;

};
export declare namespace WrappedTezosHelper {
function verifyDestination(nodeUrl: string, tokenContractAddress: string, ovenContractAddress: string, coreContractAddress: string): Promise<boolean>;
function verifyScript(tokenScript: string, ovenScript: string, coreScript: string): boolean;
function getSimpleStorage(server: string, address: string): Promise<WrappedTezosStorage>;
function getAccountBalance(server: string, mapid: number, account: string): Promise<number>;
function transferBalance(nodeUrl: string, signer: Signer, keystore: KeyStore, tokenContractAddress: string, fee: number, sourceAddress: string, destinationAddress: string, amount: number, gasLimit?: number, storageLimit?: number): Promise<string>;
function depositToOven(nodeUrl: string, signer: Signer, keystore: KeyStore, ovenAddress: string, fee: number, amountMutez: number, gasLimit?: number, storageLimit?: number): Promise<string>;
function withdrawFromOven(nodeUrl: string, signer: Signer, keystore: KeyStore, ovenAddress: string, fee: number, amountMutez: number, gasLimit?: number, storageLimit?: number): Promise<string>;
function listOvens(serverInfo: ConseilServerInfo, coreContractAddress: string, ovenOwner: string, ovenListBigMapId: number): Promise<Array<string>>;
function openOven(nodeUrl: string, signer: Signer, keystore: KeyStore, fee: number, coreAddress: string, gasLimit?: number, storageLimit?: number): Promise<OpenOvenResult>;
function setOvenBaker(nodeUrl: string, signer: Signer, keystore: KeyStore, fee: number, ovenAddress: string, bakerAddress: string, gasLimit?: number, storageLimit?: number): Promise<string>;
function clearOvenBaker(nodeUrl: string, signer: Signer, keystore: KeyStore, fee: number, ovenAddress: string, gasLimit?: number, storageLimit?: number): Promise<string>;
}
export declare const WrappedTezosHelper: {
verifyDestination: (nodeUrl: string, tokenContractAddress: string, ovenContractAddress: string, coreContractAddress: string) => Promise<boolean>;
verifyScript: (tokenScript: string, ovenScript: string, coreScript: string) => boolean;
};

@@ -19,6 +19,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const jsonpath_plus_1 = require("jsonpath-plus");
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes"));
const TezosMessageUtil_1 = require("../TezosMessageUtil");
const TezosNodeReader_1 = require("../TezosNodeReader");
const TezosNodeWriter_1 = require("../TezosNodeWriter");

@@ -28,4 +26,4 @@ const TezosContractUtils_1 = require("./TezosContractUtils");

const TezosChainTypes_1 = require("../../../types/tezos/TezosChainTypes");
const StakerDaoTzip7_1 = require("./StakerDaoTzip7");
const CONTRACT_CHECKSUMS = {
token: 'd48b45bd77d2300026fe617c5ba7670e',
oven: '5e3c30607da21a0fc30f7be61afb15c7',

@@ -35,63 +33,20 @@ core: '7b9b5b7e7f0283ff6388eb783e23c452'

const SCRIPT_CHECKSUMS = {
token: '',
oven: '',
core: ''
};
var WrappedTezosHelper;
(function (WrappedTezosHelper) {
function verifyDestination(nodeUrl, tokenContractAddress, ovenContractAddress, coreContractAddress) {
const WrappedTezosHelperInternal = {
verifyDestination: function (nodeUrl, ovenContractAddress, coreContractAddress) {
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);
return tokenMatched && ovenMatched && coreMatched;
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 ovenMatched && coreMatched;
});
}
WrappedTezosHelper.verifyDestination = verifyDestination;
function verifyScript(tokenScript, ovenScript, coreScript) {
const tokenMatched = TezosContractUtils_1.TezosContractUtils.verifyScript(tokenScript, SCRIPT_CHECKSUMS.token);
},
verifyScript: function (ovenScript, coreScript) {
const ovenMatched = TezosContractUtils_1.TezosContractUtils.verifyScript(ovenScript, SCRIPT_CHECKSUMS.oven);
const coreMatched = TezosContractUtils_1.TezosContractUtils.verifyScript(coreScript, SCRIPT_CHECKSUMS.core);
return tokenMatched && ovenMatched && coreMatched;
}
WrappedTezosHelper.verifyScript = verifyScript;
function getSimpleStorage(server, address) {
return ovenMatched && coreMatched;
},
depositToOven: function (nodeUrl, signer, keystore, ovenAddress, fee, amountMutez, gasLimit = 126500, storageLimit = 10) {
return __awaiter(this, void 0, void 0, function* () {
const storageResult = yield TezosNodeReader_1.TezosNodeReader.getContractStorage(server, address);
console.log(JSON.stringify(storageResult));
return {
balanceMap: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].args[1].args[0].int', json: storageResult })[0]),
approvalsMap: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].args[0].args[1].int', json: storageResult })[0]),
supply: Number(jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].args[1].int', json: storageResult })[0]),
administrator: jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].args[0].args[0].string', json: storageResult })[0],
paused: (jsonpath_plus_1.JSONPath({ path: '$.args[1].args[1].args[0].prim', json: storageResult })[0]).toString().toLowerCase().startsWith('t'),
pauseGuardian: jsonpath_plus_1.JSONPath({ path: '$.args[1].args[0].args[1].args[1].string', json: storageResult })[0],
outcomeMap: Number(jsonpath_plus_1.JSONPath({ path: '$.args[0].args[0].int', json: storageResult })[0]),
swapMap: Number(jsonpath_plus_1.JSONPath({ path: '$.args[0].args[1].int', json: storageResult })[0])
};
});
}
WrappedTezosHelper.getSimpleStorage = getSimpleStorage;
function getAccountBalance(server, mapid, account) {
return __awaiter(this, void 0, void 0, function* () {
const packedKey = TezosMessageUtil_1.TezosMessageUtils.encodeBigMapKey(Buffer.from(TezosMessageUtil_1.TezosMessageUtils.writePackedData(account, 'address'), 'hex'));
const mapResult = yield TezosNodeReader_1.TezosNodeReader.getValueForBigMapKey(server, mapid, packedKey);
if (mapResult === undefined) {
throw new Error(`Map ${mapid} does not contain a record for ${account}`);
}
const numberString = jsonpath_plus_1.JSONPath({ path: '$.int', json: mapResult });
return Number(numberString);
});
}
WrappedTezosHelper.getAccountBalance = getAccountBalance;
function transferBalance(nodeUrl, signer, keystore, tokenContractAddress, fee, sourceAddress, destinationAddress, amount, gasLimit = 51300, storageLimit = 70) {
return __awaiter(this, void 0, void 0, function* () {
const parameters = `Pair "${sourceAddress}" (Pair "${destinationAddress}" ${amount})`;
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(nodeUrl, signer, keystore, tokenContractAddress, 0, fee, storageLimit, gasLimit, 'transfer', parameters, TezosTypes.TezosParameterFormat.Michelson);
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID);
});
}
WrappedTezosHelper.transferBalance = transferBalance;
function depositToOven(nodeUrl, signer, keystore, ovenAddress, fee, amountMutez, gasLimit = 126500, storageLimit = 10) {
return __awaiter(this, void 0, void 0, function* () {
const parameters = 'Unit';

@@ -101,5 +56,4 @@ const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(nodeUrl, signer, keystore, ovenAddress, amountMutez, fee, storageLimit, gasLimit, '', parameters, TezosTypes.TezosParameterFormat.Michelson);

});
}
WrappedTezosHelper.depositToOven = depositToOven;
function withdrawFromOven(nodeUrl, signer, keystore, ovenAddress, fee, amountMutez, gasLimit = 121000, storageLimit = 0) {
},
withdrawFromOven: function (nodeUrl, signer, keystore, ovenAddress, fee, amountMutez, gasLimit = 121000, storageLimit = 0) {
return __awaiter(this, void 0, void 0, function* () {

@@ -110,5 +64,4 @@ const parameters = `${amountMutez}`;

});
}
WrappedTezosHelper.withdrawFromOven = withdrawFromOven;
function listOvens(serverInfo, coreContractAddress, ovenOwner, ovenListBigMapId) {
},
listOven: function (serverInfo, coreContractAddress, ovenOwner, ovenListBigMapId) {
return __awaiter(this, void 0, void 0, function* () {

@@ -144,9 +97,9 @@ const mapData = yield TezosConseilClient_1.TezosConseilClient.getBigMapData(serverInfo, coreContractAddress);

});
}
WrappedTezosHelper.listOvens = listOvens;
function openOven(nodeUrl, signer, keystore, fee, coreAddress, gasLimit = 115000, storageLimit = 1100) {
},
deployOven: function (nodeUrl, signer, keystore, fee, coreAddress, baker = undefined, gasLimit = 115000, storageLimit = 1100) {
return __awaiter(this, void 0, void 0, function* () {
const entryPoint = 'runEntrypointLambda';
const lambdaName = 'createOven';
const bytes = TezosMessageUtil_1.TezosMessageUtils.writePackedData(`Pair None "${keystore.publicKeyHash}"`, 'pair (option key_hash) address', TezosChainTypes_1.TezosParameterFormat.Michelson);
const bakerParam = baker !== undefined ? `Some "${baker}"` : 'None';
const bytes = TezosMessageUtil_1.TezosMessageUtils.writePackedData(`Pair ${bakerParam} "${keystore.publicKeyHash}"`, 'pair (option key_hash) address', TezosChainTypes_1.TezosParameterFormat.Michelson);
const parameters = `Pair "${lambdaName}" 0x${bytes}`;

@@ -161,5 +114,4 @@ const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(nodeUrl, signer, keystore, coreAddress, 0, fee, storageLimit, gasLimit, entryPoint, parameters, TezosTypes.TezosParameterFormat.Michelson);

});
}
WrappedTezosHelper.openOven = openOven;
function setOvenBaker(nodeUrl, signer, keystore, fee, ovenAddress, bakerAddress, gasLimit = 19500, storageLimit = 0) {
},
setOvenBaker: function (nodeUrl, signer, keystore, fee, ovenAddress, bakerAddress, gasLimit = 19500, storageLimit = 0) {
return __awaiter(this, void 0, void 0, function* () {

@@ -170,5 +122,4 @@ const parameters = `Some "${bakerAddress}"`;

});
}
WrappedTezosHelper.setOvenBaker = setOvenBaker;
function clearOvenBaker(nodeUrl, signer, keystore, fee, ovenAddress, gasLimit = 19500, storageLimit = 0) {
},
clearOvenBaker: function (nodeUrl, signer, keystore, fee, ovenAddress, gasLimit = 19500, storageLimit = 0) {
return __awaiter(this, void 0, void 0, function* () {

@@ -180,4 +131,17 @@ const parameters = `None`;

}
WrappedTezosHelper.clearOvenBaker = clearOvenBaker;
})(WrappedTezosHelper = exports.WrappedTezosHelper || (exports.WrappedTezosHelper = {}));
};
exports.WrappedTezosHelper = StakerDaoTzip7_1.StakerDaoTzip7 && WrappedTezosHelperInternal && {
verifyDestination: function verifyDestination(nodeUrl, tokenContractAddress, ovenContractAddress, coreContractAddress) {
return __awaiter(this, void 0, void 0, function* () {
const tokenMatched = yield StakerDaoTzip7_1.StakerDaoTzip7.verifyDestination(nodeUrl, tokenContractAddress);
const wrappedTezosInternalMatched = yield WrappedTezosHelperInternal.verifyDestination(nodeUrl, ovenContractAddress, coreContractAddress);
return tokenMatched && wrappedTezosInternalMatched;
});
},
verifyScript: function (tokenScript, ovenScript, coreScript) {
const tokenMatched = StakerDaoTzip7_1.StakerDaoTzip7.verifyScript(tokenScript);
const wrappedTezosInternalMatched = WrappedTezosHelperInternal.verifyScript(ovenScript, coreScript);
return tokenMatched && wrappedTezosInternalMatched;
}
};
//# sourceMappingURL=WrappedTezosHelper.js.map

@@ -9,3 +9,3 @@ interface NearleyToken {

save: () => any;
formatError: (token: NearleyToken) => string;
formatError: (token: never) => string;
has: (tokenType: string) => boolean;

@@ -12,0 +12,0 @@ }

@@ -13,3 +13,3 @@ export declare const DefaultMichelsonKeywords: string[];

save: () => any;
formatError: (token: NearleyToken) => string;
formatError: (token: never) => string;
has: (tokenType: string) => boolean;

@@ -16,0 +16,0 @@ }

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

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

@@ -28,0 +28,0 @@ const staticIntToHex = d => {

@@ -9,3 +9,3 @@ interface NearleyToken {

save: () => any;
formatError: (token: NearleyToken) => string;
formatError: (token: never) => string;
has: (tokenType: string) => boolean;

@@ -12,0 +12,0 @@ }

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>;

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

@@ -39,2 +39,9 @@ "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') {

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

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

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

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

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

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

@@ -74,4 +74,4 @@ "browser": "dist/index-web.js",

"jsonpath-plus": "4.0.0",
"moo": "0.5.0",
"nearley": "2.19.1"
"moo": "0.5.1",
"nearley": "2.20.0"
},

@@ -78,0 +78,0 @@ "devDependencies": {

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