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

@nimiq/fastspot-api

Package Overview
Dependencies
Maintainers
8
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nimiq/fastspot-api - npm Package Compare versions

Comparing version 1.5.2 to 1.5.3

21

dist/helpers.js

@@ -1,19 +0,6 @@

import { SwapAsset, ReferenceAsset, } from './types';
import { SwapAsset, Precision, } from './types';
export function coinsToUnits(asset, value, roundUp = false) {
let decimals;
switch (asset) {
case SwapAsset.NIM:
decimals = 5;
break;
case SwapAsset.BTC:
decimals = 8;
break;
case SwapAsset.EUR:
decimals = 2;
break;
case ReferenceAsset.USD:
decimals = 2;
break;
default: throw new Error(`Invalid asset ${asset}`);
}
let decimals = Precision[asset];
if (typeof decimals === 'undefined')
throw new Error(`Invalid asset ${asset}`);
const parts = value.toString().split('.');

@@ -20,0 +7,0 @@ parts[1] = (parts[1] || '').substr(0, decimals + 1).padEnd(decimals + 1, '0');

6

dist/types.d.ts

@@ -9,2 +9,8 @@ export declare enum SwapAsset {

}
export declare const Precision: {
readonly NIM: 5;
readonly BTC: 8;
readonly EUR: 2;
readonly USD: 2;
};
export declare type FastspotAsset = {

@@ -11,0 +17,0 @@ symbol: SwapAsset;

@@ -11,1 +11,7 @@ export var SwapAsset;

})(ReferenceAsset || (ReferenceAsset = {}));
export const Precision = {
[SwapAsset.NIM]: 5,
[SwapAsset.BTC]: 8,
[SwapAsset.EUR]: 2,
[ReferenceAsset.USD]: 2,
};
{
"name": "@nimiq/fastspot-api",
"version": "1.5.2",
"version": "1.5.3",
"description": "Typescript library to interact with the Fastspot API",

@@ -5,0 +5,0 @@ "repository": "git@github.com:nimiq/fastspot-api.git",

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