@generalprotocols/price-oracle
Advanced tools
Comparing version 2.1.0-development.3540578104 to 2.1.0-development.3566305716
@@ -425,3 +425,3 @@ 'use strict'; | ||
// Parse the message price from the content of the message. | ||
const priceValue = libauth.binToNumberInt32LE(dataContent); | ||
const priceValue = await this.getPriceValue(dataContent); | ||
// Validate that the price itself has a valid format. | ||
@@ -435,2 +435,14 @@ await this.validateMessagePrice(priceValue); | ||
/** | ||
* Convert a data content into a human readable number. | ||
* | ||
* @param dataContentBin {Uint8Array} Binary content of the data message. | ||
* | ||
* @returns {Promise<number>} the data content as a human readable number. | ||
*/ | ||
static async getPriceValue(dataContentBin) { | ||
// Parse the message price from the content of the message. | ||
const decodedPriceValue = libauth.binToNumberInt32LE(dataContentBin); | ||
return decodedPriceValue; | ||
} | ||
/** | ||
* Convert a metadata content into a human readable string. | ||
@@ -437,0 +449,0 @@ * |
@@ -417,3 +417,3 @@ import { hexToBin, numberToBinInt32LE, flattenBinArray, binToHex, binToNumberInt32LE, decodePrivateKeyWif, sha256, secp256k1, decodeAuthenticationInstructions, authenticationInstructionsAreMalformed } from '@bitauth/libauth'; | ||
// Parse the message price from the content of the message. | ||
const priceValue = binToNumberInt32LE(dataContent); | ||
const priceValue = await this.getPriceValue(dataContent); | ||
// Validate that the price itself has a valid format. | ||
@@ -427,2 +427,14 @@ await this.validateMessagePrice(priceValue); | ||
/** | ||
* Convert a data content into a human readable number. | ||
* | ||
* @param dataContentBin {Uint8Array} Binary content of the data message. | ||
* | ||
* @returns {Promise<number>} the data content as a human readable number. | ||
*/ | ||
static async getPriceValue(dataContentBin) { | ||
// Parse the message price from the content of the message. | ||
const decodedPriceValue = binToNumberInt32LE(dataContentBin); | ||
return decodedPriceValue; | ||
} | ||
/** | ||
* Convert a metadata content into a human readable string. | ||
@@ -429,0 +441,0 @@ * |
@@ -427,3 +427,3 @@ 'use strict'; | ||
// Parse the message price from the content of the message. | ||
const priceValue = libauth.binToNumberInt32LE(dataContent); | ||
const priceValue = await this.getPriceValue(dataContent); | ||
// Validate that the price itself has a valid format. | ||
@@ -437,2 +437,14 @@ await this.validateMessagePrice(priceValue); | ||
/** | ||
* Convert a data content into a human readable number. | ||
* | ||
* @param dataContentBin {Uint8Array} Binary content of the data message. | ||
* | ||
* @returns {Promise<number>} the data content as a human readable number. | ||
*/ | ||
static async getPriceValue(dataContentBin) { | ||
// Parse the message price from the content of the message. | ||
const decodedPriceValue = libauth.binToNumberInt32LE(dataContentBin); | ||
return decodedPriceValue; | ||
} | ||
/** | ||
* Convert a metadata content into a human readable string. | ||
@@ -439,0 +451,0 @@ * |
@@ -256,2 +256,10 @@ import { Subscriber, Publisher, Request, Reply } from 'zeromq'; | ||
/** | ||
* Convert a data content into a human readable number. | ||
* | ||
* @param dataContentBin {Uint8Array} Binary content of the data message. | ||
* | ||
* @returns {Promise<number>} the data content as a human readable number. | ||
*/ | ||
static getPriceValue(dataContentBin: Uint8Array): Promise<number>; | ||
/** | ||
* Convert a metadata content into a human readable string. | ||
@@ -258,0 +266,0 @@ * |
@@ -419,3 +419,3 @@ import { hexToBin, numberToBinInt32LE, flattenBinArray, binToHex, binToNumberInt32LE, decodePrivateKeyWif, sha256, secp256k1, decodeAuthenticationInstructions, authenticationInstructionsAreMalformed } from '@bitauth/libauth'; | ||
// Parse the message price from the content of the message. | ||
const priceValue = binToNumberInt32LE(dataContent); | ||
const priceValue = await this.getPriceValue(dataContent); | ||
// Validate that the price itself has a valid format. | ||
@@ -429,2 +429,14 @@ await this.validateMessagePrice(priceValue); | ||
/** | ||
* Convert a data content into a human readable number. | ||
* | ||
* @param dataContentBin {Uint8Array} Binary content of the data message. | ||
* | ||
* @returns {Promise<number>} the data content as a human readable number. | ||
*/ | ||
static async getPriceValue(dataContentBin) { | ||
// Parse the message price from the content of the message. | ||
const decodedPriceValue = binToNumberInt32LE(dataContentBin); | ||
return decodedPriceValue; | ||
} | ||
/** | ||
* Convert a metadata content into a human readable string. | ||
@@ -431,0 +443,0 @@ * |
{ | ||
"name": "@generalprotocols/price-oracle", | ||
"version": "2.1.0-development.3540578104", | ||
"version": "2.1.0-development.3566305716", | ||
"description": "Library for creating, parsing, signing, verifying and transferring PriceOracle messages.", | ||
@@ -5,0 +5,0 @@ "exports": { |
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
223820
4181