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

@waves/data-entities

Package Overview
Dependencies
Maintainers
8
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waves/data-entities - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

dist/utils.d.ts

1

dist/entities/Money.d.ts

@@ -36,3 +36,2 @@ import { Asset } from './Asset';

static fromCoins(count: number | string | BigNumber, asset: Asset): Money;
private static _toBigNumber(some);
private static _checkAmount(amount);

@@ -39,0 +38,0 @@ private static _tokensToCoins(tokens, precision);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bignumber_1 = require("../libs/bignumber");
var utils_1 = require("../utils");
var Money = /** @class */ (function () {

@@ -10,3 +11,3 @@ // @todo refactor to accept full 'tokens' instead of 'coins'

this.asset = asset;
this._coins = Money._toBigNumber(coins);
this._coins = utils_1.toBigNumber(coins);
this._tokens = this._coins.div(divider);

@@ -113,3 +114,3 @@ }

Money.fromTokens = function (count, asset) {
var tokens = Money._toBigNumber(count);
var tokens = utils_1.toBigNumber(count);
return new Money(tokens.times(new bignumber_1.BigNumber(10).pow(asset.precision)), asset);

@@ -120,5 +121,2 @@ };

};
Money._toBigNumber = function (some) {
return some instanceof bignumber_1.BigNumber ? some : new bignumber_1.BigNumber(some);
};
Money._checkAmount = function (amount) {

@@ -125,0 +123,0 @@ if (!(typeof amount === 'string' || amount instanceof bignumber_1.BigNumber)) {

@@ -21,4 +21,7 @@ import { BigNumber } from '../libs/bignumber';

toString(): string;
static fromMatcherCoins(coins: string | number | BigNumber, pair: AssetPair): OrderPrice;
static fromTokens(tokens: string | number | BigNumber, pair: AssetPair): OrderPrice;
private static _getMatcherDivider(precision);
static isOrderPrice(object: object): object is OrderPrice;
private static _checkAmount(amount);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bignumber_1 = require("../libs/bignumber");
var utils_1 = require("../utils");
var OrderPrice = /** @class */ (function () {

@@ -37,2 +38,13 @@ // @todo refactor to accept Money instead of BigNumber

};
OrderPrice.fromMatcherCoins = function (coins, pair) {
OrderPrice._checkAmount(coins);
return new OrderPrice(utils_1.toBigNumber(coins), pair);
};
OrderPrice.fromTokens = function (tokens, pair) {
OrderPrice._checkAmount(tokens);
tokens = utils_1.toBigNumber(tokens).toFixed(pair.priceAsset.precision);
var divider = OrderPrice._getMatcherDivider(pair.precisionDifference);
var coins = new bignumber_1.BigNumber(tokens).times(divider);
return new OrderPrice(coins, pair);
};
OrderPrice._getMatcherDivider = function (precision) {

@@ -46,2 +58,7 @@ return new bignumber_1.BigNumber(10)

};
OrderPrice._checkAmount = function (amount) {
if (!(['string', 'number'].includes(typeof amount) || amount instanceof bignumber_1.BigNumber)) {
throw new Error('Please use strings to create instances of OrderPrice');
}
};
OrderPrice._MATCHER_SCALE = new bignumber_1.BigNumber(10).pow(8);

@@ -48,0 +65,0 @@ return OrderPrice;

@@ -101,2 +101,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.dataEntities = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){

var bignumber_1 = require("../libs/bignumber");
var utils_1 = require("../utils");
var Money = /** @class */ (function () {

@@ -108,3 +109,3 @@ // @todo refactor to accept full 'tokens' instead of 'coins'

this.asset = asset;
this._coins = Money._toBigNumber(coins);
this._coins = utils_1.toBigNumber(coins);
this._tokens = this._coins.div(divider);

@@ -211,3 +212,3 @@ }

Money.fromTokens = function (count, asset) {
var tokens = Money._toBigNumber(count);
var tokens = utils_1.toBigNumber(count);
return new Money(tokens.times(new bignumber_1.BigNumber(10).pow(asset.precision)), asset);

@@ -218,5 +219,2 @@ };

};
Money._toBigNumber = function (some) {
return some instanceof bignumber_1.BigNumber ? some : new bignumber_1.BigNumber(some);
};
Money._checkAmount = function (amount) {

@@ -239,6 +237,7 @@ if (!(typeof amount === 'string' || amount instanceof bignumber_1.BigNumber)) {

},{"../libs/bignumber":7}],5:[function(require,module,exports){
},{"../libs/bignumber":7,"../utils":8}],5:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bignumber_1 = require("../libs/bignumber");
var utils_1 = require("../utils");
var OrderPrice = /** @class */ (function () {

@@ -277,2 +276,13 @@ // @todo refactor to accept Money instead of BigNumber

};
OrderPrice.fromMatcherCoins = function (coins, pair) {
OrderPrice._checkAmount(coins);
return new OrderPrice(utils_1.toBigNumber(coins), pair);
};
OrderPrice.fromTokens = function (tokens, pair) {
OrderPrice._checkAmount(tokens);
tokens = utils_1.toBigNumber(tokens).toFixed(pair.priceAsset.precision);
var divider = OrderPrice._getMatcherDivider(pair.precisionDifference);
var coins = new bignumber_1.BigNumber(tokens).times(divider);
return new OrderPrice(coins, pair);
};
OrderPrice._getMatcherDivider = function (precision) {

@@ -286,2 +296,7 @@ return new bignumber_1.BigNumber(10)

};
OrderPrice._checkAmount = function (amount) {
if (!(['string', 'number'].includes(typeof amount) || amount instanceof bignumber_1.BigNumber)) {
throw new Error('Please use strings to create instances of OrderPrice');
}
};
OrderPrice._MATCHER_SCALE = new bignumber_1.BigNumber(10).pow(8);

@@ -292,3 +307,3 @@ return OrderPrice;

},{"../libs/bignumber":7}],6:[function(require,module,exports){
},{"../libs/bignumber":7,"../utils":8}],6:[function(require,module,exports){
"use strict";

@@ -318,3 +333,12 @@ Object.defineProperty(exports, "__esModule", { value: true });

},{"bignumber.js":undefined}]},{},[6])(6)
},{"bignumber.js":undefined}],8:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bignumber_1 = require("./libs/bignumber");
function toBigNumber(some) {
return some instanceof bignumber_1.BigNumber ? some : new bignumber_1.BigNumber(some);
}
exports.toBigNumber = toBigNumber;
},{"./libs/bignumber":7}]},{},[6])(6)
});
{
"name": "@waves/data-entities",
"description": "Waves data types",
"version": "1.3.2",
"version": "1.3.3",
"license": "Apache-2.0",

@@ -6,0 +6,0 @@ "private": false,

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