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

37

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

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

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

@@ -5,2 +7,20 @@ 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 = {

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

};
export declare const WrappedTezosHelper: {
verifyDestination: (nodeUrl: string, tokenContractAddress: string, ovenContractAddress: string, coreContractAddress: string) => Promise<boolean>;
verifyScript: (tokenScript: string, ovenScript: string, coreScript: string) => boolean;
};
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 deployOven(nodeUrl: string, signer: Signer, keystore: KeyStore, fee: number, coreAddress: string, baker?: string | undefined, 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>;
}

109

dist/chain/tezos/contracts/WrappedTezosHelper.js

@@ -19,4 +19,6 @@ "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");

@@ -26,4 +28,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',

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

const SCRIPT_CHECKSUMS = {
token: '',
oven: '',
core: ''
};
const WrappedTezosHelperInternal = {
verifyDestination: function (nodeUrl, ovenContractAddress, coreContractAddress) {
var WrappedTezosHelper;
(function (WrappedTezosHelper) {
function verifyDestination(nodeUrl, tokenContractAddress, ovenContractAddress, coreContractAddress) {
return __awaiter(this, void 0, void 0, function* () {
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;
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;
});
},
verifyScript: function (ovenScript, coreScript) {
}
WrappedTezosHelper.verifyDestination = verifyDestination;
function verifyScript(tokenScript, ovenScript, coreScript) {
const tokenMatched = TezosContractUtils_1.TezosContractUtils.verifyScript(tokenScript, SCRIPT_CHECKSUMS.token);
const ovenMatched = TezosContractUtils_1.TezosContractUtils.verifyScript(ovenScript, SCRIPT_CHECKSUMS.oven);
const coreMatched = TezosContractUtils_1.TezosContractUtils.verifyScript(coreScript, SCRIPT_CHECKSUMS.core);
return ovenMatched && coreMatched;
},
depositToOven: function (nodeUrl, signer, keystore, ovenAddress, fee, amountMutez, gasLimit = 126500, storageLimit = 10) {
return tokenMatched && ovenMatched && coreMatched;
}
WrappedTezosHelper.verifyScript = verifyScript;
function getSimpleStorage(server, address) {
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 = 150000, storageLimit = 10) {
return __awaiter(this, void 0, void 0, function* () {
const parameters = 'Unit';

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

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

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

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

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

});
},
deployOven: function (nodeUrl, signer, keystore, fee, coreAddress, baker = undefined, gasLimit = 115000, storageLimit = 1100) {
}
WrappedTezosHelper.listOvens = listOvens;
function deployOven(nodeUrl, signer, keystore, fee, coreAddress, baker = undefined, gasLimit = 115000, storageLimit = 1100) {
return __awaiter(this, void 0, void 0, function* () {

@@ -114,4 +162,5 @@ const entryPoint = 'runEntrypointLambda';

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

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

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

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

}
};
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;
}
};
WrappedTezosHelper.clearOvenBaker = clearOvenBaker;
})(WrappedTezosHelper = exports.WrappedTezosHelper || (exports.WrappedTezosHelper = {}));
//# sourceMappingURL=WrappedTezosHelper.js.map

@@ -130,3 +130,4 @@ "use strict";

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

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

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

@@ -139,0 +140,0 @@ return { results: appliedOp[0], operationGroupID: injectedOperation };

{
"name": "conseiljs",
"version": "5.0.6-beta.3",
"version": "5.0.6-beta.4",
"description": "Client-side library for Tezos dApp development.",

@@ -5,0 +5,0 @@ "browser": "dist/index-web.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

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