conseiljs
Advanced tools
Comparing version 5.0.9-beta.2 to 5.0.9-beta.3
@@ -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,4 +13,2 @@ 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>; | ||
@@ -17,0 +15,0 @@ function approveBalance(server: string, signer: Signer, keystore: KeyStore, contract: string, fee: number, destination: string, amount: number, gas?: number, freight?: number): Promise<string>; |
@@ -20,3 +20,2 @@ "use strict"; | ||
const jsonpath_plus_1 = require("jsonpath-plus"); | ||
const TezosConstants_1 = require("../../../types/tezos/TezosConstants"); | ||
const TezosTypes = __importStar(require("../../../types/tezos/TezosChainTypes")); | ||
@@ -58,3 +57,3 @@ const TezosLanguageUtil_1 = require("../TezosLanguageUtil"); | ||
TzbtcTokenHelper.getOperatorList = getOperatorList; | ||
function getTokenMetadata(server, mapid = 31) { | ||
function getTokenMetadata(server, mapid) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -75,20 +74,6 @@ 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, TezosConstants_1.TezosConstants.HeadBranchOffset, true); | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, 'transfer', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
@@ -101,3 +86,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, TezosConstants_1.TezosConstants.HeadBranchOffset, true); | ||
const nodeResult = yield TezosNodeWriter_1.TezosNodeWriter.sendContractInvocationOperation(server, signer, keystore, contract, 0, fee, freight, gas, '', parameters, TezosTypes.TezosParameterFormat.Michelson); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
@@ -104,0 +89,0 @@ }); |
@@ -20,3 +20,2 @@ "use strict"; | ||
const jsonpath_plus_1 = require("jsonpath-plus"); | ||
const TezosConstants_1 = require("../../../../types/tezos/TezosConstants"); | ||
const TezosTypes = __importStar(require("../../../../types/tezos/TezosChainTypes")); | ||
@@ -62,3 +61,3 @@ const TezosMessageUtil_1 = require("../../TezosMessageUtil"); | ||
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]), | ||
}; | ||
@@ -132,4 +131,4 @@ }); | ||
const entryPoint = 'transfer'; | ||
const parameters = `{ Pair 0x${TezosMessageUtil_1.TezosMessageUtils.writeAddress(source)} { ${transfers.map(t => '( Pair 0x' + TezosMessageUtil_1.TezosMessageUtils.writeAddress(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, TezosConstants_1.TezosConstants.HeadBranchOffset, true); | ||
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); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
@@ -136,0 +135,0 @@ }); |
@@ -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, balancePath?: string): Promise<number>; | ||
function getAccountBalance(server: string, mapid: number, account: string): Promise<number>; | ||
} | ||
export {}; |
@@ -25,3 +25,2 @@ "use strict"; | ||
const TezosContractUtils_1 = require("../TezosContractUtils"); | ||
const TezosConstants_1 = require("../../../../types/tezos/TezosConstants"); | ||
var SingleAssetTokenHelper; | ||
@@ -131,4 +130,4 @@ (function (SingleAssetTokenHelper) { | ||
const entryPoint = 'transfer'; | ||
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); | ||
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); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
@@ -168,3 +167,3 @@ }); | ||
SingleAssetTokenHelper.removeOperators = removeOperators; | ||
function getAccountBalance(server, mapid, account, balancePath = '$.int') { | ||
function getAccountBalance(server, mapid, account) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -176,4 +175,4 @@ const packedKey = TezosMessageUtil_1.TezosMessageUtils.encodeBigMapKey(Buffer.from(TezosMessageUtil_1.TezosMessageUtils.writePackedData(account, "address"), 'hex')); | ||
} | ||
const balance = Number(jsonpath_plus_1.JSONPath({ path: balancePath, json: mapResult })[0]); | ||
return balance; | ||
const jsonresult = jsonpath_plus_1.JSONPath({ path: '$.int', json: mapResult }); | ||
return Number(jsonresult[0]); | ||
}); | ||
@@ -180,0 +179,0 @@ } |
@@ -6,3 +6,3 @@ import { KeyStore, Signer } from '../../../types/ExternalInterfaces'; | ||
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, balancePath?: string): Promise<number>; | ||
function getAccountBalance(server: string, mapid: number, account: string): Promise<number>; | ||
function getAccountAllowance(server: string, mapid: number, account: string, source: string): Promise<any>; | ||
@@ -9,0 +9,0 @@ function getSimpleStorage(server: string, address: string): Promise<{ |
@@ -49,3 +49,3 @@ "use strict"; | ||
Tzip7ReferenceTokenHelper.deployContract = deployContract; | ||
function getAccountBalance(server, mapid, account, balancePath = '$.args[0].int') { | ||
function getAccountBalance(server, mapid, account) { | ||
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: balancePath, json: mapResult }); | ||
const jsonresult = jsonpath_plus_1.JSONPath({ path: '$.args[0].int', json: mapResult }); | ||
return Number(jsonresult[0]); | ||
@@ -111,4 +111,4 @@ }); | ||
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, TezosConstants_1.TezosConstants.HeadBranchOffset, true); | ||
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); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
@@ -120,4 +120,4 @@ }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
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); | ||
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); | ||
return TezosContractUtils_1.TezosContractUtils.clearRPCOperationGroupHash(nodeResult.operationGroupID); | ||
@@ -124,0 +124,0 @@ }); |
@@ -42,5 +42,5 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
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); | ||
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; | ||
@@ -47,0 +47,0 @@ }); |
@@ -113,3 +113,3 @@ "use strict"; | ||
function getValueForBigMapKey(server, index, key, block = 'head', chainid = 'main') { | ||
return performGetRequest(server, `chains/${chainid}/blocks/${block}/context/big_maps/${index}/${key}`).catch(err => undefined); | ||
return performGetRequest(server, `chains/${chainid}/blocks/${block}/context/big_maps/${index}/${key}`); | ||
} | ||
@@ -116,0 +116,0 @@ TezosNodeReader.getValueForBigMapKey = getValueForBigMapKey; |
@@ -44,4 +44,3 @@ 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; | ||
} |
@@ -195,5 +195,3 @@ "use strict"; | ||
} | ||
else { | ||
return operations.map((o, i) => { return Object.assign(Object.assign({}, o), { counter: `${counter + i}` }); }); | ||
} | ||
return operations; | ||
}); | ||
@@ -465,17 +463,2 @@ } | ||
} | ||
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) { | ||
@@ -482,0 +465,0 @@ let errors = ''; |
@@ -10,3 +10,2 @@ export * from './chain/tezos/TezosContractIntrospector'; | ||
export * from './chain/tezos/contracts/DexterPoolHelper'; | ||
export * from './chain/tezos/contracts/HicNFT'; | ||
export * from './chain/tezos/contracts/KolibriTokenHelper'; | ||
@@ -13,0 +12,0 @@ export * from './chain/tezos/contracts/MurbardMultisigHelper'; |
@@ -22,3 +22,2 @@ "use strict"; | ||
__export(require("./chain/tezos/contracts/DexterPoolHelper")); | ||
__export(require("./chain/tezos/contracts/HicNFT")); | ||
__export(require("./chain/tezos/contracts/KolibriTokenHelper")); | ||
@@ -25,0 +24,0 @@ __export(require("./chain/tezos/contracts/MurbardMultisigHelper")); |
@@ -12,3 +12,2 @@ export declare function registerLogger(logger: any): void; | ||
export * from './chain/tezos/contracts/DexterPoolHelper'; | ||
export * from './chain/tezos/contracts/HicNFT'; | ||
export * from './chain/tezos/contracts/KolibriTokenHelper'; | ||
@@ -15,0 +14,0 @@ export * from './chain/tezos/contracts/MurbardMultisigHelper'; |
@@ -28,3 +28,2 @@ "use strict"; | ||
__export(require("./chain/tezos/contracts/DexterPoolHelper")); | ||
__export(require("./chain/tezos/contracts/HicNFT")); | ||
__export(require("./chain/tezos/contracts/KolibriTokenHelper")); | ||
@@ -31,0 +30,0 @@ __export(require("./chain/tezos/contracts/MurbardMultisigHelper")); |
{ | ||
"name": "conseiljs", | ||
"version": "5.0.9-beta.2", | ||
"version": "5.0.9-beta.3", | ||
"description": "Client-side library for Tezos dApp development.", | ||
@@ -73,3 +73,3 @@ "browser": "dist/index-web.js", | ||
"bs58check": "2.1.2", | ||
"jsonpath-plus": "5.0.7", | ||
"jsonpath-plus": "5.0.2", | ||
"moo": "0.5.0", | ||
@@ -89,10 +89,10 @@ "nearley": "2.19.1" | ||
"chai-as-promised": "7.1.1", | ||
"conseiljs-softsigner": "5.0.4-1", | ||
"conseiljs-softsigner": "5.0.3", | ||
"copyfiles": "2.3.0", | ||
"coveralls": "3.1.0", | ||
"eslint": "7.18.0", | ||
"glob": "7.1.7", | ||
"glob": "7.1.6", | ||
"loglevel": "1.7.1", | ||
"mocha": "8.4.0", | ||
"nock": "13.0.11", | ||
"mocha": "8.2.1", | ||
"nock": "13.0.6", | ||
"node-fetch": "2.6.1", | ||
@@ -103,3 +103,3 @@ "nyc": "15.1.0", | ||
"tsconfig-paths-webpack-plugin": "3.3.0", | ||
"typedoc": "^0.20.36", | ||
"typedoc": "^0.21.4", | ||
"typedoc-plugin-markdown": "2.4.2", | ||
@@ -106,0 +106,0 @@ "typescript": "3.8.3", |
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
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
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
805989
7775
+ Addedjsonpath-plus@5.0.2(transitive)
- Removedjsonpath-plus@5.0.7(transitive)
Updatedjsonpath-plus@5.0.2